diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:27:32 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:27:32 -0800 |
commit | 6f3abb7a8743bbd0bffa11a3f5df84d0da532c59 (patch) | |
tree | 05d573b673ca97526d8a1a1c05dc4b3672ed89ec /t/t1410-reflog.sh | |
parent | 12b9f08953f4f558789f833b0fe438c25ce6d4b1 (diff) | |
parent | 69216bf72be2be4f8aa932324b3145d3f395cdc6 (diff) | |
download | git-6f3abb7a8743bbd0bffa11a3f5df84d0da532c59.tar.gz git-6f3abb7a8743bbd0bffa11a3f5df84d0da532c59.tar.xz |
Merge branch 'jk/for-each-reflog-ent-reverse'
The code that reads the reflog from the newer to the older entries
did not handle an entry that crosses a boundary of block it uses to
read them correctly.
* jk/for-each-reflog-ent-reverse:
for_each_reflog_ent_reverse: turn leftover check into assertion
for_each_reflog_ent_reverse: fix newlines on block boundaries
Diffstat (limited to 't/t1410-reflog.sh')
-rwxr-xr-x | t/t1410-reflog.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 8cf446165..779d4e382 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -287,4 +287,34 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' ' test_cmp expect actual ' +# Triggering the bug detected by this test requires a newline to fall +# exactly BUFSIZ-1 bytes from the end of the file. We don't know +# what that value is, since it's platform dependent. However, if +# we choose some value N, we also catch any D which divides N evenly +# (since we will read backwards in chunks of D). So we choose 8K, +# which catches glibc (with an 8K BUFSIZ) and *BSD (1K). +# +# Each line is 114 characters, so we need 75 to still have a few before the +# last 8K. The 89-character padding on the final entry lines up our +# newline exactly. +test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' ' + git checkout -b reflogskip && + z38=00000000000000000000000000000000000000 && + ident="abc <xyz> 0000000001 +0000" && + for i in $(test_seq 1 75); do + printf "$z38%02d $z38%02d %s\t" $i $(($i+1)) "$ident" && + if test $i = 75; then + for j in $(test_seq 1 89); do + printf X + done + else + printf X + fi && + printf "\n" + done >.git/logs/refs/heads/reflogskip && + git rev-parse reflogskip@{73} >actual && + echo ${z38}03 >expect && + test_cmp expect actual +' + test_done |