summaryrefslogtreecommitdiffstats
path: root/bin/git-gpush
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-10-19 14:09:29 +0200
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2020-02-28 17:53:40 +0000
commit4e466af8d8b06d0c0cf6d1c28397dcd022850ffe (patch)
tree4df01c38d122272d9cc01a511357cfc116ae94f2 /bin/git-gpush
parent97259060dc9e387cc14f5922562ad229b8bba125 (diff)
gpush: add support for omitting HEAD from rev-specs
typing the ALL-UPPERCASE HEAD is a nuisance, so have shortened specs like '~3' imply HEAD. Change-Id: Ia4867e6ed1127c9379b96bbae4fed055fd98c60c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'bin/git-gpush')
-rwxr-xr-xbin/git-gpush4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/git-gpush b/bin/git-gpush
index c8c60bb..bf1ca81 100755
--- a/bin/git-gpush
+++ b/bin/git-gpush
@@ -48,7 +48,8 @@ Description:
branch's upstream remote.
'From' may be specified as either a ref, a SHA1, or a Gerrit Change-Id,
- possibly abbreviated. Git rev-spec suffixes like '~2' are allowed.
+ possibly abbreviated. Git rev-spec suffixes like '~2' are allowed; if
+ only a suffix is specified, it is understood to be relative to 'HEAD'.
If 'from' is not specified, 'HEAD' is used.
Note that this program can be used in the middle of an interactive
@@ -452,6 +453,7 @@ sub initialize_get_changes()
} else {
# We did not need to visit the current branch to find the tip,
# so determine the branch from the tip now.
+ $from = "HEAD".$from if ($from =~ /^[~^]/);
determine_local_branch($from);
# Get the pool of Changes to push from.
analyze_local_branch($from) or