Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
update-index: refactor mark_valid() in preparation for new options
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Thu, 20 Aug 2009 13:46:55 +0000
(20:46 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 24 Aug 2009 00:11:28 +0000
(17:11 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-update-index.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
540e694
)
diff --git
a/builtin-update-index.c
b/builtin-update-index.c
index 92beaaf4b3ca5520a9af27bde7f15dda46d80197..f1b6c8e88e1621d60dcc3c8662d39b907f203ca3 100644
(file)
--- a/
builtin-update-index.c
+++ b/
builtin-update-index.c
@@
-24,8
+24,8
@@
static int info_only;
static int force_remove;
static int verbose;
static int mark_valid_only;
static int force_remove;
static int verbose;
static int mark_valid_only;
-#define MARK_
VALID
1
-#define UNMARK_
VALID
2
+#define MARK_
FLAG
1
+#define UNMARK_
FLAG
2
static void report(const char *fmt, ...)
{
static void report(const char *fmt, ...)
{
@@
-40,19
+40,15
@@
static void report(const char *fmt, ...)
va_end(vp);
}
va_end(vp);
}
-static int mark_
valid(const char *path
)
+static int mark_
ce_flags(const char *path, int flag, int mark
)
{
int namelen = strlen(path);
int pos = cache_name_pos(path, namelen);
if (0 <= pos) {
{
int namelen = strlen(path);
int pos = cache_name_pos(path, namelen);
if (0 <= pos) {
- switch (mark_valid_only) {
- case MARK_VALID:
- active_cache[pos]->ce_flags |= CE_VALID;
- break;
- case UNMARK_VALID:
- active_cache[pos]->ce_flags &= ~CE_VALID;
- break;
- }
+ if (mark)
+ active_cache[pos]->ce_flags |= flag;
+ else
+ active_cache[pos]->ce_flags &= ~flag;
cache_tree_invalidate_path(active_cache_tree, path);
active_cache_changed = 1;
return 0;
cache_tree_invalidate_path(active_cache_tree, path);
active_cache_changed = 1;
return 0;
@@
-276,7
+272,7
@@
static void update_one(const char *path, const char *prefix, int prefix_length)
goto free_return;
}
if (mark_valid_only) {
goto free_return;
}
if (mark_valid_only) {
- if (mark_
valid(p
))
+ if (mark_
ce_flags(p, CE_VALID, mark_valid_only == MARK_FLAG
))
die("Unable to mark file %s", path);
goto free_return;
}
die("Unable to mark file %s", path);
goto free_return;
}
@@
-647,11
+643,11
@@
int cmd_update_index(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(path, "--assume-unchanged")) {
continue;
}
if (!strcmp(path, "--assume-unchanged")) {
- mark_valid_only = MARK_
VALID
;
+ mark_valid_only = MARK_
FLAG
;
continue;
}
if (!strcmp(path, "--no-assume-unchanged")) {
continue;
}
if (!strcmp(path, "--no-assume-unchanged")) {
- mark_valid_only = UNMARK_
VALID
;
+ mark_valid_only = UNMARK_
FLAG
;
continue;
}
if (!strcmp(path, "--info-only")) {
continue;
}
if (!strcmp(path, "--info-only")) {