X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-read-tree.c;h=316fb0f8dae022b35a89b71c94a22331a77a500a;hb=cfabd6eee1745cfec58cfcb794ce8847e43b888a;hp=793eae0a5f4cc3d21788a3642f156410ce1ad89d;hpb=045f5759c97746589a067461e50fad16f60711ac;p=git.git diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 793eae0a5..316fb0f8d 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -84,7 +84,7 @@ static void prime_cache_tree(void) } -static const char read_tree_usage[] = "git-read-tree ( | [[-m [--aggressive] | --reset | --prefix=] [-u | -i]] [--exclude-per-directory=] [ []])"; +static const char read_tree_usage[] = "git-read-tree ( | [[-m [--aggressive] | --reset | --prefix=] [-u | -i]] [--exclude-per-directory=] [--index-output=] [ []])"; static struct lock_file lock_file; @@ -100,7 +100,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) setup_git_directory(); git_config(git_default_config); - newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1); + newfd = hold_locked_index(&lock_file, 1); git_config(git_default_config); @@ -128,6 +128,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) continue; } + if (!prefixcmp(arg, "--index-output=")) { + set_alternate_index_output(arg + 15); + continue; + } + /* "--prefix=/" means keep the current index * entries and put the entries from the tree under the * given subdirectory. @@ -228,6 +233,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) if (0 <= pos) die("file '%.*s' already exists.", pfxlen-1, opts.prefix); + opts.pos = -1 - pos; } if (opts.merge) { @@ -267,7 +273,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) } if (write_cache(newfd, active_cache, active_nr) || - close(newfd) || commit_lock_file(&lock_file)) + close(newfd) || commit_locked_index(&lock_file)) die("unable to write new index file"); return 0; }