summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-10-24 10:42:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-24 17:48:23 (GMT)
commit018ec3c8203ad1aee683840a580cfba7914419b6 (patch)
treef25dff29fb2c25a2c7ee70f410a94c4eef941393 /t
parentb42b45191950a4ac39f6f5ae042c15ad114da79b (diff)
downloadgit-018ec3c8203ad1aee683840a580cfba7914419b6.zip
git-018ec3c8203ad1aee683840a580cfba7914419b6.tar.gz
git-018ec3c8203ad1aee683840a580cfba7914419b6.tar.bz2
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 't')
-rwxr-xr-xt/t2203-add-intent.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 0e54f63..8652a96 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -129,5 +129,16 @@ test_expect_success 'cache-tree does skip dir that becomes empty' '
)
'
+test_expect_success 'commit: ita entries ignored in empty commit check' '
+ git init empty-subsequent-commit &&
+ (
+ cd empty-subsequent-commit &&
+ test_commit one &&
+ : >two &&
+ git add -N two &&
+ test_must_fail git commit -m nothing-new-here
+ )
+'
+
test_done