From: Junio C Hamano Date: Thu, 14 Mar 2019 01:12:08 GMT Subject: Re: [PATCH 1/4] rebase -i: demonstrate obscure loose object cache bug Message-ID: In-Reply-To: "Johannes Schindelin via GitGitGadget" writes: > +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 $1 +0000" \ > + "committer A U Thor $1 +0000" \ > + "" \ > + "$1" | > + git hash-object -t commit -w --stdin))" >>$GIT_REBASE_TODO In the generated append-todo.sh, as the <>$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. > + EOS > + > + git rebase HEAD -x "./append-todo.sh 5 6" > +' > + > test_done