Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(index): avoid recursing endlessly in add()#410

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:masterfromppietrasa:master
Apr 14, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
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
14 changes: 11 additions & 3 deletionsgit/index/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -380,9 +380,17 @@ def raise_exc(e):

# resolve globs if possible
if '?' in path or '*' in path or '[' in path:
for f in self._iter_expand_paths(glob.glob(abs_path)):
yield f.replace(rs, '')
continue
resolved_paths = glob.glob(abs_path)
# not abs_path in resolved_paths:
# a glob() resolving to the same path we are feeding it with
# is a glob() that failed to resolve. If we continued calling
# ourselves we'd endlessly recurse. If the condition below
# evaluates to true then we are likely dealing with a file
# whose name contains wildcard characters.
if abs_path not in resolved_paths:
for f in self._iter_expand_paths(glob.glob(abs_path)):
yield f.replace(rs, '')
continue
# END glob handling
try:
for root, dirs, files in os.walk(abs_path, onerror=raise_exc):
Expand Down
11 changes: 11 additions & 0 deletionsgit/test/test_index.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -796,3 +796,14 @@ def test_add_utf8P_path(self, rw_dir):
r = Repo.init(rw_dir)
r.index.add([fp])
r.index.commit('Added orig and prestable')

@with_rw_directory
def test_add_a_file_with_wildcard_chars(self, rw_dir):
# see issue #407
fp = os.path.join(rw_dir, '[.exe')
with open(fp, "wb") as f:
f.write(b'something')

r = Repo.init(rw_dir)
r.index.add([fp])
r.index.commit('Added [.exe')

[8]ページ先頭

©2009-2025 Movatter.jp