Merge branch 'hn/object-name-push-short' into jch

The @{upstream} notation had short-hand @{u} from the beginning,
and @{push} learned corresponding @{p} to match.

* hn/object-name-push-short:
  object-name: accept @{p} as short for @{push}
jch
Junio C Hamano 2026-10-12 09:25:55 -07:00
commit 7efcccbfc5
3 changed files with 9 additions and 2 deletions

View File

@ -123,7 +123,7 @@ some output processing may assume ref names in UTF-8.
`branch.<name>.remote`). B@{u} refers to the remote-tracking branch for
the branch X taken from remote R, typically found at `refs/remotes/R/X`.

'[<branchname>]@\{push\}', e.g. 'master@\{push\}', '@\{push\}'::
'[<branchname>]@\{push\}', e.g. 'master@\{push\}', '@\{p\}'::
The suffix '@\{push}' reports the branch "where we would push to" if
`git push` were run while `branchname` was checked out (or the current
`HEAD` if no branchname is specified). Like for '@\{upstream\}', we report

View File

@ -657,7 +657,7 @@ static inline int upstream_mark(const char *string, int len)

static inline int push_mark(const char *string, int len)
{
const char *suffix[] = { "@{push}" };
const char *suffix[] = { "@{push}", "@{p}" };
return at_mark(string, len, suffix, ARRAY_SIZE(suffix));
}


View File

@ -60,6 +60,13 @@ test_expect_success '@{push} with pushremote defined' '
resolve topic@{push} refs/remotes/other/topic
'

test_expect_success '@{p} is short for @{push}' '
test_config push.default current &&
test_config branch.topic.pushremote other &&
resolve topic@{p} refs/remotes/other/topic &&
resolve topic@{P} refs/remotes/other/topic
'

test_expect_success '@{push} with push refspecs' '
test_config push.default nothing &&
test_config remote.origin.push refs/heads/*:refs/heads/magic/* &&