Merge branch 'jc/fix-clone-single-starting-at-a-tag'
authorJunio C Hamano <gitster@pobox.com>
Thu, 10 Jul 2014 18:17:24 +0000 (11:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jul 2014 18:17:24 +0000 (11:17 -0700)
"git clone -b brefs/tags/bar" would have mistakenly thought we were
following a single tag, even though it was a name of the branch,
because it incorrectly used strstr().

* jc/fix-clone-single-starting-at-a-tag:
builtin/clone.c: detect a clone starting at a tag correctly

builtin/clone.c
index a5b2d9db360eb59d5a73c2e221fed047a94b0615..e15ca332b5637421fb187ce4db478c60dded958c 100644 (file)
@@ -696,7 +696,7 @@ static void write_refspec_config(const char* src_ref_prefix,
        if (option_mirror || !option_bare) {
                if (option_single_branch && !option_mirror) {
                        if (option_branch) {
-                               if (strstr(our_head_points_at->name, "refs/tags/"))
+                               if (starts_with(our_head_points_at->name, "refs/tags/"))
                                        strbuf_addf(&value, "+%s:%s", our_head_points_at->name,
                                                our_head_points_at->name);
                                else