From 9b01f0038b63ccdf697b2387f4fcd4b03bd249d5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 21 Apr 2011 15:07:36 -0700 Subject: blame: tolerate bogus e-mail addresses a bit better The names and e-mails are sanitized by fmt_ident() when creating commits, so that they do not contain "<" nor ">", and the "committer" and "author" lines in the commit object will always be in the form: ("author" | "committer") name SP "<" email ">" SP timestamp SP zone When parsing the email part out, the current code looks for SP starting from the end of the email part, but the author could obfuscate the address as "author at example dot com". We should instead look for SP followed by "<", to match the logic of the side that formats these lines. Signed-off-by: Josh Stone Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- t/annotate-tests.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't/annotate-tests.sh') diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index d34208cc27..abb1885957 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -1,5 +1,5 @@ # This file isn't used as a test script directly, instead it is -# sourced from t8001-annotate.sh and t8001-blame.sh. +# sourced from t8001-annotate.sh and t8002-blame.sh. check_count () { head= @@ -124,3 +124,13 @@ test_expect_success \ test_expect_success \ 'some edit' \ 'check_count A 1 B 1 B1 1 B2 1 "A U Thor" 1 C 1 D 1' + +test_expect_success \ + 'an obfuscated email added' \ + 'sed -e "1i No robots allowed" < file > file.new && + mv file.new file && + GIT_AUTHOR_NAME="E" GIT_AUTHOR_EMAIL="E at test dot git" git commit -a -m "norobots"' + +test_expect_success \ + 'obfuscated email parsed' \ + 'check_count A 1 B 1 B1 1 B2 1 "A U Thor" 1 C 1 D 1 E 1' -- cgit v1.2.3 From c01bd5a29f38e4e9fd5c03f3e1e84b88c392dd6f Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Thu, 5 May 2011 00:43:37 -0400 Subject: t/annotate-tests: Use echo & cat instead of sed The use of the sed command "1i No robots allowed" caused the version of sed in OS X to die with sed: 1: "1i "No robots allowed"\n": command i expects \ followed by text Since this command was just trying to add a single line to the beginning of the file, do the same with "echo" followed by "cat". Unbreaks t8001 and t8002 on OS X 10.6.7 Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/annotate-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't/annotate-tests.sh') diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index abb1885957..c56a77d237 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -127,7 +127,8 @@ test_expect_success \ test_expect_success \ 'an obfuscated email added' \ - 'sed -e "1i No robots allowed" < file > file.new && + 'echo "No robots allowed" > file.new && + cat file >> file.new && mv file.new file && GIT_AUTHOR_NAME="E" GIT_AUTHOR_EMAIL="E at test dot git" git commit -a -m "norobots"' -- cgit v1.2.3