Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2018-12-17 19:59:57 +0300
committerJunio C Hamano <gitster@pobox.com>2018-12-27 02:41:47 +0300
commit957da7580255f30ce8f1224531e795a9bace3d52 (patch)
treee4762cdf76e36222cafafe15470216f8e0172b95 /t/t0030-stripspace.sh
parent0d0ac3826a3bbb9247e39e12623bbcfdd722f24c (diff)
stripspace: allow -s/-c outside git repository
v2.11.0-rc3~3^2~1 (stripspace: respect repository config, 2016-11-21) improved stripspace --strip-comments / --comentlines by teaching them to read repository config, but it went a little too far: when running stripspace outside any repository, the result is $ git stripspace --strip-comments <test-input fatal: not a git repository (or any parent up to mount point /tmp) That makes experimenting with the stripspace command unnecessarily fussy. Fix it by discovering the git directory gently, as intended all along. Reported-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0030-stripspace.sh')
-rwxr-xr-xt/t0030-stripspace.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index 5ce47e8af5..0c24a0f9a3 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -430,9 +430,15 @@ test_expect_success '-c with changed comment char' '
test_expect_success '-c with comment char defined in .git/config' '
test_config core.commentchar = &&
printf "= foo\n" >expect &&
- printf "foo" | (
- mkdir sub && cd sub && git stripspace -c
- ) >actual &&
+ rm -fr sub &&
+ mkdir sub &&
+ printf "foo" | git -C sub stripspace -c >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '-c outside git repository' '
+ printf "# foo\n" >expect &&
+ printf "foo" | nongit git stripspace -c >actual &&
test_cmp expect actual
'