{"thread":{"id":"53089","subject":"\"git rebase\" behavior change in 2.26.0","startedAt":"2020-03-25T03:38:18Z","lastAt":"2020-03-27T20:59:46Z","messageCount":11,"participants":["Norbert Kiesel","Jeff King","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"393916","messageId":"CAM+g_Nuu2jGuNwUMS3j8=EjOrthYzfVTrUzOxQJ=aYcoBAL3Tg@mail.gmail.com","threadId":"53089","inReplyTo":null,"subject":"\"git rebase\" behavior change in 2.26.0","fromName":"Norbert Kiesel","fromEmail":"nkiesel@gmail.com","sentAt":"2020-03-25T03:38:04Z","receivedAt":"2020-03-25T03:38:18Z","isPatch":false,"sender":{"key":"nkiesel@gmail.com","avatar":null},"body":"Hi,\n\nI track an upstream repo with \"pull.rebase = true\" where I do a `git\npull` followed by a `git log -p ORIG_HEAD..` for a branch to see\nchanges since the last \"pull\".  I normally do not commit to this\nbranch and thus this normally is a \"fast-forward\" merge.\n\nStarting with 2.26 this no longer works because ORIG_HEAD is always\nset to HEAD after my `git pull`.\n\nI track other prances from the same repo where I do local changes and\nthen want the `git pull --rebase` and I thus do not want to\ngive up on the `pull.rebase = true` configuration.\n"},{"id":"393922","messageId":"20200325053908.GC651138@coredump.intra.peff.net","threadId":"53089","inReplyTo":"CAM+g_Nuu2jGuNwUMS3j8=EjOrthYzfVTrUzOxQJ=aYcoBAL3Tg@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-03-25T05:39:08Z","receivedAt":"2020-03-25T05:39:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 24, 2020 at 08:38:04PM -0700, Norbert Kiesel wrote:\n\n> I track an upstream repo with \"pull.rebase = true\" where I do a `git\n> pull` followed by a `git log -p ORIG_HEAD..` for a branch to see\n> changes since the last \"pull\".  I normally do not commit to this\n> branch and thus this normally is a \"fast-forward\" merge.\n> \n> Starting with 2.26 this no longer works because ORIG_HEAD is always\n> set to HEAD after my `git pull`.\n> \n> I track other prances from the same repo where I do local changes and\n> then want the `git pull --rebase` and I thus do not want to\n> give up on the `pull.rebase = true` configuration.\n\nI can imagine this is related to the switch to the \"merge\" backend for\ngit-pull, which may be more eager to overwrite ORIG_HEAD. Perhaps try:\n\n  git -c rebase.backend=apply pull\n\nand see if that behaves differently.\n\nI tried to reproduce what you're seeing, but my recipe doesn't seem to\nshow any difference between the two versions:\n\n-- >8 --\n#!/bin/sh\n\nrm -rf repo\n\ngit init -q repo\ncd repo\necho content >base && git add base && git commit -q -m base\ngit clone -q . dst\necho content >new && git add new && git commit -q -m new\n\ncd dst\ngit rev-parse HEAD >.git/ORIG_HEAD\necho before: $(git log -1 --oneline ORIG_HEAD)\ngit -c pull.rebase=true pull -q ..\necho after: $(git log -1 --oneline ORIG_HEAD)\n-- 8< --\n\nWe don't seem to touch ORIG_HEAD in either case. But maybe a more\ncomplex set of pulled commits would trigger it?\n\n-Peff\n"},{"id":"394018","messageId":"CABPp-BF9LDfaw8=S4yqtuZ5U70Jcj_yZHq17Y7SUa17DwRqMSA@mail.gmail.com","threadId":"53089","inReplyTo":"20200325053908.GC651138@coredump.intra.peff.net","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-03-25T21:21:13Z","receivedAt":"2020-03-25T21:21:28Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Mar 24, 2020 at 10:40 PM Jeff King <peff@peff.net> wrote:\n>\n> On Tue, Mar 24, 2020 at 08:38:04PM -0700, Norbert Kiesel wrote:\n>\n> > I track an upstream repo with \"pull.rebase = true\" where I do a `git\n> > pull` followed by a `git log -p ORIG_HEAD..` for a branch to see\n> > changes since the last \"pull\".  I normally do not commit to this\n> > branch and thus this normally is a \"fast-forward\" merge.\n> >\n> > Starting with 2.26 this no longer works because ORIG_HEAD is always\n> > set to HEAD after my `git pull`.\n> >\n> > I track other prances from the same repo where I do local changes and\n> > then want the `git pull --rebase` and I thus do not want to\n> > give up on the `pull.rebase = true` configuration.\n>\n> I can imagine this is related to the switch to the \"merge\" backend for\n> git-pull, which may be more eager to overwrite ORIG_HEAD. Perhaps try:\n>\n>   git -c rebase.backend=apply pull\n>\n> and see if that behaves differently.\n>\n> I tried to reproduce what you're seeing, but my recipe doesn't seem to\n> show any difference between the two versions:\n>\n> -- >8 --\n> #!/bin/sh\n>\n> rm -rf repo\n>\n> git init -q repo\n> cd repo\n> echo content >base && git add base && git commit -q -m base\n> git clone -q . dst\n> echo content >new && git add new && git commit -q -m new\n>\n> cd dst\n> git rev-parse HEAD >.git/ORIG_HEAD\n> echo before: $(git log -1 --oneline ORIG_HEAD)\n> git -c pull.rebase=true pull -q ..\n> echo after: $(git log -1 --oneline ORIG_HEAD)\n> -- 8< --\n>\n> We don't seem to touch ORIG_HEAD in either case. But maybe a more\n> complex set of pulled commits would trigger it?\n\nI can't duplicate either.  I suspected that perhaps rebase.autoStash\nmight help cause it to happen if you had local changes, but I didn't\nsucceed in reproducing with that either.\n\nNorbert: Any ideas what you may be doing differently to trigger this?\nAnd does it still happen with rebase.backend=apply, as Peff asked\nabout?\n\n\nElijah\n"},{"id":"394037","messageId":"CAM+g_Nvt3X4d5cjKajzDOcoDgNS4bVkj3a0KvVm4yDEW-J7v2w@mail.gmail.com","threadId":"53089","inReplyTo":"CAM+g_NtHC5ukU3jchVfud_H_m_h29UQ8vmwQoND8s_Q9Hv70Fg@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Norbert Kiesel","fromEmail":"nkiesel@gmail.com","sentAt":"2020-03-26T01:37:36Z","receivedAt":"2020-03-26T01:37:53Z","isPatch":false,"sender":{"key":"nkiesel@gmail.com","avatar":null},"body":"I have to wait for a few hours to see more changes in that branch that\nshowed this behavior.\n\nI tried with this branch just now and my repo is in sync with\nupstream.  Nevertheless, I see messages about operations for both\nbackends now for `git pull` which I don't remember seeing before:\n% git status --untracked-files=no\nOn branch nextrelease\nYour branch is up to date with 'origin/nextrelease'.\n\nnothing to commit (use -u to show untracked files)\n% git -c rebase.backend=merge pull\nAlready up to date.\nSuccessfully rebased and updated refs/heads/nextrelease.\n% git -c rebase.backend=apply pull\nAlready up to date.\nFirst, rewinding head to replay your work on top of it...\nFast-forwarded nextrelease to d008080d3f2dc5a9af30067f705a3cb26ed847b3.\n%\n\nWhy is git doing anything if the branch is already up-to-date? The\ncommit it ff to is the HEAD of that branch so I don't think anything\nis really changing. Also, if I use `-c pull.rebase=false` I see what I\nthink is the 2.25 behavior\n\n% git status --untracked-files=no\nOn branch nextrelease\nYour branch is up to date with 'origin/nextrelease'.\n\nnothing to commit (use -u to show untracked files)\n% git -c rebase.backend=merge -c pull.rebase=false pull\nAlready up to date.\n% git -c rebase.backend=apply -c pull.rebase=false pull\nAlready up to date.\n\nI had `pull.rebase=true` configured for quite some time now. And yes,\nI should set it for just this \"never push\" branch instead of for all\nbranches.  I just tried with `-c pull.rebase=false -c\nbranch.nextrelease.rebase=true` and that shows\nthe same behavior as `-c pull.rebase=true`.\n\nOne potential difference: I have tons of untracked files in my working\ndirectory. Could that make a difference?\n\nOn Wed, Mar 25, 2020 at 2:39 PM Norbert Kiesel <nkiesel@gmail.com> wrote:\n>\n> I will try to reproduce and will report back.\n>\n> On Wed, Mar 25, 2020 at 2:21 PM Elijah Newren <newren@gmail.com> wrote:\n>>\n>> On Tue, Mar 24, 2020 at 10:40 PM Jeff King <peff@peff.net> wrote:\n>> >\n>> > On Tue, Mar 24, 2020 at 08:38:04PM -0700, Norbert Kiesel wrote:\n>> >\n>> > > I track an upstream repo with \"pull.rebase = true\" where I do a `git\n>> > > pull` followed by a `git log -p ORIG_HEAD..` for a branch to see\n>> > > changes since the last \"pull\".  I normally do not commit to this\n>> > > branch and thus this normally is a \"fast-forward\" merge.\n>> > >\n>> > > Starting with 2.26 this no longer works because ORIG_HEAD is always\n>> > > set to HEAD after my `git pull`.\n>> > >\n>> > > I track other prances from the same repo where I do local changes and\n>> > > then want the `git pull --rebase` and I thus do not want to\n>> > > give up on the `pull.rebase = true` configuration.\n>> >\n>> > I can imagine this is related to the switch to the \"merge\" backend for\n>> > git-pull, which may be more eager to overwrite ORIG_HEAD. Perhaps try:\n>> >\n>> >   git -c rebase.backend=apply pull\n>> >\n>> > and see if that behaves differently.\n>> >\n>> > I tried to reproduce what you're seeing, but my recipe doesn't seem to\n>> > show any difference between the two versions:\n>> >\n>> > -- >8 --\n>> > #!/bin/sh\n>> >\n>> > rm -rf repo\n>> >\n>> > git init -q repo\n>> > cd repo\n>> > echo content >base && git add base && git commit -q -m base\n>> > git clone -q . dst\n>> > echo content >new && git add new && git commit -q -m new\n>> >\n>> > cd dst\n>> > git rev-parse HEAD >.git/ORIG_HEAD\n>> > echo before: $(git log -1 --oneline ORIG_HEAD)\n>> > git -c pull.rebase=true pull -q ..\n>> > echo after: $(git log -1 --oneline ORIG_HEAD)\n>> > -- 8< --\n>> >\n>> > We don't seem to touch ORIG_HEAD in either case. But maybe a more\n>> > complex set of pulled commits would trigger it?\n>>\n>> I can't duplicate either.  I suspected that perhaps rebase.autoStash\n>> might help cause it to happen if you had local changes, but I didn't\n>> succeed in reproducing with that either.\n>>\n>> Norbert: Any ideas what you may be doing differently to trigger this?\n>> And does it still happen with rebase.backend=apply, as Peff asked\n>> about?\n>>\n>>\n>> Elijah\n"},{"id":"394038","messageId":"CAM+g_NsUfw6zDRj8H1VNdheKFSHgC9gz7nVy0vbtpTKkYzjjtA@mail.gmail.com","threadId":"53089","inReplyTo":"CAM+g_Nvt3X4d5cjKajzDOcoDgNS4bVkj3a0KvVm4yDEW-J7v2w@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Norbert Kiesel","fromEmail":"nkiesel@gmail.com","sentAt":"2020-03-26T01:46:39Z","receivedAt":"2020-03-26T01:46:53Z","isPatch":false,"sender":{"key":"nkiesel@gmail.com","avatar":null},"body":"Here is a concrete example:\n\nlt-nkiesel:~Platform(nextrelease)% git -c rebase.backend=merge -c\npull.rebase=false -c branch.nextrelease.rebase=true pull\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 1 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (1/1), 279 bytes | 279.00 KiB/s, done.\nFrom msgit.rnd.metricstream.com:platform/Platform7\n   d008080d3f2..db4042856da  nextrelease -> origin/nextrelease\nUpdating d008080d3f2..db4042856da\nFast-forward\n modules/bpcsfw/src/main/java/com/metricstream/systemi/client/servlet/servant/BaseViewController.java\n| 54 +++++++++++++++++++++++++-----------------------------\n modules/bpcsfw/src/main/java/com/metricstream/util/HttpUtils.java\n                               |  5 +++++\n 2 files changed, 30 insertions(+), 29 deletions(-)\nSuccessfully rebased and updated refs/heads/nextrelease.\nlt-nkiesel:~Platform(nextrelease)% git rev-parse ORIG_HEAD\ndb4042856da8338f183c831fca92cf63da7988bd\nlt-nkiesel:~Platform(nextrelease)% git rev-parse HEAD\ndb4042856da8338f183c831fca92cf63da7988bd\nlt-nkiesel:~Platform(nextrelease)%\n\nAs you can see, git said \"Fast-forward\" (i.e. no need to rebase) but\nnevertheless after that pull ORIG_HEAD is identical to HEAD\n"},{"id":"394041","messageId":"CABPp-BHMMw+L6fgfdVEEXnhH0w0aK6KfKA9Aq+aSuzWD0Cgr8g@mail.gmail.com","threadId":"53089","inReplyTo":"CAM+g_NsUfw6zDRj8H1VNdheKFSHgC9gz7nVy0vbtpTKkYzjjtA@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-03-26T03:37:22Z","receivedAt":"2020-03-26T03:37:38Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Ooh, the plot thickens...\n\nOn Wed, Mar 25, 2020 at 6:46 PM Norbert Kiesel <nkiesel@gmail.com> wrote:\n>\n> Here is a concrete example:\n>\n> lt-nkiesel:~Platform(nextrelease)% git -c rebase.backend=merge -c\n> pull.rebase=false -c branch.nextrelease.rebase=true pull\n\nSo pull.rebase is false for the general case, but it should be true\nwhen on the nextrelease branch.  Your prompt seems to imply you are on\nthe nextrelease branch, but I'm not so sure because...\n\n> remote: Enumerating objects: 1, done.\n> remote: Counting objects: 100% (1/1), done.\n> remote: Total 1 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (1/1), 279 bytes | 279.00 KiB/s, done.\n> From msgit.rnd.metricstream.com:platform/Platform7\n>    d008080d3f2..db4042856da  nextrelease -> origin/nextrelease\n> Updating d008080d3f2..db4042856da\n> Fast-forward\n\n\"Fast-forward\" is a message from builtin/merge.c, it implies that\nrebase is not invoked at all.  (rebase with the merge backend calls\nmerge-recursive.c, not builtin/merge.c)  This suggests that\npull.$branch.rebase isn't working as we intended.\n\n>  modules/bpcsfw/src/main/java/com/metricstream/systemi/client/servlet/servant/BaseViewController.java\n> | 54 +++++++++++++++++++++++++-----------------------------\n>  modules/bpcsfw/src/main/java/com/metricstream/util/HttpUtils.java\n>                                |  5 +++++\n>  2 files changed, 30 insertions(+), 29 deletions(-)\n\nDiffstats are also off by default for rebases, so unless you've set\nrebase.stat in some config somewhere, this also suggests that a merge\nwas used.\n\n\nNow, when I try to duplicate, just for fun I added some 'die(\"You ran\na merge!\")' and 'die(\"You ran a rebase!\")' lines early in\nbuiltin/{merge,rebase}.c, just so I could verify what was run.  Then I\ntried to use a command line similar to yours:\n\n$ git -c rebase.backend=merge -c pull.rebase=false -c\nbranch.master.rebase=true pull\nremote: Enumerating objects: 5, done.\nremote: Counting objects: 100% (5/5), done.\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (3/3), 250 bytes | 250.00 KiB/s, done.\nFrom /home/newren/floss/git/testing/pull-rebase-orig-head/repo\n   c911eef..2ccdb90  master     -> origin/master\nfatal: You ran a merge!\nfatal: You ran a rebase!\n\n\nSay, WAT?!?  This attempted to run both a merge and a rebase?  That\nappears to be yet another bug.\n\n> Successfully rebased and updated refs/heads/nextrelease.\n> lt-nkiesel:~Platform(nextrelease)% git rev-parse ORIG_HEAD\n> db4042856da8338f183c831fca92cf63da7988bd\n> lt-nkiesel:~Platform(nextrelease)% git rev-parse HEAD\n> db4042856da8338f183c831fca92cf63da7988bd\n> lt-nkiesel:~Platform(nextrelease)%\n>\n> As you can see, git said \"Fast-forward\" (i.e. no need to rebase) but\n> nevertheless after that pull ORIG_HEAD is identical to HEAD\n\nWhen I remove the die() calls that I added, here's what I see:\n\n$ git -c rebase.backend=merge -c pull.rebase=false -c\nbranch.master.rebase=true pull\nremote: Enumerating objects: 5, done.\nremote: Counting objects: 100% (5/5), done.\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (3/3), 251 bytes | 251.00 KiB/s, done.\nFrom /home/newren/floss/git/testing/pull-rebase-orig-head/repo\n   100c273..c911eef  master     -> origin/master\nUpdating 100c273..c911eef\nFast-forward\n numbers | 1 +\n 1 file changed, 1 insertion(+)\nCurrent branch master is up to date.\n\n$ git log --oneline --reverse\n9691d52 initial\n1d5a4c1 add another\n0da5805 add another\nccea292 add another\n100c273 add another\nc911eef (HEAD -> master, origin/master, origin/HEAD) add another\n\n$ git rev-parse --short ORIG_HEAD\n100c273\n\nIn other words, ORIG_HEAD does not match HEAD, it correctly points at\nthe old commit.  So, we found a couple bugs, but I still can't\nduplicate the bug you're reporting.  What else is different about your\nsetup?  What's in your .git/config, and in your $HOME/.gitconfig?\nWhat hooks do you have setup in .git/hooks/ -- do any of them do a\nreset --hard?\n"},{"id":"394052","messageId":"CABPp-BFMN+pnOjEe2tZZJp3_Noojn5j1ip3dh8Xz9hCZoKJbxw@mail.gmail.com","threadId":"53089","inReplyTo":"CABPp-BHMMw+L6fgfdVEEXnhH0w0aK6KfKA9Aq+aSuzWD0Cgr8g@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-03-26T06:32:31Z","receivedAt":"2020-03-26T06:32:45Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Mar 25, 2020 at 8:37 PM Elijah Newren <newren@gmail.com> wrote:\n> Now, when I try to duplicate, just for fun I added some 'die(\"You ran\n> a merge!\")' and 'die(\"You ran a rebase!\")' lines early in\n> builtin/{merge,rebase}.c, just so I could verify what was run.  Then I\n> tried to use a command line similar to yours:\n>\n> $ git -c rebase.backend=merge -c pull.rebase=false -c\n> branch.master.rebase=true pull\n> remote: Enumerating objects: 5, done.\n> remote: Counting objects: 100% (5/5), done.\n> remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\n> Unpacking objects: 100% (3/3), 250 bytes | 250.00 KiB/s, done.\n> From /home/newren/floss/git/testing/pull-rebase-orig-head/repo\n>    c911eef..2ccdb90  master     -> origin/master\n> fatal: You ran a merge!\n> fatal: You ran a rebase!\n>\n>\n> Say, WAT?!?  This attempted to run both a merge and a rebase?  That\n> appears to be yet another bug.\n\nFrom git-pull.c:\n\n    ...\n        if (is_descendant_of(merge_head, list)) {\n            /* we can fast-forward this without invoking rebase */\n            opt_ff = \"--ff-only\";\n            ret = run_merge();\n        }\n    }\n    ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);\n\nPerhaps that comment should read:\n\n   /* we can fast-forward this using merge and avoid rebase...but then\nrun rebase afterward anyway! */\n\nWhoops.  Perhaps fixing this is a good micro-project candidate?  Too small?\n"},{"id":"394053","messageId":"20200326072840.GA2198456@coredump.intra.peff.net","threadId":"53089","inReplyTo":"CABPp-BFMN+pnOjEe2tZZJp3_Noojn5j1ip3dh8Xz9hCZoKJbxw@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-03-26T07:28:40Z","receivedAt":"2020-03-26T07:28:44Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 25, 2020 at 11:32:31PM -0700, Elijah Newren wrote:\n\n> > Say, WAT?!?  This attempted to run both a merge and a rebase?  That\n> > appears to be yet another bug.\n> \n> From git-pull.c:\n> \n>     ...\n>         if (is_descendant_of(merge_head, list)) {\n>             /* we can fast-forward this without invoking rebase */\n>             opt_ff = \"--ff-only\";\n>             ret = run_merge();\n>         }\n>     }\n>     ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);\n> \n> Perhaps that comment should read:\n> \n>    /* we can fast-forward this using merge and avoid rebase...but then\n> run rebase afterward anyway! */\n> \n> Whoops.  Perhaps fixing this is a good micro-project candidate?  Too small?\n\nGood find. :) Looks like this is due to a6d7eb2c7a (pull: optionally\nrebase submodules (remote submodule changes only), 2017-06-23) which\nchanged the early return to \"ret =\".\n\nI think it would be an OK size for a micro-project, but it seems like a\nbug which we may want fixed sooner rather than waiting for somebody to\npick it up from the micro-project pile.\n\nOr perhaps not. AFAICT this has been there for 2+ years without anybody\nnoticing.\n\n-Peff\n"},{"id":"394181","messageId":"CAM+g_NtV5iUM=VJHOX7Um2DFLzjq-x76TYa_P_U6q5HBRmCY=A@mail.gmail.com","threadId":"53089","inReplyTo":"CAM+g_NthmmJh3=Tp3ea6PmDr1h2-WtpiSTO8q02V3judc9p-Kg@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Norbert Kiesel","fromEmail":"nkiesel@gmail.com","sentAt":"2020-03-27T18:01:30Z","receivedAt":"2020-03-27T18:01:44Z","isPatch":false,"sender":{"key":"nkiesel@gmail.com","avatar":null},"body":"I ran a \"pull\" today morning w/o sufficient coffee and thus forgot to\ndisable the \"pull.rebase\" and was bitten by that again.  Here is what\nI see when using \"GIT_TRACE2=1 git -c pull.rebase=true pull\n--ff-only\":\n...\n10:54:50.578673 run-command.c:735                 child_start[2] git\nmerge --ff-only FETCH_HEAD\n10:54:50.580385 common-main.c:48                  version 2.26.0\n10:54:50.580404 common-main.c:49                  start\n/usr/lib/git-core/git merge --ff-only FETCH_HEAD\n10:54:50.580587 repository.c:130                  worktree\n/home/nkiesel/work/Platform\n10:54:50.580785 git.c:440                         cmd_name merge (pull/merge)\nAlready up to date.\n10:54:50.589803 git.c:674                         exit elapsed:0.009835 code:0\n10:54:50.589827 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.009874 code:0\n10:54:50.590887 run-command.c:990                 child_exit[2]\npid:939370 code:0 elapsed:0.012205\n10:54:50.590919 run-command.c:735                 child_start[3] git\nrebase --onto d0527895a4df44f00162b68011b803e597fd400f\nd0527895a4df44f00162b68011b803e597fd400f\n10:54:50.592396 common-main.c:48                  version 2.26.0\n10:54:50.592412 common-main.c:49                  start\n/usr/lib/git-core/git rebase --onto\nd0527895a4df44f00162b68011b803e597fd400f\nd0527895a4df44f00162b68011b803e597fd400f\n10:54:50.592568 repository.c:130                  worktree\n/home/nkiesel/work/Platform\n10:54:50.592714 git.c:440                         cmd_name rebase (pull/rebase)\n10:54:50.593142 builtin/rebase.c:1669             cmd_mode undefined\n10:54:50.614154 run-command.c:735                 child_start[0] git\ncheckout d0527895a4df44f00162b68011b803e597fd400f\n10:54:50.678813 run-command.c:990                 child_exit[0]\npid:939392 code:0 elapsed:0.064656\nSuccessfully rebased and updated refs/heads/nextrelease.\n10:54:50.697724 git.c:674                         exit elapsed:0.105715 code:0\n10:54:50.697734 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.105729 code:0\n10:54:50.698307 run-command.c:990                 child_exit[3]\npid:939371 code:0 elapsed:0.107373\n10:54:50.698343 git.c:674                         exit elapsed:5.904200 code:0\n10:54:50.698354 trace2/tr2_tgt_normal.c:123       atexit elapsed:5.904211 code:0\n\nI would argue that \"--ff-only\" would mean to never rebase, but clearly\ngit runs a rebase of HEAD onto HEAD and i assume by that setting\nORIG_HEAD to HEAD as colloquial damage.\n"},{"id":"394186","messageId":"CABPp-BHihQjMc9qugVtVTZVduRxLYUAhf18R5c=3Lb5bcRzjAw@mail.gmail.com","threadId":"53089","inReplyTo":"CAM+g_NtV5iUM=VJHOX7Um2DFLzjq-x76TYa_P_U6q5HBRmCY=A@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-03-27T18:34:36Z","receivedAt":"2020-03-27T18:34:50Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 27, 2020 at 11:01 AM Norbert Kiesel <nkiesel@gmail.com> wrote:\n>\n> I ran a \"pull\" today morning w/o sufficient coffee and thus forgot to\n> disable the \"pull.rebase\" and was bitten by that again.  Here is what\n> I see when using \"GIT_TRACE2=1 git -c pull.rebase=true pull\n> --ff-only\":\n> ...\n> 10:54:50.578673 run-command.c:735                 child_start[2] git\n> merge --ff-only FETCH_HEAD\n> 10:54:50.580385 common-main.c:48                  version 2.26.0\n> 10:54:50.580404 common-main.c:49                  start\n> /usr/lib/git-core/git merge --ff-only FETCH_HEAD\n> 10:54:50.580587 repository.c:130                  worktree\n> /home/nkiesel/work/Platform\n> 10:54:50.580785 git.c:440                         cmd_name merge (pull/merge)\n> Already up to date.\n> 10:54:50.589803 git.c:674                         exit elapsed:0.009835 code:0\n> 10:54:50.589827 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.009874 code:0\n> 10:54:50.590887 run-command.c:990                 child_exit[2]\n> pid:939370 code:0 elapsed:0.012205\n> 10:54:50.590919 run-command.c:735                 child_start[3] git\n> rebase --onto d0527895a4df44f00162b68011b803e597fd400f\n> d0527895a4df44f00162b68011b803e597fd400f\n> 10:54:50.592396 common-main.c:48                  version 2.26.0\n> 10:54:50.592412 common-main.c:49                  start\n> /usr/lib/git-core/git rebase --onto\n> d0527895a4df44f00162b68011b803e597fd400f\n> d0527895a4df44f00162b68011b803e597fd400f\n> 10:54:50.592568 repository.c:130                  worktree\n> /home/nkiesel/work/Platform\n> 10:54:50.592714 git.c:440                         cmd_name rebase (pull/rebase)\n> 10:54:50.593142 builtin/rebase.c:1669             cmd_mode undefined\n> 10:54:50.614154 run-command.c:735                 child_start[0] git\n> checkout d0527895a4df44f00162b68011b803e597fd400f\n> 10:54:50.678813 run-command.c:990                 child_exit[0]\n> pid:939392 code:0 elapsed:0.064656\n> Successfully rebased and updated refs/heads/nextrelease.\n> 10:54:50.697724 git.c:674                         exit elapsed:0.105715 code:0\n> 10:54:50.697734 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.105729 code:0\n> 10:54:50.698307 run-command.c:990                 child_exit[3]\n> pid:939371 code:0 elapsed:0.107373\n> 10:54:50.698343 git.c:674                         exit elapsed:5.904200 code:0\n> 10:54:50.698354 trace2/tr2_tgt_normal.c:123       atexit elapsed:5.904211 code:0\n>\n> I would argue that \"--ff-only\" would mean to never rebase, but clearly\n> git runs a rebase of HEAD onto HEAD and i assume by that setting\n> ORIG_HEAD to HEAD as colloquial damage.\n\nWhen I run the exact same command in my test repo, I see:\n\n[newren@tiger clone]$ GIT_TRACE2=1 git -c pull.rebase=true pull --ff-only\n11:13:16.376197 common-main.c:48                  version 2.26.0\n11:13:16.376228 common-main.c:49                  start\n/home/newren/floss/git/git -c pull.rebase=true pull --ff-only\n11:13:16.376457 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.376605 git.c:440                         cmd_name pull (pull)\n11:13:16.378095 run-command.c:735                 child_start[0] git\nmerge-base --fork-point refs/remotes/origin/master master\n11:13:16.380766 run-command.c:990                 child_exit[0]\npid:1247445 code:0 elapsed:0.002662\n11:13:16.380827 run-command.c:735                 child_start[1] git\nfetch --update-head-ok\n11:13:16.382368 common-main.c:48                  version 2.26.0\n11:13:16.382388 common-main.c:49                  start\n/home/newren/floss/git/git fetch --update-head-ok\n11:13:16.382493 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.382579 git.c:440                         cmd_name fetch (pull/fetch)\n11:13:16.383141 run-command.c:735                 child_start[0]\n'git-upload-pack\n'\\''/home/newren/floss/git/testing/pull-rebase-orig-head/repo/'\\'''\n11:13:16.386079 common-main.c:48                  version 2.26.0\n11:13:16.386096 common-main.c:49                  start\ngit-upload-pack\n/home/newren/floss/git/testing/pull-rebase-orig-head/repo/\n11:13:16.386119 git.c:440                         cmd_name upload-pack\n(pull/fetch/upload-pack)\n11:13:16.388828 run-command.c:735                 child_start[0] git\npack-objects --revs --thin --stdout --progress --delta-base-offset\n--include-tag\nremote: 11:13:16.390448 common-main.c:48                  version 2.26.0\nremote: 11:13:16.390464 common-main.c:49                  start\n/home/newren/floss/git/git pack-objects --revs --thin --stdout\n--progress --delta-base-offset --include-tag\nremote: 11:13:16.390554 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/repo/.git\nremote: 11:13:16.390670 git.c:440                         cmd_name\npack-objects (pull/fetch/upload-pack/pack-objects)\nremote: Enumerating objects: 5, done.\nremote: Counting objects: 100% (5/5), done.\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0\n11:13:16.392266 run-command.c:735                 child_start[1] git\nunpack-objects --pack_header=2,3\nremote: 11:13:16.392261 git.c:674                         exit\nelapsed:0.002147 code:0\nremote: 11:13:16.392274 trace2/tr2_tgt_normal.c:123       atexit\nelapsed:0.002162 code:0\n11:13:16.392507 run-command.c:990                 child_exit[0]\npid:1247449 code:0 elapsed:0.003677\n11:13:16.393548 common-main.c:48                  version 2.26.0\n11:13:16.393560 common-main.c:49                  start\n/home/newren/floss/git/git unpack-objects --pack_header=2,3\n11:13:16.393691 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.393832 git.c:440                         cmd_name\nunpack-objects (pull/fetch/unpack-objects)\nUnpacking objects: 100% (3/3), 252 bytes | 252.00 KiB/s, done.\n11:13:16.394854 git.c:674                         exit elapsed:0.001576 code:0\n11:13:16.394865 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.001588 code:0\n11:13:16.395069 run-command.c:990                 child_exit[1]\npid:1247450 code:0 elapsed:0.002802\n11:13:16.395157 git.c:674                         exit elapsed:0.009406 code:0\n11:13:16.395176 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.009429 code:0\n11:13:16.395394 run-command.c:990                 child_exit[0]\npid:1247447 code:0 elapsed:0.012252\n11:13:16.395476 run-command.c:735                 child_start[2] git\nrev-list --objects --stdin --not --all --quiet --alternate-refs\n11:13:16.396725 common-main.c:48                  version 2.26.0\n11:13:16.396738 common-main.c:49                  start\n/home/newren/floss/git/git rev-list --objects --stdin --not --all\n--quiet --alternate-refs\n11:13:16.396855 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.396927 git.c:440                         cmd_name rev-list\n(pull/fetch/rev-list)\n11:13:16.397946 git.c:674                         exit elapsed:0.001493 code:0\n11:13:16.397959 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.001511 code:0\n11:13:16.398176 run-command.c:990                 child_exit[2]\npid:1247451 code:0 elapsed:0.002694\nFrom /home/newren/floss/git/testing/pull-rebase-orig-head/repo\n   2ccdb90..2c21563  master     -> origin/master\n11:13:16.399051 run-command.c:735                 child_start[3] git gc --auto\n11:13:16.400295 common-main.c:48                  version 2.26.0\n11:13:16.400309 common-main.c:49                  start\n/home/newren/floss/git/git gc --auto\n11:13:16.400413 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.400508 git.c:440                         cmd_name gc (pull/fetch/gc)\n11:13:16.400708 git.c:674                         exit elapsed:0.000696 code:0\n11:13:16.400719 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.000708 code:0\n11:13:16.400909 run-command.c:990                 child_exit[3]\npid:1247452 code:0 elapsed:0.001853\n11:13:16.400939 git.c:674                         exit elapsed:0.018943 code:0\n11:13:16.400958 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.018962 code:0\n11:13:16.401150 run-command.c:990                 child_exit[1]\npid:1247446 code:0 elapsed:0.020317\n11:13:16.401475 run-command.c:735                 child_start[2] git\nmerge --ff-only FETCH_HEAD\n11:13:16.402718 common-main.c:48                  version 2.26.0\n11:13:16.402735 common-main.c:49                  start\n/home/newren/floss/git/git merge --ff-only FETCH_HEAD\n11:13:16.402854 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.402953 git.c:440                         cmd_name merge (pull/merge)\nUpdating 2ccdb90..2c21563\nFast-forward\n11:13:16.404582 run-command.c:735                 child_start[0] git gc --auto\n11:13:16.406161 common-main.c:48                  version 2.26.0\n11:13:16.406178 common-main.c:49                  start\n/home/newren/floss/git/git gc --auto\n11:13:16.406301 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.406395 git.c:440                         cmd_name gc (pull/merge/gc)\n11:13:16.406663 git.c:674                         exit elapsed:0.000929 code:0\n11:13:16.406680 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.000950 code:0\n11:13:16.406934 run-command.c:990                 child_exit[0]\npid:1247454 code:0 elapsed:0.002345\n numbers | 1 +\n 1 file changed, 1 insertion(+)\n11:13:16.407320 git.c:674                         exit elapsed:0.004889 code:0\n11:13:16.407336 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.004907 code:0\n11:13:16.407556 run-command.c:990                 child_exit[2]\npid:1247453 code:0 elapsed:0.006076\n11:13:16.407617 run-command.c:735                 child_start[3] git\nrebase --onto 2c21563a2dd61db0a502100ce1da5b6b0ecf8337\n2c21563a2dd61db0a502100ce1da5b6b0ecf8337\n11:13:16.409886 common-main.c:48                  version 2.26.0\n11:13:16.409917 common-main.c:49                  start\n/home/newren/floss/git/git rebase --onto\n2c21563a2dd61db0a502100ce1da5b6b0ecf8337\n2c21563a2dd61db0a502100ce1da5b6b0ecf8337\n11:13:16.410166 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.410402 git.c:440                         cmd_name rebase (pull/rebase)\n11:13:16.410705 builtin/rebase.c:1669             cmd_mode undefined\nCurrent branch master is up to date.\n11:13:16.412385 run-command.c:735                 child_start[0] git gc --auto\n11:13:16.413967 common-main.c:48                  version 2.26.0\n11:13:16.413983 common-main.c:49                  start\n/home/newren/floss/git/git gc --auto\n11:13:16.414075 repository.c:130                  worktree\n/home/newren/floss/git/testing/pull-rebase-orig-head/clone\n11:13:16.414152 git.c:440                         cmd_name gc (pull/rebase/gc)\n11:13:16.414363 git.c:674                         exit elapsed:0.000748 code:0\n11:13:16.414375 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.000763 code:0\n11:13:16.414607 run-command.c:990                 child_exit[0]\npid:1247456 code:0 elapsed:0.002218\n11:13:16.414690 git.c:674                         exit elapsed:0.005410 code:0\n11:13:16.414720 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.005441 code:0\n11:13:16.414925 run-command.c:990                 child_exit[3]\npid:1247455 code:0 elapsed:0.007305\n11:13:16.414984 git.c:674                         exit elapsed:0.039375 code:0\n11:13:16.415023 trace2/tr2_tgt_normal.c:123       atexit elapsed:0.039415 code:0\n\nSo there is no checkout for me; and while it's a useful hint it's not\nyet clear to me why you have one.  Anyway, on my side:\n\n$ git log --oneline --reverse; git rev-parse --short ORIG_HEAD\n9691d52 initial\n1d5a4c1 add another\n0da5805 add another\nccea292 add another\n100c273 add another\nc911eef add another\n2ccdb90 add another\n2c21563 (HEAD -> master, origin/master, origin/HEAD) add another\n2ccdb90\n\n\nSo, I'll repeat the same questions I asked last time, and see if you\nwill answer them this time:\n\nWhat's in your .git/config, and in your $HOME/.gitconfig?  (Or maybe\njust the output of 'git config --list'?)\nWhat hooks do you have setup in .git/hooks/?\n"},{"id":"394195","messageId":"CABPp-BGKeUeMCaOt2b6j1kqgbeTDJxYjRxAPdM+=JB6V1r4EpA@mail.gmail.com","threadId":"53089","inReplyTo":"CABPp-BHihQjMc9qugVtVTZVduRxLYUAhf18R5c=3Lb5bcRzjAw@mail.gmail.com","subject":"Re: \"git rebase\" behavior change in 2.26.0","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-03-27T20:59:31Z","receivedAt":"2020-03-27T20:59:46Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 27, 2020 at 11:34 AM Elijah Newren <newren@gmail.com> wrote:\n>\n> On Fri, Mar 27, 2020 at 11:01 AM Norbert Kiesel <nkiesel@gmail.com> wrote:\n> >\n...\n> What's in your .git/config, and in your $HOME/.gitconfig?  (Or maybe\n> just the output of 'git config --list'?)\n> What hooks do you have setup in .git/hooks/?\n\nAfter some off-thread discussion due to concerns with sharing his\nconfiguration globally...\n\nAhah, so I can duplicate when using both pull.rebase=true and\nrebase.autosquash=true.  rebase.autosquash in the rebase code sets\nallow_preemptive_ff to 0, meaning it disables rebase from\nfast-forwarding.  That would have been fine if we only ran a rebase,\nbut we ran both a merge and a rebase and thus updated ORIG_HEAD\n*twice*.  So, the \"extra\" bug I found upthread (pull runs both merge\nand rebase for a fast-forward) isn't an extra bug but is *the* bug in\nquestion.  It's been with us for a few years as Jeff pointed out, but\njust was uncovered due to the other recent 2.26 changes.  Patch\nincoming soon.\n"}]}