summaryrefslogtreecommitdiff
path: root/refspec.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-14 18:21:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-14 18:21:36 (GMT)
commitc59b73bef302f4efd0f853f913328aab534b1f1a (patch)
tree211c4bf2f2d168bdd46d03a6e821e5b5555cc732 /refspec.c
parent78abcff222d2d9cb05776bac39f7dc6a84b8f809 (diff)
parent374fbaef3df8f05acf9968fc38c6da72a62bcfc2 (diff)
downloadgit-c59b73bef302f4efd0f853f913328aab534b1f1a.zip
git-c59b73bef302f4efd0f853f913328aab534b1f1a.tar.gz
git-c59b73bef302f4efd0f853f913328aab534b1f1a.tar.bz2
Merge branch 'fc/atmark-in-refspec'
"@" sometimes worked (e.g. "git push origin @:there") as a part of a refspec element, but "git push origin @" did not work, which has been corrected. * fc/atmark-in-refspec: refspec: make @ a synonym of HEAD tests: push: trivial cleanup tests: push: improve cleanup of HEAD tests
Diffstat (limited to 'refspec.c')
-rw-r--r--refspec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/refspec.c b/refspec.c
index d4823db..e3d852c 100644
--- a/refspec.c
+++ b/refspec.c
@@ -71,7 +71,10 @@ static int parse_refspec(struct refspec_item *item, const char *refspec, int fet
}
item->pattern = is_glob;
- item->src = xstrndup(lhs, llen);
+ if (llen == 1 && *lhs == '@')
+ item->src = xstrdup("HEAD");
+ else
+ item->src = xstrndup(lhs, llen);
flags = REFNAME_ALLOW_ONELEVEL | (is_glob ? REFNAME_REFSPEC_PATTERN : 0);
if (item->negative) {