diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-12-14 21:21:36 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-14 21:21:36 +0300 |
commit | c59b73bef302f4efd0f853f913328aab534b1f1a (patch) | |
tree | 211c4bf2f2d168bdd46d03a6e821e5b5555cc732 /refspec.c | |
parent | 78abcff222d2d9cb05776bac39f7dc6a84b8f809 (diff) | |
parent | 374fbaef3df8f05acf9968fc38c6da72a62bcfc2 (diff) |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) { |