Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3a4fc21

Browse files
rscharfegitster
authored andcommitted
t8001, t8002: fix "blame -L :literal" test on NetBSD
Sub-test 42 of t8001 and t8002 ("blame -L :literal") fails on NetBSD with the following verbose output: git annotate -L:main hello.c Author F (expected 4, attributed 3) bad Author G (expected 1, attributed 1) good This is not caused by different behaviour of git blame or annotate on that platform, but by different test input, in turn caused by a sed command that forgets to add a newline on NetBSD. Here's the diff of the commit that adds "goodbye" to hello.c, for Linux: @@ -1,4 +1,5 @@ int main(int argc, const char *argv[]) { puts("hello"); + puts("goodbye"); } We see that it adds an extra TAB, but that's not a problem. Here's the same on NetBSD: @@ -1,4 +1,4 @@ int main(int argc, const char *argv[]) { puts("hello"); -} + puts("goodbye");} It also adds an extra TAB, but it is missing the newline character after the semicolon. The following patch gets rid of the extra TAB at the beginning, but more importantly adds the missing newline at the end in a (hopefully) portable way, mentioned in http://sed.sourceforge.net/sedfaq4.html. The diff becomes this, on both Linux and NetBSD: @@ -1,4 +1,5 @@ int main(int argc, const char *argv[]) { puts("hello"); + puts("goodbye"); } Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent df83d5c commit 3a4fc21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/annotate-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ test_expect_success 'setup -L :regex' '
245245
git commit -m "hello" &&
246246
247247
mv hello.c hello.orig &&
248-
sed -e "/}/i\\
249-
Qputs(\"goodbye\");" <hello.orig | tr Q "\\t" >hello.c &&
248+
sed -e "/}/ {x; s/$/Qputs(\"goodbye\");/; G;}" <hello.orig |
249+
tr Q "\\t" >hello.c &&
250250
GIT_AUTHOR_NAME="G" GIT_AUTHOR_EMAIL="[email protected]" \
251251
git commit -a -m "goodbye" &&
252252

0 commit comments

Comments
 (0)