diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-01-16 09:36:47 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-16 14:53:41 -0800 |
commit | de694d232f1a1b1fe2ca4c7549242d7ef96cf759 (patch) | |
tree | c1d87e533b08e495cfbf54e060ce0775d877ee6f /cache-tree.c | |
parent | c010eb63079843f73b4906e2a5a048f5c4e88610 (diff) | |
download | git-nd/commit-ignore-i-t-a.tar.gz |
commit, write-tree: allow to ignore CE_INTENT_TO_ADD while writing treesnd/commit-ignore-i-t-a
Normally cache-tree will not produce trees from an index that has
CE_INTENT_TO_ADD entries. This is a safe measure to avoid
mis-interpreting user's intention regarding this flag.
There are situations however where users want to create trees/commits
regardless i-t-a entries. Allow such cases with commit.ignoreIntentToAdd
for git-commit and --ignore-intent-to-add for git-write-tree.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.c')
-rw-r--r-- | cache-tree.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cache-tree.c b/cache-tree.c index 16355d6254..d0be1591fd 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -159,7 +159,9 @@ 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) || (ce->ce_flags & CE_INTENT_TO_ADD)) { + if (ce_stage(ce) || + ((flags & WRITE_TREE_IGNORE_INTENT_TO_ADD) == 0 && + (ce->ce_flags & CE_INTENT_TO_ADD))) { if (silent) return -1; if (10 < ++funny) { @@ -339,8 +341,8 @@ static int update_one(struct cache_tree *it, mode, sha1_to_hex(sha1), entlen+baselen, path); } - if (ce->ce_flags & CE_REMOVE) - continue; /* entry being removed */ + if (ce->ce_flags & (CE_REMOVE | CE_INTENT_TO_ADD)) + continue; /* entry being removed or placeholder */ strbuf_grow(&buffer, entlen + 100); strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0'); |