Merge branch 'jc/maint-commit-ignore-i-t-a' into maint
* jc/maint-commit-ignore-i-t-a: commit: ignore intent-to-add entries instead of refusing Conflicts: cache-tree.c
This commit is contained in:
commit
6c63ab3ca7
@ -158,7 +158,7 @@ static int verify_cache(struct cache_entry **cache,
|
|||||||
funny = 0;
|
funny = 0;
|
||||||
for (i = 0; i < entries; i++) {
|
for (i = 0; i < entries; i++) {
|
||||||
struct cache_entry *ce = cache[i];
|
struct cache_entry *ce = cache[i];
|
||||||
if (ce_stage(ce) || (ce->ce_flags & CE_INTENT_TO_ADD)) {
|
if (ce_stage(ce)) {
|
||||||
if (silent)
|
if (silent)
|
||||||
return -1;
|
return -1;
|
||||||
if (10 < ++funny) {
|
if (10 < ++funny) {
|
||||||
@ -338,8 +338,8 @@ static int update_one(struct cache_tree *it,
|
|||||||
mode, sha1_to_hex(sha1), entlen+baselen, path);
|
mode, sha1_to_hex(sha1), entlen+baselen, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ce->ce_flags & CE_REMOVE)
|
if (ce->ce_flags & (CE_REMOVE | CE_INTENT_TO_ADD))
|
||||||
continue; /* entry being removed */
|
continue; /* entry being removed or placeholder */
|
||||||
|
|
||||||
strbuf_grow(&buffer, entlen + 100);
|
strbuf_grow(&buffer, entlen + 100);
|
||||||
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
|
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
|
||||||
|
@ -32,7 +32,7 @@ test_expect_success 'intent to add does not clobber existing paths' '
|
|||||||
! grep "$empty" actual
|
! grep "$empty" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'cannot commit with i-t-a entry' '
|
test_expect_success 'i-t-a entry is simply ignored' '
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -a -m initial &&
|
git commit -a -m initial &&
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
@ -41,12 +41,14 @@ test_expect_success 'cannot commit with i-t-a entry' '
|
|||||||
echo frotz >nitfol &&
|
echo frotz >nitfol &&
|
||||||
git add rezrov &&
|
git add rezrov &&
|
||||||
git add -N nitfol &&
|
git add -N nitfol &&
|
||||||
test_must_fail git commit -m initial
|
git commit -m second &&
|
||||||
|
test $(git ls-tree HEAD -- nitfol | wc -l) = 0 &&
|
||||||
|
test $(git diff --name-only HEAD -- nitfol | wc -l) = 1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'can commit with an unrelated i-t-a entry in index' '
|
test_expect_success 'can commit with an unrelated i-t-a entry in index' '
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
echo xyzzy >rezrov &&
|
echo bozbar >rezrov &&
|
||||||
echo frotz >nitfol &&
|
echo frotz >nitfol &&
|
||||||
git add rezrov &&
|
git add rezrov &&
|
||||||
git add -N nitfol &&
|
git add -N nitfol &&
|
||||||
|
Loading…
Reference in New Issue
Block a user