Re: dist-git: Diverging branches can't be fast-forwarded

2023-07-22 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Jul 22, 2023 at 09:08:37AM +0200, Miroslav Suchý wrote:
> Dne 21. 07. 23 v 10:50 Zbigniew Jędrzejewski-Szmek napsal(a):
> > > Is this expected? Or is this sign of something malicious happenening?
> > Dunno. Generally the most likely explanation would be that you have local
> > commits. But if that is impossible, then something strange is going on.
> > Can you identify the repos in question?
> 
> It took some time... I found one:
> 
> It is a package xorg-x11-xdm
> 
> Now I see:
> 
> * 1ee5a42 (HEAD -> rawhide, origin/rawhide, origin/main, origin/f38, 
> origin/f37, origin/HEAD)Remove duplicated patch
> * d97e4c6Unretire xorg-x11-xdm package
> * a9058e1Unretirement request: https://pagure.io/releng/issue/11456
> * e776f0fOrphaned for 6+ weeks
> * 6f197fa (origin/f36)- Rebuilt for 
> https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
> 
> 
> 
> But the checkout from past I have is:
> 
> * 8a9aff8 (HEAD -> rawhide)Unretirement request: 
> https://pagure.io/releng/issue/11456
> * e776f0fOrphaned for 6+ weeks
> * 6f197fa (origin/f36)- Rebuilt for 
> https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
> 
> So the commit where it diverge is commit:
> 
> commit 8a9aff84896f28b93851579600afdc59b75b7710 (HEAD -> rawhide)
> Author: Tomas Hrcka 
> Date:   Thu Jun 8 15:06:43 2023 +0200
> 
>    Unretirement request: https://pagure.io/releng/issue/11456
> 
> That has been replaced by:
> 
> commit a9058e1cce504e6b354b59d6711d76aeb0a8418c
> Author: Tomas Hrcka 
> Date:   Wed Jun 14 14:35:41 2023 +0200
> 
>    Unretirement request: https://pagure.io/releng/issue/11456
> 
> I repeat myself: this my local checkout that was done by "fedpkg clone" and
> I never changed anything in this git repo. I have never made a commit there.
> I just read the data. And every two weeks I am doing git-pull there.

Tomáš,
do you know what's going on here?

Zbyszek
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: dist-git: Diverging branches can't be fast-forwarded

2023-07-22 Thread Miroslav Suchý

Dne 21. 07. 23 v 10:50 Zbigniew Jędrzejewski-Szmek napsal(a):

Is this expected? Or is this sign of something malicious happenening?

Dunno. Generally the most likely explanation would be that you have local
commits. But if that is impossible, then something strange is going on.
Can you identify the repos in question?


It took some time... I found one:

It is a package xorg-x11-xdm

Now I see:

* 1ee5a42 (HEAD -> rawhide, origin/rawhide, origin/main, origin/f38, 
origin/f37, origin/HEAD)Remove duplicated patch
* d97e4c6Unretire xorg-x11-xdm package
* a9058e1Unretirement request: https://pagure.io/releng/issue/11456
* e776f0fOrphaned for 6+ weeks
* 6f197fa (origin/f36)- Rebuilt for 
https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild



But the checkout from past I have is:

* 8a9aff8 (HEAD -> rawhide)Unretirement request: 
https://pagure.io/releng/issue/11456
* e776f0fOrphaned for 6+ weeks
* 6f197fa (origin/f36)- Rebuilt for 
https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

So the commit where it diverge is commit:

commit 8a9aff84896f28b93851579600afdc59b75b7710 (HEAD -> rawhide)
Author: Tomas Hrcka 
Date:   Thu Jun 8 15:06:43 2023 +0200

   Unretirement request: https://pagure.io/releng/issue/11456

That has been replaced by:

commit a9058e1cce504e6b354b59d6711d76aeb0a8418c
Author: Tomas Hrcka 
Date:   Wed Jun 14 14:35:41 2023 +0200

   Unretirement request: https://pagure.io/releng/issue/11456

I repeat myself: this my local checkout that was done by "fedpkg clone" and I never changed anything in this git repo. I 
have never made a commit there. I just read the data. And every two weeks I am doing git-pull there.


--
Miroslav Suchy, RHCA
Red Hat, Manager, Packit and CPT, #brno, #fedora-buildsys
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: dist-git: Diverging branches can't be fast-forwarded

2023-07-21 Thread Michael J Gruber
Kevin Kofler via devel venit, vidit, dixit 2023-07-21 15:52:23:
> Miroslav Suchý wrote:
> > When I make SPDX statistics I have git checkout of all dist-gits and do
> > git-pull every two week there. This morning I found that two times I got
> > an error:
> > 
> > hint: Diverging branches can't be fast-forwarded, you need to either:
> > hint:
> > hint: git merge --no-ff
> > hint:
> > hint: or:
> > hint:
> > hint: git rebase
> > hint:
> > hint: Disable this message with "git config advice.diverging false"
> > fatal: Not possible to fast-forward, aborting.
> > Could not execute pull: Failed to execute command.
> > 
> > I was under the impression that our dist-git can have only forward
> > commits.
> 
> You should always (from all upstreams, no matter whether they allow force 
> pushes or not) pull with rebase (git pull --rebase). This rebases your 
> local, not yet pushed, changes on top of the upstream changes. Since it does 
> not change the upstream history, only your local unpushed one, it should 
> never require a force-push and hence always be safe. And it works even if 
> the upstream has been force-pushed (which should never happen in Fedora, but 
> can be an issue in other projects).
> 
> A pull with fast-forward only will fail if you have local changes, as you 
> can see above. A pull with merge will create a merge commit. The pull with 
> rebase is the cleanest option.

... and that is why "you should always (from all upstreams ..." is a very
wrong advice to give in this generality.

In fact:

- rewriting your local history automatically (due to the rebase)
  may not at all be what you want (because you may care about it)

- rebasing your changes on top of the latest upstream may not be what
  upstream wants from you (because they may want to base fixes on the
  earliest commit to which they apply, or the commit which introduced a
  regression)

Rebasing your history is not the cleanest option in these case, but the
wrong option.

The best general advice is to fetch, not pull. Then check $ref@{1}..$ref
for the remote $ref you fetched. (merge --no-ff may do as well)

Just look at it this way: Miroslav would not even have noticed something
strange going on had he done a "pull -rebase".

Use the automatic stuff only in those cases where you are sure about the
source or do not care about the target.

Michael
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: dist-git: Diverging branches can't be fast-forwarded

2023-07-21 Thread Kevin Kofler via devel
Miroslav Suchý wrote:
> When I make SPDX statistics I have git checkout of all dist-gits and do
> git-pull every two week there. This morning I found that two times I got
> an error:
> 
> hint: Diverging branches can't be fast-forwarded, you need to either:
> hint:
> hint: git merge --no-ff
> hint:
> hint: or:
> hint:
> hint: git rebase
> hint:
> hint: Disable this message with "git config advice.diverging false"
> fatal: Not possible to fast-forward, aborting.
> Could not execute pull: Failed to execute command.
> 
> I was under the impression that our dist-git can have only forward
> commits.

You should always (from all upstreams, no matter whether they allow force 
pushes or not) pull with rebase (git pull --rebase). This rebases your 
local, not yet pushed, changes on top of the upstream changes. Since it does 
not change the upstream history, only your local unpushed one, it should 
never require a force-push and hence always be safe. And it works even if 
the upstream has been force-pushed (which should never happen in Fedora, but 
can be an issue in other projects).

A pull with fast-forward only will fail if you have local changes, as you 
can see above. A pull with merge will create a merge commit. The pull with 
rebase is the cleanest option.

Kevin Kofler
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: dist-git: Diverging branches can't be fast-forwarded

2023-07-21 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jul 21, 2023 at 10:28:04AM +0200, Miroslav Suchý wrote:
> When I make SPDX statistics I have git checkout of all dist-gits and do
> git-pull every two week there. This morning I found that two times I got an
> error:
> 
> hint: Diverging branches can't be fast-forwarded, you need to either:
> hint:
> hint: git merge --no-ff
> hint:
> hint: or:
> hint:
> hint: git rebase
> hint:
> hint: Disable this message with "git config advice.diverging false"
> fatal: Not possible to fast-forward, aborting.
> Could not execute pull: Failed to execute command.
> 
> I was under the impression that our dist-git can have only forward commits.

Stricly speaking, we do allow removal of commits in very limited circumstances,
see https://pagure.io/releng/blob/main/f/scripts/distgit-branch-unused.py.
In principle somebody could then recreate the branch with different commits.
But release branches are not allowed to be removed, and you're pulling release
branches, so I don't think this is the case.

> Is this expected? Or is this sign of something malicious happenening?

Dunno. Generally the most likely explanation would be that you have local
commits. But if that is impossible, then something strange is going on.
Can you identify the repos in question?

Zbyszek
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue