Re: [PATCH 1/4] rebase -i: demonstrate obscure loose object cache bug
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 14, 2019, 01:12 UTC
- Message-ID
- <xmqqimwmcl93.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <b3fcd377652103584b6f307c6ee209980b44529f.1552472189.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 13 quoted lines
> +test_expect_failure SHA1 'loose object cache vs re-reading todo list' ' > + GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo && > + export GIT_REBASE_TODO && > + write_script append-todo.sh <<-\EOS && > + # For values 5 and 6, this yields SHA-1s with the same first two digits > + echo "pick $(git rev-parse --short \ > + $(printf "%s\\n" \ > + "tree $EMPTY_TREE" \ > + "author A U Thor <author@example.org> $1 +0000" \ > + "committer A U Thor <author@example.org> $1 +0000" \ > + "" \ > + "$1" | > + git hash-object -t commit -w --stdin))" >>$GIT_REBASE_TODO
In the generated append-todo.sh, as the <<EOS above is quoted, we will see ">>$GIT_REBASE_TODO" literally (not the actual pathname that begins with .git, but a reference to the variable). test-lint may or may not catch it, but redirecting into variable reference would trigger a(n arguably misguided) warning when run with some versions of bash. Quoting
echo ... >>"$GIT_REBASE_TODO"
would work it around, of course.
> + shift > + test -z "$*" || > + echo "exec $0 $*" >>$GIT_REBASE_TODO
Likewise.
Show 6 quoted lines
> + EOS > + > + git rebase HEAD -x "./append-todo.sh 5 6" > +' > + > test_done