summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-10-24 17:42:21 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-10-24 10:48:23 -0700
commit018ec3c8203ad1aee683840a580cfba7914419b6 (patch)
treef25dff29fb2c25a2c7ee70f410a94c4eef941393 /sequencer.c
parentdiff: add --ita-[in]visible-in-index (diff)
downloadtgif-018ec3c8203ad1aee683840a580cfba7914419b6.tar.xz
commit: fix empty commit creation when there's no changes but ita entries
If i-t-a entries are present and there is no change between the index and HEAD i-t-a entries, index_differs_from() still returns "dirty, new entries" (aka, the resulting commit is not empty), but cache-tree will skip i-t-a entries and produce the exact same tree of current commit. index_differs_from() is supposed to catch this so we can abort git-commit (unless --no-empty is specified). Update it to optionally ignore i-t-a entries when doing a diff between the index and HEAD so that it would return "no change" in this case and abort commit. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index eec8a60d6b..b0826353e3 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -469,7 +469,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
unborn = get_sha1("HEAD", head);
if (unborn)
hashcpy(head, EMPTY_TREE_SHA1_BIN);
- if (index_differs_from(unborn ? EMPTY_TREE_SHA1_HEX : "HEAD", 0))
+ if (index_differs_from(unborn ? EMPTY_TREE_SHA1_HEX : "HEAD", 0, 0))
return error_dirty_index(opts);
}
discard_cache();
@@ -1064,7 +1064,7 @@ static int sequencer_continue(struct replay_opts *opts)
if (ret)
return ret;
}
- if (index_differs_from("HEAD", 0))
+ if (index_differs_from("HEAD", 0, 0))
return error_dirty_index(opts);
todo_list = todo_list->next;
return pick_commits(todo_list, opts);