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

Commit5938ae3

Browse files
CopilotByron
andcommitted
fix: resolve relative includes from relative config paths
Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
1 parent6c7843a commit5938ae3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎git/config.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ def read(self) -> None: # type: ignore[override]
661661
continue
662662
# END ignore relative paths if we don't know the configuration file path
663663
file_path=cast(PathLike,file_path)
664-
assertosp.isabs(file_path),"Need absolute paths to be sure our cycle checks will work"
664+
ifnotosp.isabs(file_path):
665+
file_path=osp.abspath(file_path)
665666
include_path=osp.join(osp.dirname(file_path),include_path)
666667
# END make include path absolute
667668
include_path=osp.normpath(include_path)

‎test/test_config.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,17 @@ def check_test_value(cr, value):
246246
withGitConfigParser(fpa,read_only=True)ascr:
247247
check_test_value(cr,tv)
248248

249+
@with_rw_directory
250+
deftest_relative_include_with_relative_config_path(self,rw_dir):
251+
fpa=osp.join(rw_dir,"a")
252+
fpb=osp.join(rw_dir,"b")
253+
withGitConfigParser(fpb,read_only=False)ascw:
254+
cw.set_value("b","value","b")
255+
withGitConfigParser(fpa,read_only=False)ascw:
256+
cw.set_value("include","path","b")
257+
withGitConfigParser(osp.relpath(fpa),read_only=True)ascr:
258+
assertcr.get_value("b","value")=="b"
259+
249260
@with_rw_directory
250261
deftest_multiple_include_paths_with_same_key(self,rw_dir):
251262
"""Test that multiple 'path' entries under [include] are all respected.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp