From: Junio C Hamano Date: Tue, 6 Jun 2006 21:31:29 +0000 (-0700) Subject: Merge branch 'jc/lockfile' into next X-Git-Tag: v1.4.1-rc1~33 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=68a40e5096add9a4d8f2dc0fecce19e9438eaba1;p=git.git Merge branch 'jc/lockfile' into next * jc/lockfile: ref-log: style fixes. refs.c: convert it to use lockfile interface. Make index file locking code reusable to others. HTTP cleanup HTTP cleanup git-format-patch: add --output-directory long option again --- 68a40e5096add9a4d8f2dc0fecce19e9438eaba1 diff --cc builtin-read-tree.c index 57bc4516a,bb50fbd27..04506da89 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@@ -875,9 -851,9 +875,9 @@@ static void prime_cache_tree(void } -static const char read_tree_usage[] = "git-read-tree ( | -m [--aggressive] [-u | -i] [ []])"; +static const char read_tree_usage[] = "git-read-tree ( | [[-m [--aggressive] | --reset | --prefix=] [-u | -i]] [ []])"; - static struct cache_file cache_file; + static struct lock_file lock_file; int cmd_read_tree(int argc, const char **argv, char **envp) { diff --cc write-tree.c index 895e7a359,d6a605893..bd07da618 --- a/write-tree.c +++ b/write-tree.c @@@ -8,12 -8,10 +8,12 @@@ #include "cache-tree.h" static int missing_ok = 0; +static char *prefix = NULL; -static const char write_tree_usage[] = "git-write-tree [--missing-ok]"; +static const char write_tree_usage[] = +"git-write-tree [--missing-ok] [--prefix=/]"; - static struct cache_file cache_file; + static struct lock_file lock_file; int main(int argc, char **argv) { @@@ -21,20 -19,15 +21,20 @@@ setup_git_directory(); - newfd = hold_index_file_for_update(&cache_file, get_index_file()); + newfd = hold_lock_file_for_update(&lock_file, get_index_file()); entries = read_cache(); - if (argc == 2) { - if (!strcmp(argv[1], "--missing-ok")) + + while (1 < argc) { + char *arg = argv[1]; + if (!strcmp(arg, "--missing-ok")) missing_ok = 1; + else if (!strncmp(arg, "--prefix=", 9)) + prefix = arg + 9; else die(write_tree_usage); + argc--; argv++; } - + if (argc > 2) die("too many options");