git add --intent-to-add: do not let an empty blob be committed by accident

Writing a tree out of an index with an "intent to add" entry is blocked.
This implies that you cannot "git commit" from such a state; however you
can still do "git commit -a" or "git commit $that_path".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2008-11-28 19:56:34 -08:00
parent 388b2acd6e
commit 331fcb598e
5 changed files with 45 additions and 5 deletions

View File

@ -639,7 +639,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
active_cache_tree = cache_tree();
if (cache_tree_update(active_cache_tree,
active_cache, active_nr, 0, 0) < 0) {
error("Error building trees; the index is unmerged?");
error("Error building trees");
return 0;
}