aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-02 15:30:37 -0700
committerJunio C Hamano <gitster@pobox.com>2018-08-02 15:30:38 -0700
commit218608cacd478bfdf4bfe40ed7d0b11af94a6a60 (patch)
treec30026405afe95aa26fd0003387e00afe05f17d5 /diff-lib.c
parentffc6fa0e396238de3a30623912980263b4f283ab (diff)
parent3506dc944558b7d88544408b312e795458383195 (diff)
downloadgit-218608cacd478bfdf4bfe40ed7d0b11af94a6a60.tar.gz
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 'diff-lib.c')
-rw-r--r--diff-lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/diff-lib.c b/diff-lib.c
index a9f38eb5a3..732f684a49 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -520,6 +520,9 @@ int run_diff_index(struct rev_info *revs, int cached)
struct object_array_entry *ent;
uint64_t start = getnanotime();
+ if (revs->pending.nr != 1)
+ BUG("run_diff_index must be passed exactly one tree");
+
ent = revs->pending.objects;
if (diff_cache(revs, &ent->item->oid, ent->name, cached))
exit(128);