From: Junio C Hamano Date: Wed, 8 Apr 2009 05:33:02 +0000 (-0700) Subject: Merge branch 'js/maint-submodule-checkout' X-Git-Tag: v1.6.3-rc0~24 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a9906723b23b058cffadaf5db9d87b67384c60c3?ds=inline;hp=-c Merge branch 'js/maint-submodule-checkout' * js/maint-submodule-checkout: Fix 'git checkout ' to update the index --- a9906723b23b058cffadaf5db9d87b67384c60c3 diff --combined builtin-checkout.c index 33d1fecb62,c0abe1ca77..2e4fe1a453 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@@ -53,9 -53,6 +53,6 @@@ static int update_some(const unsigned c int len; struct cache_entry *ce; - if (S_ISGITLINK(mode)) - return 0; - if (S_ISDIR(mode)) return READ_TREE_RECURSIVE; @@@ -295,8 -292,6 +292,8 @@@ static void show_local_changes(struct o init_revisions(&rev, NULL); rev.abbrev = 0; rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS; + if (diff_setup_done(&rev.diffopt) < 0) + die("diff_setup_done failed"); add_pending_object(&rev, head, NULL); run_diff_index(&rev, 0); } @@@ -353,11 -348,16 +350,11 @@@ struct branch_info static void setup_branch_path(struct branch_info *branch) { struct strbuf buf = STRBUF_INIT; - int ret; - if ((ret = interpret_nth_last_branch(branch->name, &buf)) - && ret == strlen(branch->name)) { + strbuf_branchname(&buf, branch->name); + if (strcmp(buf.buf, branch->name)) branch->name = xstrdup(buf.buf); - strbuf_splice(&buf, 0, 0, "refs/heads/", 11); - } else { - strbuf_addstr(&buf, "refs/heads/"); - strbuf_addstr(&buf, branch->name); - } + strbuf_splice(&buf, 0, 0, "refs/heads/", 11); branch->path = strbuf_detach(&buf, NULL); } @@@ -402,7 -402,7 +399,7 @@@ static int merge_working_tree(struct ch topts.verbose_update = !opts->quiet; topts.fn = twoway_merge; topts.dir = xcalloc(1, sizeof(*topts.dir)); - topts.dir->show_ignored = 1; + topts.dir->flags |= DIR_SHOW_IGNORED; topts.dir->exclude_per_dir = ".gitignore"; tree = parse_tree_indirect(old->commit->object.sha1); init_tree_desc(&trees[0], tree->buffer, tree->size); @@@ -553,8 -553,8 +550,8 @@@ static int switch_branches(struct check if (!old.commit && !opts->force) { if (!opts->quiet) { - fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n"); - fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name); + warning("You appear to be on a branch yet to be born."); + warning("Forcing checkout of %s.", new->name); } opts->force = 1; } @@@ -733,11 -733,12 +730,11 @@@ no_reference if (opts.new_branch) { struct strbuf buf = STRBUF_INIT; - strbuf_addstr(&buf, "refs/heads/"); - strbuf_addstr(&buf, opts.new_branch); + if (strbuf_check_branch_ref(&buf, opts.new_branch)) + die("git checkout: we do not like '%s' as a branch name.", + opts.new_branch); if (!get_sha1(buf.buf, rev)) die("git checkout: branch %s already exists", opts.new_branch); - if (check_ref_format(buf.buf)) - die("git checkout: we do not like '%s' as a branch name.", opts.new_branch); strbuf_release(&buf); }