diff --git a/Documentation/revisions.adoc b/Documentation/revisions.adoc index 3bb6dc85b6..0ef2c895ef 100644 --- a/Documentation/revisions.adoc +++ b/Documentation/revisions.adoc @@ -123,7 +123,7 @@ some output processing may assume ref names in UTF-8. `branch..remote`). B@{u} refers to the remote-tracking branch for the branch X taken from remote R, typically found at `refs/remotes/R/X`. -'[]@\{push\}', e.g. 'master@\{push\}', '@\{push\}':: +'[]@\{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 diff --git a/object-name.c b/object-name.c index 4eda8c8eac..6546685760 100644 --- a/object-name.c +++ b/object-name.c @@ -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)); } diff --git a/t/t1514-rev-parse-push.sh b/t/t1514-rev-parse-push.sh index d868a08110..5a4f16867a 100755 --- a/t/t1514-rev-parse-push.sh +++ b/t/t1514-rev-parse-push.sh @@ -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/* &&