Skip to content

do not glob a path if it exists 'unglobbed' #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
do not glob a path if it exists 'unglobbed'
fix #680
  • Loading branch information
sdementen authored Sep 18, 2018
commit 86ceb965b22d85db681118ef0d5ce76328c0d0f0
9 changes: 7 additions & 2 deletions git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,13 @@ def raise_exc(e):
continue
# end check symlink

# resolve globs if possible
if '?' in path or '*' in path or '[' in path:
# if abs_path exists, yield it, otherwise resolve globs if possible
if os.path.exists(abs_path):
# even if the path contains special characters like ?*[ (glob)
# if it exists, we take it as such and do not try to resolve globs
yield abs_path
# otherwise resolve globs if possible
elif '?' in path or '*' in path or '[' in path:
resolved_paths = glob.glob(abs_path)
# not abs_path in resolved_paths:
# a glob() resolving to the same path we are feeding it with
Expand Down