Code

Merge branch 'jc/maint-1.7.3-checkout-describe'
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jun 2011 00:03:12 +0000 (17:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jun 2011 00:03:12 +0000 (17:03 -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 015730fbd5c66eb60c3999ffbfaf33f07b841315,88708d48bf5483a537839a2b1439af2880b1fd35..f152adf9ab71287e02e9e85c0b84aae096e5bec7
@@@ -1070,12 -872,12 +1070,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