Add @{p} as a shorthand for @{push} for consistency with the @{u} shorthand for @{upstream}. This wasn't added when @{push} was introduced in commit adfe5d0434 ("sha1_name: implement @{push} shorthand", 2015-05-21), but it can be added without any ambiguity and saves the user some typing. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- Documentation/revisions.txt | 8 ++++---- sha1_name.c | 2 +- t/t1514-rev-parse-push.sh | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt index 09e0d51b9e..5fe90e411d 100644 --- a/Documentation/revisions.txt +++ b/Documentation/revisions.txt @@ -99,8 +99,8 @@ some output processing may assume ref names in UTF-8. current one. These suffixes are accepted when spelled in uppercase, and they mean the same thing no matter the case. -'<branchname>@\{push\}', e.g. 'master@\{push\}', '@\{push\}':: - The suffix '@\{push}' reports the branch "where we would push to" if +'<branchname>@\{push\}', e.g. 'master@\{push\}', '@\{p\}':: + The suffix '@\{push}' (short form '@\{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). Since our push destination is in a remote repository, of course, we report the local tracking branch @@ -124,8 +124,8 @@ Note in the example that we set up a triangular workflow, where we pull from one location and push to another. In a non-triangular workflow, '@\{push}' is the same as '@\{upstream}', and there is no need for it. + -This suffix is accepted when spelled in uppercase, and means the same -thing no matter the case. +These suffixes are accepted when spelled in uppercase, and they mean +the same thing no matter the case. '<rev>{caret}', e.g. 'HEAD{caret}, v1.5.1{caret}0':: A suffix '{caret}' to a revision parameter means the first parent of diff --git a/sha1_name.c b/sha1_name.c index d9d1b2fce8..2deb9bfdf6 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -563,7 +563,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 788cc91e45..db9aaf88f8 100755 --- a/t/t1514-rev-parse-push.sh +++ b/t/t1514-rev-parse-push.sh @@ -31,6 +31,8 @@ test_expect_success '@{push} with default=nothing' ' test_expect_success '@{push} with default=simple' ' test_config push.default simple && + resolve master@{p} refs/remotes/origin/master && + resolve master@{P} refs/remotes/origin/master && resolve master@{push} refs/remotes/origin/master && resolve master@{PUSH} refs/remotes/origin/master && resolve master@{pUSh} refs/remotes/origin/master -- 2.11.0