Skip to content

Commit 86ceb96

Browse files
authored
do not glob a path if it exists 'unglobbed'
fix #680
1 parent a8591a0 commit 86ceb96

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

git/index/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,13 @@ def raise_exc(e):
377377
continue
378378
# end check symlink
379379

380-
# resolve globs if possible
381-
if '?' in path or '*' in path or '[' in path:
380+
# if abs_path exists, yield it, otherwise resolve globs if possible
381+
if os.path.exists(abs_path):
382+
# even if the path contains special characters like ?*[ (glob)
383+
# if it exists, we take it as such and do not try to resolve globs
384+
yield abs_path
385+
# otherwise resolve globs if possible
386+
elif '?' in path or '*' in path or '[' in path:
382387
resolved_paths = glob.glob(abs_path)
383388
# not abs_path in resolved_paths:
384389
# a glob() resolving to the same path we are feeding it with

0 commit comments

Comments
 (0)