Skip to content

Commit

Permalink
Merge branch 'js/blame-parsename' into maint
Browse files Browse the repository at this point in the history
* js/blame-parsename:
  t/annotate-tests: Use echo & cat instead of sed
  blame: tolerate bogus e-mail addresses a bit better
  • Loading branch information
Junio C Hamano committed May 13, 2011
2 parents 978471d + c01bd5a commit bc67ad8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ static void get_ac_line(const char *inbuf, const char *what,
timepos = tmp;

*tmp = 0;
while (person < tmp && *tmp != ' ')
while (person < tmp && !(*tmp == ' ' && tmp[1] == '<'))
tmp--;
if (tmp <= person)
return;
Expand Down
13 changes: 12 additions & 1 deletion t/annotate-tests.sh
Original file line number Diff line number Diff line change
@@ -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=
Expand Down Expand Up @@ -124,3 +124,14 @@ 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' \
'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"'

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'
2 changes: 1 addition & 1 deletion t/t8002-blame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PROG='git blame -c'

PROG='git blame -c -e'
test_expect_success 'Blame --show-email works' '
check_count "<A@test.git>" 1 "<B@test.git>" 1 "<B1@test.git>" 1 "<B2@test.git>" 1 "<author@example.com>" 1 "<C@test.git>" 1 "<D@test.git>" 1
check_count "<A@test.git>" 1 "<B@test.git>" 1 "<B1@test.git>" 1 "<B2@test.git>" 1 "<author@example.com>" 1 "<C@test.git>" 1 "<D@test.git>" 1 "<E at test dot git>" 1
'

test_done

0 comments on commit bc67ad8

Please sign in to comment.