Skip to content
Snippets Groups Projects
Commit 2e931843 authored by Junio C Hamano's avatar Junio C Hamano
Browse files

Merge branch 'jc/fix-clone-single-starting-at-a-tag' into maint

"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
parents 588de86f 60a5f5fc
Branches
Tags
No related merge requests found
...@@ -695,7 +695,7 @@ static void write_refspec_config(const char* src_ref_prefix, ...@@ -695,7 +695,7 @@ static void write_refspec_config(const char* src_ref_prefix,
if (option_mirror || !option_bare) { if (option_mirror || !option_bare) {
if (option_single_branch && !option_mirror) { if (option_single_branch && !option_mirror) {
if (option_branch) { 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, strbuf_addf(&value, "+%s:%s", our_head_points_at->name,
our_head_points_at->name); our_head_points_at->name);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment