summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-08-02 15:30:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-02 15:30:38 -0700
commit218608cacd478bfdf4bfe40ed7d0b11af94a6a60 (patch)
treec30026405afe95aa26fd0003387e00afe05f17d5 /t
parentFourth batch for 2.19 cycle (diff)
parenthas_uncommitted_changes(): fall back to empty tree (diff)
downloadtgif-218608cacd478bfdf4bfe40ed7d0b11af94a6a60.tar.xz
Merge branch 'jk/has-uncommitted-changes-fix'
"git pull --rebase" on a corrupt HEAD caused a segfault. In general we substitute an empty tree object when running the in-core equivalent of the diff-index command, and the codepath has been corrected to do so as well to fix this issue. * jk/has-uncommitted-changes-fix: has_uncommitted_changes(): fall back to empty tree
Diffstat (limited to 't')
-rwxr-xr-xt/t5520-pull.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 59c4b778d3..68aa5f0340 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -618,6 +618,18 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
)
'
+test_expect_success 'pull --rebase fails on corrupt HEAD' '
+ test_when_finished "rm -rf corrupt" &&
+ git init corrupt &&
+ (
+ cd corrupt &&
+ test_commit one &&
+ obj=$(git rev-parse --verify HEAD | sed "s#^..#&/#") &&
+ rm -f .git/objects/$obj &&
+ test_must_fail git pull --rebase
+ )
+'
+
test_expect_success 'setup for detecting upstreamed changes' '
mkdir src &&
(cd src &&