aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2022-05-16 10:36:07 +0200
committerGuido Günther <agx@sigxcpu.org>2022-05-16 10:56:49 +0200
commit8e135ea459c5d1a2cc7483ea91dafb1f50e457c6 (patch)
tree016e4e6f11546cf472044647d3d34fd072a1c679
parent3627fa027a989b470fc9ec6666012b351a893b37 (diff)
push: Limit remote check to default remote
We can't assume the user is pushing to the defaulte remote as gbp push foo is also supported hence we can't just check pristine-tar status on the default merge branch. Helps 2405e158 ("push: skip pristine-tar push if already present remotely") Gbp-Dch: Ignore
-rwxr-xr-xgbp/scripts/push.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/gbp/scripts/push.py b/gbp/scripts/push.py
index 494d7eb2..f1c7a59d 100755
--- a/gbp/scripts/push.py
+++ b/gbp/scripts/push.py
@@ -172,11 +172,16 @@ def main(argv):
if options.pristine_tar:
commit, _ = repo.get_pristine_tar_commit(source)
if commit:
- target = repo.get_merge_branch('pristine-tar')
- if not repo.branch_contains(target, commit, remote=True):
- ref = 'refs/heads/pristine-tar'
+ ref = 'refs/heads/pristine-tar'
+ # If we push to the default we only push if our notion of the remote
+ # branch doesn't have the commit already (See #1001163)
+ if dest == get_remote(repo, repo.branch):
+ target = repo.get_merge_branch('pristine-tar')
+ if not repo.branch_contains(target, commit, remote=True):
+ to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
+ else:
+ # TODO: Needs to check remote first, (See #1001163)
to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
-
if do_push(repo, [dest], to_push, dry_run=options.dryrun):
retval = 0
else: