summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-08-20 20:46:57 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-08-23 17:11:28 -0700
commit44a3691362dc71241a5d68d90b07642c46992e4a (patch)
treebaafb787871699fd6e0704004ecd04ab2c3dbe04 /builtin-update-index.c
parentAdd test-index-version (diff)
downloadtgif-44a3691362dc71241a5d68d90b07642c46992e4a.tar.xz
Introduce "skip-worktree" bit in index, teach Git to get/set this bit
Detail about this bit is in Documentation/git-update-index.txt. 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 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index f1b6c8e88e..5e97d09497 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -24,6 +24,7 @@ static int info_only;
static int force_remove;
static int verbose;
static int mark_valid_only;
+static int mark_skip_worktree_only;
#define MARK_FLAG 1
#define UNMARK_FLAG 2
@@ -276,6 +277,11 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
die("Unable to mark file %s", path);
goto free_return;
}
+ if (mark_skip_worktree_only) {
+ if (mark_ce_flags(p, CE_SKIP_WORKTREE, mark_skip_worktree_only == MARK_FLAG))
+ die("Unable to mark file %s", path);
+ goto free_return;
+ }
if (force_remove) {
if (remove_file_from_cache(p))
@@ -384,7 +390,7 @@ static void read_index_info(int line_termination)
}
static const char update_index_usage[] =
-"git update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--really-refresh] [--cacheinfo] [--chmod=(+|-)x] [--assume-unchanged] [--info-only] [--force-remove] [--stdin] [--index-info] [--unresolve] [--again | -g] [--ignore-missing] [-z] [--verbose] [--] <file>...";
+"git update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--really-refresh] [--cacheinfo] [--chmod=(+|-)x] [--assume-unchanged] [--skip-worktree|--no-skip-worktree] [--info-only] [--force-remove] [--stdin] [--index-info] [--unresolve] [--again | -g] [--ignore-missing] [-z] [--verbose] [--] <file>...";
static unsigned char head_sha1[20];
static unsigned char merge_head_sha1[20];
@@ -650,6 +656,14 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
mark_valid_only = UNMARK_FLAG;
continue;
}
+ if (!strcmp(path, "--no-skip-worktree")) {
+ mark_skip_worktree_only = UNMARK_FLAG;
+ continue;
+ }
+ if (!strcmp(path, "--skip-worktree")) {
+ mark_skip_worktree_only = MARK_FLAG;
+ continue;
+ }
if (!strcmp(path, "--info-only")) {
info_only = 1;
continue;