summaryrefslogtreecommitdiff
path: root/builtin-write-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-20 18:04:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-05-20 18:07:07 (GMT)
commitd11b8d342529a8fe2164ceb563ad9213902d3533 (patch)
tree890ca0413eb098ef8cc8222fa0de72ccd66bee4c /builtin-write-tree.c
parentd00e364de99d51bb76e437820e23cfa820417ec5 (diff)
downloadgit-d11b8d342529a8fe2164ceb563ad9213902d3533.zip
git-d11b8d342529a8fe2164ceb563ad9213902d3533.tar.gz
git-d11b8d342529a8fe2164ceb563ad9213902d3533.tar.bz2
write-tree --ignore-cache-tree
This allows you to discard the cache-tree information before writing the tree out of the index (i.e. it always recomputes the tree object names for all the subtrees). This is only useful as a debug option, so I did not bother documenting it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-write-tree.c')
-rw-r--r--builtin-write-tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/builtin-write-tree.c b/builtin-write-tree.c
index 9d64050..3a24ce8 100644
--- a/builtin-write-tree.c
+++ b/builtin-write-tree.c
@@ -13,7 +13,7 @@ static const char write_tree_usage[] =
int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
{
- int missing_ok = 0, ret;
+ int flags = 0, ret;
const char *prefix = NULL;
unsigned char sha1[20];
const char *me = "git-write-tree";
@@ -22,9 +22,15 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--missing-ok"))
- missing_ok = 1;
+ flags |= WRITE_TREE_MISSING_OK;
else if (!prefixcmp(arg, "--prefix="))
prefix = arg + 9;
+ else if (!prefixcmp(arg, "--ignore-cache-tree"))
+ /*
+ * This is only useful for debugging, so I
+ * do not bother documenting it.
+ */
+ flags |= WRITE_TREE_IGNORE_CACHE_TREE;
else
usage(write_tree_usage);
argc--; argv++;
@@ -33,7 +39,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
if (argc > 2)
die("too many options");
- ret = write_cache_as_tree(sha1, missing_ok, prefix);
+ ret = write_cache_as_tree(sha1, flags, prefix);
switch (ret) {
case 0:
printf("%s\n", sha1_to_hex(sha1));