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:
10
cache-tree.c
10
cache-tree.c
@ -155,13 +155,17 @@ static int verify_cache(struct cache_entry **cache,
|
||||
funny = 0;
|
||||
for (i = 0; i < entries; i++) {
|
||||
struct cache_entry *ce = cache[i];
|
||||
if (ce_stage(ce)) {
|
||||
if (ce_stage(ce) || (ce->ce_flags & CE_INTENT_TO_ADD)) {
|
||||
if (10 < ++funny) {
|
||||
fprintf(stderr, "...\n");
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%s: unmerged (%s)\n",
|
||||
ce->name, sha1_to_hex(ce->sha1));
|
||||
if (ce_stage(ce))
|
||||
fprintf(stderr, "%s: unmerged (%s)\n",
|
||||
ce->name, sha1_to_hex(ce->sha1));
|
||||
else
|
||||
fprintf(stderr, "%s: not added yet\n",
|
||||
ce->name);
|
||||
}
|
||||
}
|
||||
if (funny)
|
||||
|
Reference in New Issue
Block a user