summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/git-gpush4
-rw-r--r--bin/git_gpush.pm1
2 files changed, 4 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
diff --git a/bin/git_gpush.pm b/bin/git_gpush.pm
index 26252b9..29bd2bd 100644
--- a/bin/git_gpush.pm
+++ b/bin/git_gpush.pm
@@ -1119,6 +1119,7 @@ sub parse_local_rev($$)
{
my ($rev, $scope) = @_;
+ $rev = "HEAD".$rev if ($rev =~ /^[~^]/);
my ($sout, $done) = _parse_local_rev_sym($rev, $scope);
return $sout if ($done);
my $out = read_cmd_line(SOFT_FAIL, 'git', 'rev-parse', '--verify', '-q', $rev);