#1023383 git-buildpackage: gbp pull shows empty error message on failure

#1023383#5
Date:
2022-11-03 08:01:36 UTC
From:
To:
Dear Maintainer,

Today 'gbp pull' failed without giving me much details:

  $ gbp pull --verbose
  gbp:info: Fetching from default remote for each branch
  gbp:debug: ['git', 'rev-parse', '--show-cdup']
  gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
  gbp:debug: ['git', 'rev-parse', '--git-dir']
  gbp:debug: ['git', 'symbolic-ref', 'HEAD']
  gbp:debug: ['git', 'show-ref', 'refs/heads/kali/master']
  gbp:debug: ['git', 'status', '--porcelain']
  gbp:debug: ['git', 'fetch', '--quiet']
  gbp:debug: ['git', 'fetch', '--quiet', '--tags']
  gbp:error: Error running git fetch:

As you can see, the error message from 'git fetch' was not displayed. So
I had to go patch gbp and drop the '--quiet' argument from the 'git
fetch' command, so that I could understand what was the issue.

Output after I patched:

  $ gbp pull --verbose
  gbp:info: Fetching from default remote for each branch
  gbp:debug: ['git', 'rev-parse', '--show-cdup']
  gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
  gbp:debug: ['git', 'rev-parse', '--git-dir']
  gbp:debug: ['git', 'symbolic-ref', 'HEAD']
  gbp:debug: ['git', 'show-ref', 'refs/heads/kali/master']
  gbp:debug: ['git', 'status', '--porcelain']
  gbp:debug: ['git', 'fetch']
  gbp:debug: ['git', 'fetch', '--tags']
  gbp:error: Error running git fetch: From gitlab.com:kalilinux/packages/grub2
   ! [rejected]        kali/2.06-3kali2 -> kali/2.06-3kali2  (would clobber existing tag)

That's much better!

Clearly, this '--quiet' argument gets in the way. So first, I tried to
understand where it comes from. I could track the addition of it to this
commit:

  8038a46e77b557ed234a0cfcb3c6109190d1b2c2
  Author: Guido Günther <agx@sigxcpu.org>  2011-11-07 23:37:54
  Subject: GitRepository: fetch and pull quietly

Looking at the code, it seems that at the time (2011!) stdout/stderr
would be displayed "as is" by gbp, therefore the addition of '--quiet'
was meant to make gbp a bit more quiet. At least, that's how I
understand it.

Fast-forward today: the function 'fetch' calls '_git_command', which
captures stderr and stdout, and uses it only internally to display an
error message, if ever there's an error (cf.  `gbp/git/repository.py`).
Then it's discarded (not returned to the caller).

So it seems to me that there's no good reason to use '--quiet' anymore.

Please find a tentative change at:
https://salsa.debian.org/arnaudr/git-buildpackage/-/commit/4c798909

Best regards,

Arnaud
----

#1023383#10
Date:
2022-12-15 05:43:19 UTC
From:
To:
For what it's worth, I rebased my branch so that the CI now passes.

The new commit with the patch is:
https://salsa.debian.org/arnaudr/git-buildpackage/-/commit/8f10840587e05b27ee43fbff10480ef2734805bb

BTW, please tell me if there's a better workflow than having a fork on
Salsa, in order to contribute to gbp.

Thanks!

#1023383#15
Date:
2025-08-19 17:36:15 UTC
From:
To:
Hi!

I ran to this same error multiple times in past months when reviewing
Merge Requests about new upstream imports, and the submitter having
wrong/extra tags in their fork.

I see the error when I run the git fetch manually with `--quit` omitted:

± gbp pull --verbose --force twrightsman
gbp:info: Fetching from 'twrightsman'
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/debian/latest']
gbp:debug: ['git', 'status', '--porcelain']
gbp:debug: ['git', 'fetch', '--quiet', 'twrightsman']
gbp:debug: ['git', 'fetch', '--quiet', '--tags', 'twrightsman']
gbp:error: Error running git fetch:

± git fetch --tags twrightsman
From https://salsa.debian.org/twrightsman/godot
 ! [rejected]                upstream/4.3+ds   -> upstream/4.3+ds
(would clobber existing tag)
 ! [rejected]                upstream/4.4.1+ds -> upstream/4.4.1+ds
(would clobber existing tag)

Arnaud's commit
https://salsa.debian.org/arnaudr/git-buildpackage/-/commit/8f10840587e05b27ee43fbff10480ef2734805bb
makes sense to me.

Maybe you can submit it as a MR at
https://salsa.debian.org/agx/git-buildpackage/-/merge_requests now
that is an option?

#1023383#20
Date:
2025-08-20 01:19:41 UTC
From:
To: