Skip to contentSkip to conversation

When are you going to stop ignoring pull.mode?

DISCUSSION Felipe Contreras 4 participants 10 messages Jul 16, 2021 – Jul 19, 2021

lore
Share & tools
lore
#0 lore raw
Quoted 46 lines · Elijah Newren

It may be a worthy goal, but I cannot implement correct behavior if I cannot determine what correct behavior is.

You've only specified how to handle a subset of the valid combinations in each of your emails, and from those individually or even collectively I cannot deduce rules for handling the others. Reading the dozen+ recent messages in the various recent threads, I think I've figured out your opinion in all but two cases, but I have no idea your intent on those two (I would have thought --rebase override there too, but you excluded that), and I'm rather uncertain I've correctly understood you for the other ones (I really hope gmail doesn't whitespace damage the following table):

   pull.ff  pull.rebase  commandline            action
     *          *        --ff-only --rebase     fast-forward only[1]
     *          *        --rebase --no-ff       rebase[1]
     *          *        --rebase --ff          rebase[1]
     *          *        --ff-only --no-rebase  fast-forward only
     *          *        --no-rebase --no-ff    merge --no-ff
     *          *        --no-rebase --ff       merge --ff
    <unset>     *        --no-rebase            merge --ff
    only        *        --no-rebase            merge --ff[2]
    false       *        --no-rebase            merge --no-ff
    true        *        --no-rebase            merge --ff
    <unset>     *        --rebase               rebase
    only        *        --rebase               rebase[2]
    false       *        --rebase               ?[2]
    true        *        --rebase               ?[2]

* * --ff-only fast-forward only[1]

* <unset> --no-ff merge --no-ff
* false --no-ff merge --no-ff
* !false --no-ff rebase (ignore --no-ff)[2][3]

* <unset> --ff merge --ff
* false --ff merge --ff
* !false --ff rebase (ignore --ff)[2][3]

[1] https://lore.kernel.org/git/[email protected]/

    https://lore.kernel.org/git/[email protected]/

[2] https://lore.kernel.org/git/[email protected]/
[3] https://lore.kernel.org/git/[email protected]/

Quoted 7 lines

It appears you, Phillip, and I all had different opinions about correct behavior and in a few cases though the documentation clearly implied what we thought. So, I'd have to say the documentation is rather unclear as well. However, even if the above table is filled out, it may be complicated enough that I'm at a bit of a loss about how to update the documentation to explain it short of including the table in the documentation.

Yeah, now you are starting to see the problem.

How many more failed attempts do you need to go through before accepting that the approach you thought was feasible is in fact not feasible?

The solution is simple and self-documenting:

pull.mode={fast-forward,merge,rebase}

Signature · 1 line
Felipe Contreras
#1 lore raw
Quoted 4 lines · Felipe Contreras

The solution is simple and self-documenting:

   pull.mode={fast-forward,merge,rebase}

But how about config transition from pull.{ff,rebase} to pull.mode?

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#2 lore raw
Quoted 7 lines · Bagas Sanjaya
Quoted 4 lines · Felipe Contreras

The solution is simple and self-documenting:

   pull.mode={fast-forward,merge,rebase}

But how about config transition from pull.{ff,rebase} to pull.mode?

I have already discussed how the transition would look like, and it's pretty straightforward [1].

Additionally I already implemented the patch that does the mapping [2].

[1] https://lore.kernel.org/git/[email protected]/
[2] https://lore.kernel.org/git/[email protected]/

Signature · 1 line
Felipe Contreras
#3 lore raw
In reply to Felipe Contreras
Quoted 34 lines · Felipe Contreras
Quoted 33 lines · Elijah Newren

It may be a worthy goal, but I cannot implement correct behavior if I cannot determine what correct behavior is.

You've only specified how to handle a subset of the valid combinations in each of your emails, and from those individually or even collectively I cannot deduce rules for handling the others. Reading the dozen+ recent messages in the various recent threads, I think I've figured out your opinion in all but two cases, but I have no idea your intent on those two (I would have thought --rebase override there too, but you excluded that), and I'm rather uncertain I've correctly understood you for the other ones (I really hope gmail doesn't whitespace damage the following table):

    pull.ff  pull.rebase  commandline            action
      *          *        --ff-only --rebase     fast-forward only[1]
      *          *        --rebase --no-ff       rebase[1]
      *          *        --rebase --ff          rebase[1]
      *          *        --ff-only --no-rebase  fast-forward only
      *          *        --no-rebase --no-ff    merge --no-ff
      *          *        --no-rebase --ff       merge --ff
     <unset>     *        --no-rebase            merge --ff
     only        *        --no-rebase            merge --ff[2]
     false       *        --no-rebase            merge --no-ff
     true        *        --no-rebase            merge --ff
     <unset>     *        --rebase               rebase
     only        *        --rebase               rebase[2]
     false       *        --rebase               ?[2]
     true        *        --rebase               ?[2]

* * --ff-only fast-forward only[1]

Quoted 7 lines
Quoted 7 lines
      *       <unset>     --no-ff                merge --no-ff
      *        false      --no-ff                merge --no-ff
      *       !false      --no-ff                rebase (ignore --no-ff)[2][3]
      *       <unset>     --ff                   merge --ff
      *        false      --ff                   merge --ff
      *       !false      --ff                   rebase (ignore --ff)[2][3]

What about

* !false --ff-only ???

I think these are conflicting options, see [ ] (the ref without a number). This feels like saying oh, I want to rebase, but I want to fast-forward. What should happen with my local changes then? Could one argue that this should lead to the local changes being rebased on top of the remote?

Quoted 23 lines
Quoted 6 lines

[1] https://lore.kernel.org/git/[email protected]/

     https://lore.kernel.org/git/[email protected]/

[2] https://lore.kernel.org/git/[email protected]/
[3] https://lore.kernel.org/git/[email protected]/

Quoted 7 lines

It appears you, Phillip, and I all had different opinions about correct behavior and in a few cases though the documentation clearly implied what we thought. So, I'd have to say the documentation is rather unclear as well. However, even if the above table is filled out, it may be complicated enough that I'm at a bit of a loss about how to update the documentation to explain it short of including the table in the documentation.

Yeah, now you are starting to see the problem.

How many more failed attempts do you need to go through before accepting that the approach you thought was feasible is in fact not feasible?

The solution is simple and self-documenting:

   pull.mode={fast-forward,merge,rebase}
Signature · 8 lines
aixigo AG
Karl-Friedrich-Str. 68, 52072 Aachen, Germany
phone: +49 (0)241 559709-390, fax: +49 (0)241 559709-99
email: [email protected]
web: https://www.aixigo.com
District Court Aachen – HRB 8057
Board: Christian Friedrich, Tobias Haustein
Chairman of the Supervisory Board: Dr. Roland Schlager
#4 lore raw
Quoted 45 lines · Matthias Baumgarten
Quoted 34 lines · Felipe Contreras
Quoted 33 lines · Elijah Newren

It may be a worthy goal, but I cannot implement correct behavior if I cannot determine what correct behavior is.

You've only specified how to handle a subset of the valid combinations in each of your emails, and from those individually or even collectively I cannot deduce rules for handling the others. Reading the dozen+ recent messages in the various recent threads, I think I've figured out your opinion in all but two cases, but I have no idea your intent on those two (I would have thought --rebase override there too, but you excluded that), and I'm rather uncertain I've correctly understood you for the other ones (I really hope gmail doesn't whitespace damage the following table):

    pull.ff  pull.rebase  commandline            action
      *          *        --ff-only --rebase     fast-forward only[1]
      *          *        --rebase --no-ff       rebase[1]
      *          *        --rebase --ff          rebase[1]
      *          *        --ff-only --no-rebase  fast-forward only
      *          *        --no-rebase --no-ff    merge --no-ff
      *          *        --no-rebase --ff       merge --ff
     <unset>     *        --no-rebase            merge --ff
     only        *        --no-rebase            merge --ff[2]
     false       *        --no-rebase            merge --no-ff
     true        *        --no-rebase            merge --ff
     <unset>     *        --rebase               rebase
     only        *        --rebase               rebase[2]
     false       *        --rebase               ?[2]
     true        *        --rebase               ?[2]

* * --ff-only fast-forward only[1]

Quoted 7 lines
Quoted 7 lines
      *       <unset>     --no-ff                merge --no-ff
      *        false      --no-ff                merge --no-ff
      *       !false      --no-ff                rebase (ignore --no-ff)[2][3]
      *       <unset>     --ff                   merge --ff
      *        false      --ff                   merge --ff
      *       !false      --ff                   rebase (ignore --ff)[2][3]

What about

Quoted 7 lines

* !false --ff-only ???

I think these are conflicting options, see [ ] (the ref without a number). This feels like saying oh, I want to rebase, but I want to fast-forward. What should happen with my local changes then? Could one argue that this should lead to the local changes being rebased on top of the remote?

According to the above it would be a fast-forward only, because:

* * --ff-only fast-forward only

So the pull would abort f you have local changes.

Signature · 1 line
Felipe Contreras
#5 lore raw
In reply to Matthias Baumgarten
Quoted 7 lines · Matthias Baumgarten
Quoted 4 lines
Quoted 4 lines

pull.ff pull.rebase commandline action
...
* * --ff-only fast-forward only[1]
...

What about

* !false --ff-only ???

This is covered by an earlier entry ("*" stands for "any value"), I think; it should fast-forward or fail. The reasoning goes like this:

The user configures pull.rebase to some kind of rebase; it could be just true (the traditional flattening rebase), or the one that preserves the shape of the history, or even the interactive one. With the configuration, what the user declares is:

I may have my own development on top of the result of my last integration with the upstream I did when I ran "git pull" the last time, and when the upstream has more commits, the way I want my local work to integrate with their work is to replay my work on top of theirs (as opposed to "merging their work into my history").

But by passing "--ff-only" from the command line, the user tells us this:

This time only, I want fast-forward update and nothing else. I do not remember doing any of my own development on top of their history, and I expect that this update from the upstream would fast-forward. If that is not the case, please error out, as I need to inspect the situation further and I do not want to see conflicts in unexpected commits I thought I did not have.

So the "action" would be

- If their history is a descendant of ours, that means that on top of their history previously observed by us, we haven't added any development of our own. We just move to the tip of their history and we are done.

This is not so surprising anyway. If we are doing any kind of rebasing, what happens is to start from the tip of their history and then commits from our own development are replayed on top of that. When their history is a descendant of ours, we end up doing just fast-forward, as there is nothing to replay on top.

- Otherwise, because the user expects the command to fail if their history is not a descendant of ours, we fail.

And "fast-forward only" in Elijah's table is a concise way to say that.

I concentrated on "if the configuration is set to do some kind of rebase" case, as that was your question, but the above reasoning applies equally to the case where pull.rebase is not specified or set to false, i.e. the user tells us to merge.

#6 lore raw
Quoted 29 lines · Junio C Hamano
Quoted 7 lines · Matthias Baumgarten
Quoted 4 lines
Quoted 4 lines

pull.ff pull.rebase commandline action
...
* * --ff-only fast-forward only[1]
...

What about

* !false --ff-only ???

This is covered by an earlier entry ("*" stands for "any value"), I think; it should fast-forward or fail. The reasoning goes like this:

The user configures pull.rebase to some kind of rebase; it could be just true (the traditional flattening rebase), or the one that preserves the shape of the history, or even the interactive one. With the configuration, what the user declares is:

I may have my own development on top of the result of my last integration with the upstream I did when I ran "git pull" the last time, and when the upstream has more commits, the way I want my local work to integrate with their work is to replay my work on top of theirs (as opposed to "merging their work into my history").

But by passing "--ff-only" from the command line, the user tells us this:

Quoted 6 lines

This time only, I want fast-forward update and nothing else. I do not remember doing any of my own development on top of their history, and I expect that this update from the upstream would fast-forward. If that is not the case, please error out, as I need to inspect the situation further and I do not want to see conflicts in unexpected commits I thought I did not have.

No, this is what you think the user would be telling us, but that's not what the user is *actually* telling us right now.

  git -c pull.ff=only pull --rebase

What the user is actually telling us right now is that while he normally would expect a fast-forward, in this case he would like a rebase.

Today this is the equivalent of:

  git -c pull.rebase=true pull --ff-only

If you change this interpretation, it would break the symmetry between configurations and command line arguments.

Quoted 7 lines

So the "action" would be

- If their history is a descendant of ours, that means that on top of their history previously observed by us, we haven't added any development of our own. We just move to the tip of their history and we are done.

Quoted 5 lines

This is not so surprising anyway. If we are doing any kind of rebasing, what happens is to start from the tip of their history and then commits from our own development are replayed on top of that. When their history is a descendant of ours, we end up doing just fast-forward, as there is nothing to replay on top.

But --ff-only is not for rebases, the documentation is very clear:

Specifies how a merge is handled when the merged-in history is already a descendant of the current history. --ff is the default unless merging an annotated (and possibly signed) tag that is not stored in its natural place in the refs/tags/ hierarchy, in which case --no-ff is assumed.

With --ff-only, resolve the merge as a fast-forward when possible. When not possible, refuse to merge and exit with a non-zero status.

Quoted 5 lines

- Otherwise, because the user expects the command to fail if their history is not a descendant of ours, we fail.

And "fast-forward only" in Elijah's table is a concise way to say that.

Yes, but it's taking us in the wrong direction by ignoring how the users actually use --ff-only today, what the documentation actually says, breaking the symmetry of configurations and arguments, and making everything less intuitive.

On the other hand if --ff-only was mapped to pull.mode=fast-forward instead, everything is clear:

  git -c pull.mode=fast-forward pull --rebase
  git -c pull.mode=rebase pull --ff-only

I don't even need to explain what these do.

Signature · 1 line
Felipe Contreras
#7 lore raw
In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Matthias Baumgarten
Quoted 4 lines
Quoted 4 lines

pull.ff pull.rebase commandline action
...
* * --ff-only fast-forward only[1]
...

Quoted 7 lines
Quoted 3 lines

What about

* !false --ff-only ???

This is covered by an earlier entry ("*" stands for "any value"), I think; it should fast-forward or fail. The reasoning goes like this:

Ah, I just misunderstood *, nevermind!

Quoted 36 lines

The user configures pull.rebase to some kind of rebase; it could be just true (the traditional flattening rebase), or the one that preserves the shape of the history, or even the interactive one. With the configuration, what the user declares is:

I may have my own development on top of the result of my last integration with the upstream I did when I ran "git pull" the last time, and when the upstream has more commits, the way I want my local work to integrate with their work is to replay my work on top of theirs (as opposed to "merging their work into my history").

But by passing "--ff-only" from the command line, the user tells us this:

This time only, I want fast-forward update and nothing else. I do not remember doing any of my own development on top of their history, and I expect that this update from the upstream would fast-forward. If that is not the case, please error out, as I need to inspect the situation further and I do not want to see conflicts in unexpected commits I thought I did not have.

So the "action" would be

- If their history is a descendant of ours, that means that on top of their history previously observed by us, we haven't added any development of our own. We just move to the tip of their history and we are done.

This is not so surprising anyway. If we are doing any kind of rebasing, what happens is to start from the tip of their history and then commits from our own development are replayed on top of that. When their history is a descendant of ours, we end up doing just fast-forward, as there is nothing to replay on top.

Quoted 5 lines

- Otherwise, because the user expects the command to fail if their history is not a descendant of ours, we fail.

And "fast-forward only" in Elijah's table is a concise way to say that.

Agree.

Quoted 6 lines

I concentrated on "if the configuration is set to do some kind of rebase" case, as that was your question, but the above reasoning applies equally to the case where pull.rebase is not specified or set to false, i.e. the user tells us to merge.

Perfectly valid reasoning.

Initially I came from the situation where I (as maintainer of a repository) proposed to do a git pull --ff-only <remote-git-url> <branch-name> for the others to integrate the newest changes safely (i.e. failing if they had errouneously worked on that branch, which it is not intended for). I thought I could reach that safety with the --ff-only part, but it seems one of the devs had pull.rebase set for him locally and thus managed to bypass my "safety". Mr. Elijah Newren called this a bug, see [1].

Another way for the others to integrate my changes would be to propose a git reset --hard ... but that seems very... hard. It would overwrite all local changes (only recoverable by the reflog then, and you would even need to know that you had local changes in the first place).

[1] https://lore.kernel.org/git/CABPp-BEHZcfZNL+PG1vmqXGf4Qs3eoULb4NDDgbmOB30HzJu_Q@mail.gmail.com/

Signature · 8 lines
aixigo AG
Karl-Friedrich-Str. 68, 52072 Aachen, Germany
phone: +49 (0)241 559709-390, fax: +49 (0)241 559709-99
email: [email protected]
web: https://www.aixigo.com
District Court Aachen – HRB 8057
Board: Christian Friedrich, Tobias Haustein
Chairman of the Supervisory Board: Dr. Roland Schlager
#8 lore raw
Quoted 8 lines · Matthias Baumgarten

Initially I came from the situation where I (as maintainer of a repository) proposed to do a git pull --ff-only <remote-git-url> <branch-name> for the others to integrate the newest changes safely (i.e. failing if they had errouneously worked on that branch, which it is not intended for). I thought I could reach that safety with the --ff-only part, but it seems one of the devs had pull.rebase set for him locally and thus managed to bypass my "safety". Mr. Elijah Newren called this a bug, see [1].

Yes, I saw it and I agree with Elijah.

Thanks.

#9 lore raw
In reply to Matthias Baumgarten
Quoted 10 lines · Matthias Baumgarten
Quoted 5 lines · Junio C Hamano

I concentrated on "if the configuration is set to do some kind of rebase" case, as that was your question, but the above reasoning applies equally to the case where pull.rebase is not specified or set to false, i.e. the user tells us to merge.

Perfectly valid reasoning.

Quoted 8 lines

Initially I came from the situation where I (as maintainer of a repository) proposed to do a git pull --ff-only <remote-git-url> <branch-name> for the others to integrate the newest changes safely (i.e. failing if they had errouneously worked on that branch, which it is not intended for). I thought I could reach that safety with the --ff-only part, but it seems one of the devs had pull.rebase set for him locally and thus managed to bypass my "safety". Mr. Elijah Newren called this a bug, see [1].

It's not a bug. It could be made a bug if the semantics of --ff-only were changed to something that overrides pull.rebase, but that something doesn't exist yet:

pull.mode=fast-forward

Right now it can't be done.

Signature · 1 line
Felipe Contreras