6d67a993b2
It is quite possible that the loose object cache gets stale when new objects are written. In that case, get_oid() would potentially say that it cannot find a given object, even if it should find it. Let's blow away the loose object cache as well as the read packs and try again in that case. Note: this does *not* affect the code path that was introduced to help avoid looking for the same non-existing objects (which made some operations really expensive via NFS): that code path is handled by the `OBJECT_INFO_QUICK` flag (which does not even apply to `get_oid()`, which has no equivalent flag, at least at the time this patch was written). This incidentally fixes the problem identified earlier where an interactive rebase wanted to re-read (and validate) the todo list after an `exec` command modified it. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
37 lines
959 B
Bash
Executable File
37 lines
959 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='rebase should reread the todo file if an exec modifies it'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'rebase exec modifies rebase-todo' '
|
|
test_commit initial &&
|
|
todo=.git/rebase-merge/git-rebase-todo &&
|
|
git rebase HEAD -x "echo exec touch F >>$todo" &&
|
|
test -e F
|
|
'
|
|
|
|
test_expect_success 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
|
|
|
|
shift
|
|
test -z "$*" ||
|
|
echo "exec $0 $*" >>$GIT_REBASE_TODO
|
|
EOS
|
|
|
|
git rebase HEAD -x "./append-todo.sh 5 6"
|
|
'
|
|
|
|
test_done
|