Code

Merge branch 'jc/maint-1.7.3-checkout-describe' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2011 21:43:18 +0000 (14:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2011 21:43:18 +0000 (14:43 -0700)
* jc/maint-1.7.3-checkout-describe:
  checkout -b <name>: correctly detect existing branch

1  2 
builtin/checkout.c
refs.c
refs.h
t/t2018-checkout-branch.sh

index 28cdc51b85e7d433dca085c0080f964d19a391b4,88708d48bf5483a537839a2b1439af2880b1fd35..af1e7b579a83aef15e11c0c5dfa29447e485654c
@@@ -1069,12 -872,12 +1069,12 @@@ int cmd_checkout(int argc, const char *
        if (opts.new_branch) {
                struct strbuf buf = STRBUF_INIT;
                if (strbuf_check_branch_ref(&buf, opts.new_branch))
 -                      die("git checkout: we do not like '%s' as a branch name.",
 +                      die(_("git checkout: we do not like '%s' as a branch name."),
                            opts.new_branch);
-               if (!get_sha1(buf.buf, rev)) {
+               if (ref_exists(buf.buf)) {
                        opts.branch_exists = 1;
                        if (!opts.new_branch_force)
 -                              die("git checkout: branch %s already exists",
 +                              die(_("git checkout: branch %s already exists"),
                                    opts.new_branch);
                }
                strbuf_release(&buf);
diff --cc refs.c
Simple merge
diff --cc refs.h
Simple merge
Simple merge