Merge branch 'nd/ita-empty-commit'
When new paths were added by "git add -N" to the index, it was enough to circumvent the check by "git commit" to refrain from making an empty commit without "--allow-empty". The same logic prevented "git status" to show such a path as "new file" in the "Changes not staged for commit" section. * nd/ita-empty-commit: commit: don't be fooled by ita entries when creating initial commit commit: fix empty commit creation when there's no changes but ita entries diff: add --ita-[in]visible-in-index diff-lib: allow ita entries treated as "not yet exist in index"
This commit is contained in:
@ -894,9 +894,14 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
if (amend)
|
||||
parent = "HEAD^1";
|
||||
|
||||
if (get_sha1(parent, sha1))
|
||||
commitable = !!active_nr;
|
||||
else {
|
||||
if (get_sha1(parent, sha1)) {
|
||||
int i, ita_nr = 0;
|
||||
|
||||
for (i = 0; i < active_nr; i++)
|
||||
if (ce_intent_to_add(active_cache[i]))
|
||||
ita_nr++;
|
||||
commitable = active_nr - ita_nr > 0;
|
||||
} else {
|
||||
/*
|
||||
* Unless the user did explicitly request a submodule
|
||||
* ignore mode by passing a command line option we do
|
||||
@ -910,7 +915,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
if (ignore_submodule_arg &&
|
||||
!strcmp(ignore_submodule_arg, "all"))
|
||||
diff_flags |= DIFF_OPT_IGNORE_SUBMODULES;
|
||||
commitable = index_differs_from(parent, diff_flags);
|
||||
commitable = index_differs_from(parent, diff_flags, 1);
|
||||
}
|
||||
}
|
||||
strbuf_release(&committer_ident);
|
||||
|
Reference in New Issue
Block a user