control: tag -1 -pending

Hi Antonio,
On Sat, Apr 23, 2022 at 09:02:10AM -0300, Antonio Terceiro wrote:
> Control: tag -1 + patch
> 
> Hi, the attached patch fixes this issue on my side.

This helps for a lot of cases (pushing to the default remote when you've
already fetched from that remote) so thanks for that! We need some
improvements when:

- using another remote like: git push other-remote
- the user didn't fetch but someone else already pushed the same data

Ideally `git-push` would be clever enough so we can just figure the
out from e.g. the exit status.

I'll leave the bug open as there's still cases we need to fix.

Cheers,
 -- Guido

> From fa3db36fc4ba264b364873636a282ef16ba3c99f Mon Sep 17 00:00:00 2001
> From: Antonio Terceiro <terce...@debian.org>
> Date: Sat, 23 Apr 2022 08:56:52 -0300
> Subject: [PATCH] push: skip pristine-tar push if already present remotely
> 
> When one is working on an older branch (stable update or backport), the
> pristine-tar branch may already contain new commits after the one
> corresponding to the upstream version in question.
> 
> Closes: #1001163
> ---
>  gbp/scripts/push.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gbp/scripts/push.py b/gbp/scripts/push.py
> index d6876e26..63a06a20 100755
> --- a/gbp/scripts/push.py
> +++ b/gbp/scripts/push.py
> @@ -172,8 +172,10 @@ def main(argv):
>              if options.pristine_tar:
>                  commit, _ = repo.get_pristine_tar_commit(source)
>                  if commit:
> -                    ref = 'refs/heads/pristine-tar'
> -                    to_push['refs'].append((ref, get_push_src(repo, ref, 
> commit)))
> +                    target = repo.get_merge_branch('pristine-tar')
> +                    if not repo.branch_contains(target, commit, remote=True):
> +                        ref = 'refs/heads/pristine-tar'
> +                        to_push['refs'].append((ref, get_push_src(repo, ref, 
> commit)))
>  
>          if do_push(repo, [dest], to_push, dry_run=options.dryrun):
>              retval = 0
> -- 
> 2.35.1
> 

Reply via email to