| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -424,7 +424,8 @@ def read(self): | |||
| 424 | 424 | if include_path in seen or not os.access(include_path, os.R_OK): | |
| 425 | 425 | continue | |
| 426 | 426 | seen.add(include_path) | |
| 427 | - files_to_read.append(include_path) | ||
| 427 | + # insert included file to the top to be considered first | ||
| 428 | + files_to_read.insert(0, include_path) | ||
| 428 | 429 | num_read_include_files += 1 | |
| 429 | 430 | # each include path in configuration file | |
| 430 | 431 | # end handle includes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,11 +22,25 @@ | |||
| 22 | 22 | url = git://gitorious.org/~martin.marcher/git-python/serverhorror.git | |
| 23 | 23 | fetch = +refs/heads/*:refs/remotes/MartinMarcher/* | |
| 24 | 24 | # can handle comments - the section name is supposed to be stripped | |
| 25 | + # causes stock git-config puke | ||
| 25 | 26 | [ gui ] | |
| 26 | 27 | geometry = 1316x820+219+243 207 192 | |
| 27 | 28 | [branch "mainline_performance"] | |
| 28 | 29 | remote = mainline | |
| 29 | 30 | merge = refs/heads/master | |
| 31 | + # section with value defined before include to be overriden | ||
| 32 | + [sec] | ||
| 33 | + var0 = value0_main | ||
| 30 | 34 | [include] | |
| 31 | - path = doesntexist.cfg | ||
| 32 | - abspath = /usr/bin/foodoesntexist.bar | ||
| 35 | + path = doesntexist.cfg | ||
| 36 | + # field should be 'path' so abspath should be ignored | ||
| 37 | + abspath = /usr/bin/foodoesntexist.bar | ||
| 38 | + path = /usr/bin/foodoesntexist.bar | ||
| 39 | + # should be relative to the path of this config file | ||
| 40 | + path = ./git_config-inc.cfg | ||
| 41 | + # and defined after include. According to the documentation | ||
| 42 | + # and behavior of git config, this should be the value since | ||
| 43 | + # inclusions should be processed immediately | ||
| 44 | + [sec] | ||
| 45 | + var1 = value1_main | ||
| 46 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + [sec] | ||
| 2 | + var0 = value0_included | ||
| 3 | + var1 = value1_included | ||
| 4 | + [diff] | ||
| 5 | + tool = diff_included | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,8 @@ | |||
| 29 | 29 | import unittest | |
| 30 | 30 | ||
| 31 | 31 | TestCase = unittest.TestCase | |
| 32 | + SkipTest = unittest.SkipTest | ||
| 33 | + skipIf = unittest.skipIf | ||
| 32 | 34 | ||
| 33 | 35 | ospd = osp.dirname | |
| 34 | 36 | ||
@@ -37,7 +39,9 @@ | |||
| 37 | 39 | ||
| 38 | 40 | __all__ = ( | |
| 39 | 41 | 'fixture_path', 'fixture', 'StringProcessAdapter', | |
| 40 | - 'with_rw_directory', 'with_rw_repo', 'with_rw_and_rw_remote_repo', 'TestBase', 'TestCase', | ||
| 42 | + 'with_rw_directory', 'with_rw_repo', 'with_rw_and_rw_remote_repo', | ||
| 43 | + 'TestBase', 'TestCase', | ||
| 44 | + 'SkipTest', 'skipIf', | ||
| 41 | 45 | 'GIT_REPO', 'GIT_DAEMON_PORT' | |
| 42 | 46 | ) | |
| 43 | 47 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ | |||
| 15 | 15 | from git.test.lib import ( | |
| 16 | 16 | TestCase, | |
| 17 | 17 | fixture_path, | |
| 18 | + SkipTest, | ||
| 18 | 19 | ) | |
| 19 | 20 | from git.test.lib import with_rw_directory | |
| 20 | 21 | ||
@@ -88,6 +89,21 @@ def test_read_write(self): | |||
| 88 | 89 | assert r_config.get(sname, oname) == val | |
| 89 | 90 | # END for each filename | |
| 90 | 91 | ||
| 92 | + def test_includes_order(self): | ||
| 93 | + with GitConfigParser(list(map(fixture_path, ("git_config", "git_config_global")))) as r_config: | ||
| 94 | + r_config.read() # enforce reading | ||
| 95 | + # Simple inclusions, again checking them taking precedence | ||
| 96 | + assert r_config.get_value('sec', 'var0') == "value0_included" | ||
| 97 | + # This one should take the git_config_global value since included | ||
| 98 | + # values must be considered as soon as they get them | ||
| 99 | + assert r_config.get_value('diff', 'tool') == "meld" | ||
| 100 | + try: | ||
| 101 | + assert r_config.get_value('sec', 'var1') == "value1_main" | ||
| 102 | + except AssertionError: | ||
| 103 | + raise SkipTest( | ||
| 104 | + 'Known failure -- included values are not in effect right away' | ||
| 105 | + ) | ||
| 106 | + | ||
| 91 | 107 | @with_rw_directory | |
| 92 | 108 | def test_lock_reentry(self, rw_dir): | |
| 93 | 109 | fpl = osp.join(rw_dir, 'l') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments