On Wed, 20 Feb 2008, Junio C Hamano wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: > > > Daniel Barkalow <barkalow@xxxxxxxxxxxx> writes: > > > >> Junio: it looks like something used to cause read-tree to be run with > >> pwd being the working tree root in git-checkout.sh. > > > > "Something"? I think we explicitly cdup when switching > > branches, and we should do the same in C rewrite. > > > > # We are switching branches and checking out trees, so > > # we *NEED* to be at the toplevel. > > cd_to_toplevel > > Isn't it just the matter of not passing prefix to topts in > merge_working_tree()? Your other calls to unpack_trees() do not > seem to pass bogus prefix to it. You're absolutely right; I think I initially misunderstood the way the wrapper sets things up beforehand, and did the later parts of the conversion correctly. But we should also drop the bunch of now-unused arguments, too: -------------- commit 267d68e24111bc9054d1f3356842f58106c76f49 Author: Daniel Barkalow <barkalow@xxxxxxxxxxxx> Date: Thu Feb 21 10:48:46 2008 -0500 Remove unused prefix arguments in switch_branches path This path doesn't actually care where in the tree you started out, since it must change the whole thing anyway. With the gratuitous bug removed, the argument is unused. Signed-off-by: Daniel Barkalow <barkalow@xxxxxxxxxxxx> --- builtin-checkout.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/builtin-checkout.c b/builtin-checkout.c index cddd3a9..46cb362 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -205,8 +205,7 @@ static void setup_branch_path(struct branch_info *branch) } static int merge_working_tree(struct checkout_opts *opts, - struct branch_info *old, struct branch_info *new, - const char *prefix) + struct branch_info *old, struct branch_info *new) { int ret; struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); @@ -429,8 +428,7 @@ static void update_refs_for_switch(struct checkout_opts *opts, adjust_to_tracking(new, opts); } -static int switch_branches(struct checkout_opts *opts, - struct branch_info *new, const char *prefix) +static int switch_branches(struct checkout_opts *opts, struct branch_info *new) { int ret = 0; struct branch_info old; @@ -471,7 +469,7 @@ static int switch_branches(struct checkout_opts *opts, opts->force = 1; } - ret = merge_working_tree(opts, &old, new, prefix); + ret = merge_working_tree(opts, &old, new); if (ret) return ret; @@ -565,5 +563,5 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) die("Cannot switch branch to a non-commit."); } - return switch_branches(&opts, &new, prefix); + return switch_branches(&opts, &new); } - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html