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
This commit is contained in:
Junio C Hamano
2020-12-14 10:21:36 -08:00
3 changed files with 62 additions and 51 deletions

View File

@ -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) {