summaryrefslogtreecommitdiff
path: root/builtin-write-tree.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-05-20 11:04:35 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-05-20 11:07:07 -0700
commitd11b8d342529a8fe2164ceb563ad9213902d3533 (patch)
tree890ca0413eb098ef8cc8222fa0de72ccd66bee4c /builtin-write-tree.c
parentExtend sample pre-commit hook to check for non ascii filenames (diff)
downloadtgif-d11b8d342529a8fe2164ceb563ad9213902d3533.tar.xz
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 9d640508dd..3a24ce8157 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));