summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-02-04 02:20:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-06 00:44:51 (GMT)
commitb4b313f94ab06fabe78fa91b3f2ebbc7ef08b012 (patch)
tree7d11a0d21b8aae16296b29abaf0d1c150d31398f /read-cache.c
parentbe961c292f1d36097afa1690df68cf90f655c855 (diff)
downloadgit-b4b313f94ab06fabe78fa91b3f2ebbc7ef08b012.zip
git-b4b313f94ab06fabe78fa91b3f2ebbc7ef08b012.tar.gz
git-b4b313f94ab06fabe78fa91b3f2ebbc7ef08b012.tar.bz2
reset: support "--mixed --intent-to-add" mode
When --mixed is used, entries could be removed from index if the target ref does not have them. When "reset" is used in preparation for commit spliting (in a dirty worktree), it could be hard to track what files to be added back. The new option --intent-to-add simplifies it by marking all removed files intent-to-add. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 33dd676..f0b1ead 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -579,7 +579,7 @@ static struct cache_entry *create_alias_ce(struct cache_entry *ce, struct cache_
return new;
}
-static void record_intent_to_add(struct cache_entry *ce)
+void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
{
unsigned char sha1[20];
if (write_sha1_file("", 0, blob_type, sha1))
@@ -665,7 +665,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
if (index_path(ce->sha1, path, st, HASH_WRITE_OBJECT))
return error("unable to index file %s", path);
} else
- record_intent_to_add(ce);
+ set_object_name_for_intent_to_add_entry(ce);
if (ignore_case && alias && different_name(ce, alias))
ce = create_alias_ce(ce, alias);