Debian Bug report logs - #877464
git-remote-gcrypt: git push always behaves as if --force is given

version graph

Package: git-remote-gcrypt; Maintainer for git-remote-gcrypt is Sean Whitton <[email protected]>; Source for git-remote-gcrypt is src:git-remote-gcrypt (PTS, buildd, popcon).

Reported by: John Goerzen <[email protected]>

Date: Mon, 2 Oct 2017 02:03:01 UTC

Severity: important

Found in version git-remote-gcrypt/1.0.1-1

Outlook: git-remote-gcrypt needs a test suite before this kind of bug can be fixed

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Sean Whitton <[email protected]>:
Bug#877464; Package git-remote-gcrypt. (Mon, 02 Oct 2017 02:03:04 GMT) (full text, mbox, link).


Acknowledgement sent to John Goerzen <[email protected]>:
New Bug report received and forwarded. Copy sent to Sean Whitton <[email protected]>. (Mon, 02 Oct 2017 02:03:04 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: John Goerzen <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: git-remote-gcrypt: git push always behaves as if --force is given
Date: Sun, 01 Oct 2017 20:58:30 -0500
Package: git-remote-gcrypt
Version: 1.0.1-1
Severity: important

Here's a secnario -

I have repo A and repo B.  Both have the same git-remote-gcrypt
repository named origin, and both begin with the same HEAD.

Now, make a commit on repo A and push it.  Make a different commit
on repo B and run git push.

The expected result here is an error, and the usual way to handle
it would be to do a git pull followed by another push attempt.

Unfortunately, with git-remote-gcrypt, the push from repo B
silently clobbers the most recent commit made on repo A.  A
subsequent pull from repo B will not pull down the changes
from repo A.

All is not *completely* lost; on repo A, a subsequent pull will
offer to merge the changes from repo B.

This is rather unfortunate for both collaboration with a workgroup
or even sharing files between multiple devices of one's own.


-- System Information:
Debian Release: 9.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages git-remote-gcrypt depends on:
ii  git     1:2.11.0-3+deb9u1
ii  gnupg   2.1.18-6
ii  gnupg2  2.1.18-6

Versions of packages git-remote-gcrypt recommends:
ii  curl   7.52.1-5
ii  rsync  3.1.2-1

git-remote-gcrypt suggests no packages.

-- no debconf information



Information forwarded to [email protected]:
Bug#877464; Package git-remote-gcrypt. (Mon, 02 Oct 2017 16:51:09 GMT) (full text, mbox, link).


Acknowledgement sent to Sean Whitton <[email protected]>:
Extra info received and forwarded to list. (Mon, 02 Oct 2017 16:51:09 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Sean Whitton <[email protected]>
To: John Goerzen <[email protected]>, [email protected]
Subject: Re: Bug#877464: git-remote-gcrypt: git push always behaves as if --force is given
Date: Mon, 02 Oct 2017 09:47:10 -0700
[Message part 1 (text/plain, inline)]
Dear John,

On Sun, Oct 01 2017, John Goerzen wrote:

> The expected result here is an error, and the usual way to handle it
> would be to do a git pull followed by another push attempt.
>
> Unfortunately, with git-remote-gcrypt, the push from repo B silently
> clobbers the most recent commit made on repo A.  A subsequent pull
> from repo B will not pull down the changes from repo A.

Could you say which backend you were using when you saw this, please?
Possibly it affects all backends, but which were you able to test?

Thanks.

-- 
Sean Whitton
[signature.asc (application/pgp-signature, inline)]

Information forwarded to [email protected], Sean Whitton <[email protected]>:
Bug#877464; Package git-remote-gcrypt. (Mon, 02 Oct 2017 19:15:02 GMT) (full text, mbox, link).


Acknowledgement sent to John Goerzen <[email protected]>:
Extra info received and forwarded to list. Copy sent to Sean Whitton <[email protected]>. (Mon, 02 Oct 2017 19:15:02 GMT) (full text, mbox, link).


Message #15 received at [email protected] (full text, mbox, reply):

From: John Goerzen <[email protected]>
To: Sean Whitton <[email protected]>, [email protected]
Subject: Re: Bug#877464: git-remote-gcrypt: git push always behaves as if --force is given
Date: Mon, 2 Oct 2017 13:31:50 -0500
On 10/02/2017 11:47 AM, Sean Whitton wrote:
>
> Could you say which backend you were using when you saw this, please?
> Possibly it affects all backends, but which were you able to test?
Hi Sean,

I tested it with both the rsync and the git:// backends and observed the
same behavior with both.

- John





Information forwarded to [email protected]:
Bug#877464; Package git-remote-gcrypt. (Sun, 22 Oct 2017 19:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Sean Whitton <[email protected]>:
Extra info received and forwarded to list. (Sun, 22 Oct 2017 19:27:03 GMT) (full text, mbox, link).


Message #20 received at [email protected] (full text, mbox, reply):

From: Sean Whitton <[email protected]>
To: John Goerzen <[email protected]>, [email protected]
Subject: Re: Bug#877464: git-remote-gcrypt: git push always behaves as if --force is given
Date: Sun, 22 Oct 2017 12:23:24 -0700
[Message part 1 (text/plain, inline)]
control: outlook -1 git-remote-gcrypt needs a test suite before this kind of bug can be fixed

Hello John,

On Mon, Oct 02 2017, John Goerzen wrote:

> On 10/02/2017 11:47 AM, Sean Whitton wrote:
>>
>> Could you say which backend you were using when you saw this, please?
>> Possibly it affects all backends, but which were you able to test?
> Hi Sean,
>
> I tested it with both the rsync and the git:// backends and observed
> the same behavior with both.

Thank you again for testing.

Fixing this bug is going to require substantial refactoring.  I am
loathe to do that until git-remote-gcrypt has a test suite, so that I
can be sure existing functionality does not break.

I hope to be able to sit down and write such a test suite at some point
during the next year.

-- 
Sean Whitton
[signature.asc (application/pgp-signature, inline)]

Outlook recorded from message bug 877464 message Request was from Sean Whitton <[email protected]> to [email protected]. (Sun, 22 Oct 2017 19:27:03 GMT) (full text, mbox, link).


Information forwarded to [email protected], Sean Whitton <[email protected]>:
Bug#877464; Package git-remote-gcrypt. (Fri, 03 Apr 2020 17:51:02 GMT) (full text, mbox, link).


Acknowledgement sent to montag451 <[email protected]>:
Extra info received and forwarded to list. Copy sent to Sean Whitton <[email protected]>. (Fri, 03 Apr 2020 17:51:02 GMT) (full text, mbox, link).


Message #27 received at [email protected] (full text, mbox, reply):

From: montag451 <[email protected]>
To: [email protected]
Subject: Re: Bug#877464: git-remote-gcrypt: git push always behaves as if --force is given
Date: Fri, 3 Apr 2020 19:41:34 +0200
Hi,

A solution could be the use of --force-with-lease instead of --force. It 
would prevent the behavior observed by the OP.

BR

---

montag451




Information forwarded to [email protected], Sean Whitton <[email protected]>:
Bug#877464; Package git-remote-gcrypt. (Fri, 26 Apr 2024 20:03:02 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Hess <[email protected]>:
Extra info received and forwarded to list. Copy sent to Sean Whitton <[email protected]>. (Fri, 26 Apr 2024 20:03:02 GMT) (full text, mbox, link).


Message #32 received at [email protected] (full text, mbox, reply):

From: Joey Hess <[email protected]>
To: [email protected]
Subject: re: git-remote-gcrypt: git push always behaves as if --force is given
Date: Fri, 26 Apr 2024 15:52:12 -0400
[Message part 1 (text/plain, inline)]
I was implementing another gitremote-helper today and ran into what I
think is the same problem. Since I've worked around the problem in my
gitremote-helper successfully, I wanted to share what I've learned in
case it can help git-remote-gcrypt.

When git push is run, for a non-forced push, it asks the
gitremote-helper program for "list for-push". It then sends a "push" to
it. And only after that does it go compare the list of refs it got with
the list of refs it has asked to be pushed, and notice if the push would
overwrite a ref. At that point, git pull will complain that refs were
not able to be pushed. But actually nothing stopped the gitremote-helper
from doing a push that overwrote a ref, effectively a force push.

I think this is a bug in git. I can't imagine why it behaves this way.
It requires that every gitremote-helper program effectively replicate
git's own detection of a disallowed push, in order to reject the
"push" with "error $ref"

It is certainly possible for a gitremote-helper program to do that
though. What I did is, when git runs "list for-push", I remember the
refs that are on the remote. Then when git runs "push $src:$dst",
(but not when it's a "+$src" forced push), I compare the sha of $src
with the old ref I saw on the remote. If the shas are different, I 
check `git log --oneline $old..$src` -- if this outputs nothing, then
history is not advancing and it refuses to push that ref, and 
reports the error to git.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to [email protected]:
Bug#877464; Package git-remote-gcrypt. (Sat, 27 Apr 2024 09:18:09 GMT) (full text, mbox, link).


Acknowledgement sent to Sean Whitton <[email protected]>:
Extra info received and forwarded to list. (Sat, 27 Apr 2024 09:18:09 GMT) (full text, mbox, link).


Message #37 received at [email protected] (full text, mbox, reply):

From: Sean Whitton <[email protected]>
To: Joey Hess <[email protected]>
Cc: [email protected]
Subject: Re: Bug#877464: git-remote-gcrypt: git push always behaves as if --force is given
Date: Sat, 27 Apr 2024 10:10:09 +0100
[Message part 1 (text/plain, inline)]
Hello,

Many thanks for this.  Hopefully someone will be interested in
implementing it at some point.

-- 
Sean Whitton
[signature.asc (application/pgp-signature, inline)]

Information forwarded to [email protected], Sean Whitton <[email protected]>:
Bug#877464; Package git-remote-gcrypt. (Thu, 09 May 2024 17:45:03 GMT) (full text, mbox, link).


Acknowledgement sent to Joey Hess <[email protected]>:
Extra info received and forwarded to list. Copy sent to Sean Whitton <[email protected]>. (Thu, 09 May 2024 17:45:03 GMT) (full text, mbox, link).


Message #42 received at [email protected] (full text, mbox, reply):

From: Joey Hess <[email protected]>
To: [email protected]
Subject: Re: git-remote-gcrypt: git push always behaves as if --force is given
Date: Thu, 9 May 2024 13:41:45 -0400
[Message part 1 (text/plain, inline)]
Joey Hess wrote:
> with the old ref I saw on the remote. If the shas are different, I 
> check `git log --oneline $old..$src` -- if this outputs nothing, then
> history is not advancing and it refuses to push that ref, and 
> reports the error to git.

That's not quite right, because git log outputs commits when the two
refs are diverged but share a common ancestor.

I think the best way to detect it is
git merge-base --ancestor $old $src
which will exit nonzero on a non-fast-forward.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Thu May 15 07:02:31 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.