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

From: Joey Hess <[email-masked]>
Date: Thu, 9 May 2024 13:41:45 -0400

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