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

Commitc3fc83f

Browse files
committed
Add missing rules to match hierarchy path
1 parent16d3ebf commitc3fc83f

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

‎git/config.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -467,20 +467,24 @@ def _included_paths(self):
467467
keyword=match.group(1)
468468
value=match.group(2).strip()
469469

470-
ifkeyword=="gitdir":
471-
value=osp.expanduser(value)
472-
iffnmatch.fnmatchcase(self._repo.git_dir,value):
473-
paths+=self.items(section)
474-
475-
elifkeyword=="gitdir/i":
470+
ifkeywordin ["gitdir","gitdir/i"]:
476471
value=osp.expanduser(value)
477472

478-
# Ensure that glob is always case insensitive.
479-
value=re.sub(
480-
r"[a-zA-Z]",
481-
lambdam:f"[{m.group().lower()}{m.group().upper()}]",
482-
value
483-
)
473+
ifnotany(value.startswith(s)forsin ["./","/"]):
474+
value="**/"+value
475+
ifvalue.endswith("/"):
476+
value+="**"
477+
478+
# Ensure that glob is always case insensitive if required.
479+
ifkeyword.endswith("/i"):
480+
value=re.sub(
481+
r"[a-zA-Z]",
482+
lambdam:"[{}{}]".format(
483+
m.group().lower(),
484+
m.group().upper()
485+
),
486+
value
487+
)
484488

485489
iffnmatch.fnmatchcase(self._repo.git_dir,value):
486490
paths+=self.items(section)

‎test/test_config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,14 @@ def test_conditional_includes_from_git_dir(self, rw_dir):
299299
assertnotconfig._has_includes()
300300
assertconfig._included_paths()== []
301301

302+
# Ensure that config is included if path in hierarchy.
303+
withopen(path1,"w")asstream:
304+
stream.write(template.format("gitdir","target1/",path2))
305+
306+
withGitConfigParser(path1,repo=repo)asconfig:
307+
assertconfig._has_includes()
308+
assertconfig._included_paths()== [("path",path2)]
309+
302310
@with_rw_directory
303311
deftest_conditional_includes_from_branch_name(self,rw_dir):
304312
# Initiate mocked branch

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp