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>
This commit is contained in:

committed by
Junio C Hamano

parent
b42b451919
commit
018ec3c820
2
diff.h
2
diff.h
@ -357,7 +357,7 @@ extern int diff_result_code(struct diff_options *, int);
|
||||
|
||||
extern void diff_no_index(struct rev_info *, int, const char **);
|
||||
|
||||
extern int index_differs_from(const char *def, int diff_flags);
|
||||
extern int index_differs_from(const char *def, int diff_flags, int ita_invisible_in_index);
|
||||
|
||||
/*
|
||||
* Fill the contents of the filespec "df", respecting any textconv defined by
|
||||
|
Reference in New Issue
Block a user