diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2014-07-02 15:42:15 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-06-23 09:18:39 +0000 |
commit | ed837641ff0ea500bb49092ac044cab86bc5028d (patch) | |
tree | df5c918d102ccb0dabf5458dffa522d5939159e6 /bin | |
parent | 590f651476265a01ea6f3d14b1607838c08e7cc2 (diff) |
optimization: try to resolve only HEAD symbolically
it is very unlikely that anyone uses custom symbolic refs, in particular
as a source of a push.
Change-Id: I674506f9be0ab99bafcc6134b3852de3b7f74445
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/git-gpush | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/git-gpush b/bin/git-gpush index 8d8424f..b227837 100755 --- a/bin/git-gpush +++ b/bin/git-gpush @@ -298,8 +298,10 @@ sub determine_target() if ($ref_to eq "") { my $ref = $ref_from; $ref =~ s/[~^].*$//; - my $sref = read_git_line("symbolic-ref", "-q", $ref); - $ref = $sref if ($? == 0); + if ($ref eq "HEAD") { + $ref = read_git_line("symbolic-ref", "-q", "HEAD"); + die("Cannot detect tracking branch, HEAD does not point to a branch.\n") if ($? != 0); + } $ref =~ s,^refs/heads/,,; read_git_line("rev-parse", "--verify", "-q", "refs/heads/".$ref); die "Cannot detect tracking branch, $ref is not a valid ref.\n" if ($? != 0); |