Skip to content

Commit 3528c65

Browse files
committed
Merge branch 'th/fix-multiline-config-parsing'
Signed-off-by: Elijah Newren <newren@gmail.com>
2 parents 0ee22eb + 4697eeb commit 3528c65

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

git-filter-repo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,14 +1683,14 @@ class GitUtils(object):
16831683
def get_config_settings(repo_working_dir):
16841684
output = ''
16851685
try:
1686-
output = subproc.check_output('git config --list'.split(),
1686+
output = subproc.check_output('git config --list --null'.split(),
16871687
cwd=repo_working_dir)
16881688
except subprocess.CalledProcessError as e: # pragma: no cover
16891689
raise SystemExit('fatal: {}'.format(e))
16901690

16911691
# FIXME: Ignores multi-valued keys, just let them overwrite for now
1692-
return dict(line.split(b'=', maxsplit=1)
1693-
for line in output.strip().split(b"\n"))
1692+
return dict(item.split(b'\n', maxsplit=1)
1693+
for item in output.strip().split(b"\0") if item)
16941694

16951695
@staticmethod
16961696
def get_blob_sizes(quiet = False):

t/t9390-filter-repo-basics.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,15 @@ test_expect_success 'origin refs without origin remote does not die' '
895895
)
896896
'
897897

898+
test_expect_success 'multi-line config value' '
899+
test_create_repo multiline_config &&
900+
(
901+
cd multiline_config &&
902+
903+
git config set test.test "test
904+
test" &&
905+
git filter-repo --force
906+
)
907+
'
908+
898909
test_done

0 commit comments

Comments
 (0)