{"thread":{"id":"56902","subject":"git pull bug report","startedAt":"2021-11-15T08:42:44Z","lastAt":"2021-11-16T04:42:15Z","messageCount":11,"participants":["Erwin Villejo","Bagas Sanjaya","Junio C Hamano","Bryan Turner"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"441118","messageId":"CADL96rvRX2R_4Wm23tz88hDUztcpK531RU+Ops2UVoiOW0bCHw@mail.gmail.com","threadId":"56902","inReplyTo":null,"subject":"git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-15T08:42:15Z","receivedAt":"2021-11-15T08:42:44Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"> What did you do before the bug happened? (Steps to reproduce your issue)\n* make local changes, stage, and commit\n* local is ahead of upstream. confirmed by `git status`:\n\n```\n$ git status\nOn branch main\nYour branch is ahead of 'github/main' by 1 commit.\n  (use \"git push\" to publish your local commits)\n```\n\n* try to pull upstream to local\n\n> What did you expect to happen? (Expected behavior)\nNo-op (and NO failure) since local is ahead of upstream.\n\n> What happened instead? (Actual behavior)\n`git pull` fails with error:\n\n```\n$ git pull\nhint: You have divergent branches and need to specify how to reconcile them.\nhint: You can do so by running one of the following commands sometime before\nhint: your next pull:\nhint:\nhint:   git config pull.rebase false  # merge (the default strategy)\nhint:   git config pull.rebase true   # rebase\nhint:   git config pull.ff only       # fast-forward only\nhint:\nhint: You can replace \"git config\" with \"git config --global\" to set a default\nhint: preference for all repositories. You can also pass --rebase, --no-rebase,\nhint: or --ff-only on the command line to override the configured default per\nhint: invocation.\nfatal: Need to specify how to reconcile divergent branches.\n```\n\n> What's different between what you expected and what actually happened?\nI expected no failure and no-op since local is ahead of upstream.\nInstead, `git pull`\nfails because it thinks the branches have diverged.\n\n> Anything else you want to add:\nI found this bug in VSCode. VSCode runs `git pull` first before `git\npush` when pushing to upstream.\nThis bug causes pushing via VSCode to always fail, although it can be\nworked around by simply opening\na terminal and running `git push` manually.\n\n[System Info]\ngit version:\ngit version 2.33.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.15.2-arch1-1 #1 SMP PREEMPT Fri, 12 Nov 2021 19:22:10\n+0000 x86_64\ncompiler info: gnuc: 11.1\nlibc info: glibc: 2.33\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n\nBest regards,\nErwin\n"},{"id":"441119","messageId":"30188556-935e-f5cf-c9e0-4ff8a528e5d8@gmail.com","threadId":"56902","inReplyTo":"CADL96rvRX2R_4Wm23tz88hDUztcpK531RU+Ops2UVoiOW0bCHw@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-11-15T08:54:41Z","receivedAt":"2021-11-15T08:55:03Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 15/11/21 15.42, Erwin Villejo wrote:\n>> What did you do before the bug happened? (Steps to reproduce your issue)\n> * make local changes, stage, and commit\n> * local is ahead of upstream. confirmed by `git status`:\n> \n> ```\n> $ git status\n> On branch main\n> Your branch is ahead of 'github/main' by 1 commit.\n>    (use \"git push\" to publish your local commits)\n> ```\n> \n> * try to pull upstream to local\n> \n>> What did you expect to happen? (Expected behavior)\n> No-op (and NO failure) since local is ahead of upstream.\n> \n>> What happened instead? (Actual behavior)\n> `git pull` fails with error:\n> \n> ```\n> $ git pull\n> hint: You have divergent branches and need to specify how to reconcile them.\n> hint: You can do so by running one of the following commands sometime before\n> hint: your next pull:\n> hint:\n> hint:   git config pull.rebase false  # merge (the default strategy)\n> hint:   git config pull.rebase true   # rebase\n> hint:   git config pull.ff only       # fast-forward only\n> hint:\n> hint: You can replace \"git config\" with \"git config --global\" to set a default\n> hint: preference for all repositories. You can also pass --rebase, --no-rebase,\n> hint: or --ff-only on the command line to override the configured default per\n> hint: invocation.\n> fatal: Need to specify how to reconcile divergent branches.\n> ```\n> \n>> What's different between what you expected and what actually happened?\n> I expected no failure and no-op since local is ahead of upstream.\n> Instead, `git pull`\n> fails because it thinks the branches have diverged.\n> \n>> Anything else you want to add:\n> I found this bug in VSCode. VSCode runs `git pull` first before `git\n> push` when pushing to upstream.\n> This bug causes pushing via VSCode to always fail, although it can be\n> worked around by simply opening\n> a terminal and running `git push` manually.\n\nYou need to do the prompt above, so not a bug.\n\nWhen reconciling, do you want merge or rebase?\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"441120","messageId":"CADL96rvWidDUEChJX8JCruUKjaOWqXrZn6-sG0EYb82_k_LTsA@mail.gmail.com","threadId":"56902","inReplyTo":"30188556-935e-f5cf-c9e0-4ff8a528e5d8@gmail.com","subject":"Re: git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-15T08:56:29Z","receivedAt":"2021-11-15T08:58:42Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"There is nothing to reconcile since the branches have not diverged:\nlocal is ahead of upstream. So I think it is a bug, no?\n\nBest regards,\nErwin\n\nOn Mon, Nov 15, 2021 at 3:54 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n>\n> On 15/11/21 15.42, Erwin Villejo wrote:\n> >> What did you do before the bug happened? (Steps to reproduce your issue)\n> > * make local changes, stage, and commit\n> > * local is ahead of upstream. confirmed by `git status`:\n> >\n> > ```\n> > $ git status\n> > On branch main\n> > Your branch is ahead of 'github/main' by 1 commit.\n> >    (use \"git push\" to publish your local commits)\n> > ```\n> >\n> > * try to pull upstream to local\n> >\n> >> What did you expect to happen? (Expected behavior)\n> > No-op (and NO failure) since local is ahead of upstream.\n> >\n> >> What happened instead? (Actual behavior)\n> > `git pull` fails with error:\n> >\n> > ```\n> > $ git pull\n> > hint: You have divergent branches and need to specify how to reconcile them.\n> > hint: You can do so by running one of the following commands sometime before\n> > hint: your next pull:\n> > hint:\n> > hint:   git config pull.rebase false  # merge (the default strategy)\n> > hint:   git config pull.rebase true   # rebase\n> > hint:   git config pull.ff only       # fast-forward only\n> > hint:\n> > hint: You can replace \"git config\" with \"git config --global\" to set a default\n> > hint: preference for all repositories. You can also pass --rebase, --no-rebase,\n> > hint: or --ff-only on the command line to override the configured default per\n> > hint: invocation.\n> > fatal: Need to specify how to reconcile divergent branches.\n> > ```\n> >\n> >> What's different between what you expected and what actually happened?\n> > I expected no failure and no-op since local is ahead of upstream.\n> > Instead, `git pull`\n> > fails because it thinks the branches have diverged.\n> >\n> >> Anything else you want to add:\n> > I found this bug in VSCode. VSCode runs `git pull` first before `git\n> > push` when pushing to upstream.\n> > This bug causes pushing via VSCode to always fail, although it can be\n> > worked around by simply opening\n> > a terminal and running `git push` manually.\n>\n> You need to do the prompt above, so not a bug.\n>\n> When reconciling, do you want merge or rebase?\n>\n> --\n> An old man doll... just what I always wanted! - Clara\n"},{"id":"441121","messageId":"0bd032c1-f90b-1892-693c-518a01b3b671@gmail.com","threadId":"56902","inReplyTo":"CADL96rvWidDUEChJX8JCruUKjaOWqXrZn6-sG0EYb82_k_LTsA@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-11-15T09:12:24Z","receivedAt":"2021-11-15T09:12:50Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 15/11/21 15.56, Erwin Villejo wrote:\n> There is nothing to reconcile since the branches have not diverged:\n> local is ahead of upstream. So I think it is a bug, no?\n\nYou have the situation like:\n\n---o---a (your mainline)\n    \\\n     b---c---d (remote mainline)\n\nYour mainline only have one commit ahead of base point `o`, while the remote \nmainline have three commits ahead of `o` but unrelated. In this sense, your and \nremote mainline is divergent - you need to either merge or rebase.\n\nNext time, keep your mainline pristine (don't commit any local changes on it, \ninstead branch to the topic branch and commit there).\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"441122","messageId":"CADL96rs0M15E+CnycBsDqGbiibDFx4KeMthLspQH1=Bw3PS3gg@mail.gmail.com","threadId":"56902","inReplyTo":"0bd032c1-f90b-1892-693c-518a01b3b671@gmail.com","subject":"Re: git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-15T09:19:38Z","receivedAt":"2021-11-15T09:21:08Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"> the remote mainline have three commits ahead\nWhere did you get this info? This is not true in my case.\n\n* local is ahead of upstream. confirmed by `git status`:\n\n```\n$ git status\nOn branch main\nYour branch is ahead of 'github/main' by 1 commit.\n  (use \"git push\" to publish your local commits)\n```\n\nIf remote was ahead, `git status` would say so. And this is my\npersonal repo in GitHub with only me as the sole developer/contributor\nso I can assure you that the upstream has no commits ahead of my\nlocal.\n\nBest regards,\nErwin\n\nOn Mon, Nov 15, 2021 at 4:12 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n>\n> On 15/11/21 15.56, Erwin Villejo wrote:\n> > There is nothing to reconcile since the branches have not diverged:\n> > local is ahead of upstream. So I think it is a bug, no?\n>\n> You have the situation like:\n>\n> ---o---a (your mainline)\n>     \\\n>      b---c---d (remote mainline)\n>\n> Your mainline only have one commit ahead of base point `o`, while the remote\n> mainline have three commits ahead of `o` but unrelated. In this sense, your and\n> remote mainline is divergent - you need to either merge or rebase.\n>\n> Next time, keep your mainline pristine (don't commit any local changes on it,\n> instead branch to the topic branch and commit there).\n>\n> --\n> An old man doll... just what I always wanted! - Clara\n"},{"id":"441123","messageId":"CADL96rtX_uw6fJEVq2u9bkPNhYXwaGT13F+cMiGgZrHQr5TP7A@mail.gmail.com","threadId":"56902","inReplyTo":"CADL96rs0M15E+CnycBsDqGbiibDFx4KeMthLspQH1=Bw3PS3gg@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-15T09:39:26Z","receivedAt":"2021-11-15T09:40:07Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"$ git log main github/main --graph --decorate -n 3\n* commit b73d3e132f9638afbf5b98b0c278ed6b93a3ae50 (HEAD -> main)\n| Author: Erwin Villejo <erwin.villejo@gmail.com>\n| Date:   Mon Nov 15 15:22:53 2021 +0700\n|\n|     init activity api\n|\n* commit d370bf256a756a777c14609c8ad4184aa7e9e60f (github/main)\n| Author: Erwin Villejo <erwin.villejo@gmail.com>\n| Date:   Sat Nov 13 19:18:45 2021 +0700\n|\n|     refactor partitioning migration\n|\n* commit 5124511d287f1a6c384ff9766fdcc0e3e07043e8\n| Author: Erwin Villejo <erwin.villejo@gmail.com>\n| Date:   Mon Nov 8 17:24:19 2021 +0700\n|\n|     wip pg\n\n$ git remote -v\ngithub    git@github.com:erwinv/database-sandbox.git (fetch)\ngithub    git@github.com:erwinv/database-sandbox.git (push)\n\nLink to the [upstream branch on\nGitHub](https://github.com/erwinv/database-sandbox/commits/main) so\nyou could see for yourself that my local is ahead of upstream and that\nthe upstream has no commits ahead of local.\n\nBest regards,\nErwin\n\n\nOn Mon, Nov 15, 2021 at 4:19 PM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n>\n> > the remote mainline have three commits ahead\n> Where did you get this info? This is not true in my case.\n>\n> * local is ahead of upstream. confirmed by `git status`:\n>\n> ```\n> $ git status\n> On branch main\n> Your branch is ahead of 'github/main' by 1 commit.\n>   (use \"git push\" to publish your local commits)\n> ```\n>\n> If remote was ahead, `git status` would say so. And this is my\n> personal repo in GitHub with only me as the sole developer/contributor\n> so I can assure you that the upstream has no commits ahead of my\n> local.\n>\n> Best regards,\n> Erwin\n>\n> On Mon, Nov 15, 2021 at 4:12 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n> >\n> > On 15/11/21 15.56, Erwin Villejo wrote:\n> > > There is nothing to reconcile since the branches have not diverged:\n> > > local is ahead of upstream. So I think it is a bug, no?\n> >\n> > You have the situation like:\n> >\n> > ---o---a (your mainline)\n> >     \\\n> >      b---c---d (remote mainline)\n> >\n> > Your mainline only have one commit ahead of base point `o`, while the remote\n> > mainline have three commits ahead of `o` but unrelated. In this sense, your and\n> > remote mainline is divergent - you need to either merge or rebase.\n> >\n> > Next time, keep your mainline pristine (don't commit any local changes on it,\n> > instead branch to the topic branch and commit there).\n> >\n> > --\n> > An old man doll... just what I always wanted! - Clara\n"},{"id":"441160","messageId":"xmqqfsrxdufe.fsf@gitster.g","threadId":"56902","inReplyTo":"CADL96rvRX2R_4Wm23tz88hDUztcpK531RU+Ops2UVoiOW0bCHw@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-11-15T20:40:21Z","receivedAt":"2021-11-15T21:23:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erwin Villejo <erwinvillejo@gmail.com> writes:\n\n> $ git pull\n> hint: You have divergent branches and need to specify how to reconcile them.\n> ...\n> hint: invocation.\n> fatal: Need to specify how to reconcile divergent branches.\n> ```\n>\n>> What's different between what you expected and what actually happened?\n> I expected no failure and no-op since local is ahead of upstream.\n> Instead, `git pull`\n> fails because it thinks the branches have diverged.\n\nI think this was fixed at 361cb523 (pull: --ff-only should make it a\nnoop when already-up-to-date, 2021-10-20); it was broken between Git\n2.33 and Git 2.33.1, IIRC.\n\nThanks.\n"},{"id":"441216","messageId":"CADL96rt-UiPkezYBWwFk--Fy0ekUYy7DzUfhpSXwo6E+2VNbBw@mail.gmail.com","threadId":"56902","inReplyTo":"CAGyf7-GjoU7VqN3bhRcoQ1xJM==h2aNm9fm_5HxDJk_hgGop1Q@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-15T18:22:18Z","receivedAt":"2021-11-16T00:41:56Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"Sure, if you insist:\n```\n I  ~/c/database-sandbox main ↑1 ❱ git fetch\n I  ~/c/database-sandbox main ↑1 3.3s ❱ git log --graph --oneline\n--decorate main github/main -n 3\n* b73d3e1 (HEAD -> main) init activity api\n* d370bf2 (github/main) refactor partitioning migration\n* 5124511 wip pg\n I  ~/c/database-sandbox main ↑1 ❱ git status\nOn branch main\nYour branch is ahead of 'github/main' by 1 commit.\n  (use \"git push\" to publish your local commits)\n\nnothing to commit, working tree clean\n I  ~/c/database-sandbox main ↑1 ❱\n```\n\nI did some more investigation:\n\n```\n I  ~/c/database-sandbox main ↑1 ❱ git pull --ff-only\nfatal: Not possible to fast-forward, aborting.\n I  ~/c/database-sandbox main ↑1 3.4s [128] git pull --ff\nAlready up to date.\n I  ~/c/database-sandbox main ↑1 3.3s ❱ git pull\nhint: You have divergent branches and need to specify how to reconcile them.\nhint: You can do so by running one of the following commands sometime before\nhint: your next pull:\nhint:\nhint:   git config pull.rebase false  # merge (the default strategy)\nhint:   git config pull.rebase true   # rebase\nhint:   git config pull.ff only       # fast-forward only\nhint:\nhint: You can replace \"git config\" with \"git config --global\" to set a default\nhint: preference for all repositories. You can also pass --rebase, --no-rebase,\nhint: or --ff-only on the command line to override the configured default per\nhint: invocation.\nfatal: Need to specify how to reconcile divergent branches.\n I  ~/c/database-sandbox main ↑1 3.3s [128]\n```\n\nAs you can see above:\n- `pull --ff-only` aborts with \"Not possible to fast-forward\" error\n- `pull --ff` succeeds with \"Already up to date.\"\n- `pull` only (unspecified `--ff`) aborts with \"divergent branches\"\n\nThe --ff-only case was recently fixed by\nhttps://github.com/git/git/commit/361cb52383fb986f76a34506bdec9a1dd11133f0\n\nThe unspecified `--ff` is the bug that I encounter and I have started\na fix here: https://github.com/git/git/compare/master...erwinv:master\n\nBest regards,\nErwin\n\nOn Tue, Nov 16, 2021 at 1:15 AM Bryan Turner <bturner@atlassian.com> wrote:\n>\n> On Mon, Nov 15, 2021 at 1:40 AM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n> >\n> > $ git log main github/main --graph --decorate -n 3\n> > * commit b73d3e132f9638afbf5b98b0c278ed6b93a3ae50 (HEAD -> main)\n> > | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> > | Date:   Mon Nov 15 15:22:53 2021 +0700\n> > |\n> > |     init activity api\n> > |\n> > * commit d370bf256a756a777c14609c8ad4184aa7e9e60f (github/main)\n> > | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> > | Date:   Sat Nov 13 19:18:45 2021 +0700\n> > |\n> > |     refactor partitioning migration\n> > |\n> > * commit 5124511d287f1a6c384ff9766fdcc0e3e07043e8\n> > | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> > | Date:   Mon Nov 8 17:24:19 2021 +0700\n> > |\n> > |     wip pg\n> >\n> > $ git remote -v\n> > github    git@github.com:erwinv/database-sandbox.git (fetch)\n> > github    git@github.com:erwinv/database-sandbox.git (push)\n> >\n> > Link to the [upstream branch on\n> > GitHub](https://github.com/erwinv/database-sandbox/commits/main) so\n> > you could see for yourself that my local is ahead of upstream and that\n> > the upstream has no commits ahead of local.\n>\n> Certainly looks \"ahead\". There _has_ been at least one confirmed bug\n> in 2.33 related to how \"ahead\" is handled[1], but it doesn't seem like\n> it's related to what you're seeing here. The \"git pull\" output\n> suggests you don't have \"pull.ff=only\" set.\n>\n> Are you able to pull down either Git 2.32 or the just-released Git\n> 2.34 and try one of those?\n> My suggestion to try \"git fetch\" could still also be useful, to see if\n> your \"git status\" output changes.\n>\n> [1] https://lore.kernel.org/git/CH2PR06MB650424B4205102AC6A48F489B1BD9@CH2PR06MB6504.namprd06.prod.outlook.com/\n>\n> >\n> > Best regards,\n> > Erwin\n> >\n> >\n> > On Mon, Nov 15, 2021 at 4:19 PM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n> > >\n> > > > the remote mainline have three commits ahead\n> > > Where did you get this info? This is not true in my case.\n> > >\n> > > * local is ahead of upstream. confirmed by `git status`:\n> > >\n> > > ```\n> > > $ git status\n> > > On branch main\n> > > Your branch is ahead of 'github/main' by 1 commit.\n> > >   (use \"git push\" to publish your local commits)\n> > > ```\n> > >\n> > > If remote was ahead, `git status` would say so. And this is my\n> > > personal repo in GitHub with only me as the sole developer/contributor\n> > > so I can assure you that the upstream has no commits ahead of my\n> > > local.\n> > >\n> > > Best regards,\n> > > Erwin\n> > >\n> > > On Mon, Nov 15, 2021 at 4:12 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n> > > >\n> > > > On 15/11/21 15.56, Erwin Villejo wrote:\n> > > > > There is nothing to reconcile since the branches have not diverged:\n> > > > > local is ahead of upstream. So I think it is a bug, no?\n> > > >\n> > > > You have the situation like:\n> > > >\n> > > > ---o---a (your mainline)\n> > > >     \\\n> > > >      b---c---d (remote mainline)\n> > > >\n> > > > Your mainline only have one commit ahead of base point `o`, while the remote\n> > > > mainline have three commits ahead of `o` but unrelated. In this sense, your and\n> > > > remote mainline is divergent - you need to either merge or rebase.\n> > > >\n> > > > Next time, keep your mainline pristine (don't commit any local changes on it,\n> > > > instead branch to the topic branch and commit there).\n> > > >\n> > > > --\n> > > > An old man doll... just what I always wanted! - Clara\n"},{"id":"441218","messageId":"CAGyf7-GjoU7VqN3bhRcoQ1xJM==h2aNm9fm_5HxDJk_hgGop1Q@mail.gmail.com","threadId":"56902","inReplyTo":"CADL96rtX_uw6fJEVq2u9bkPNhYXwaGT13F+cMiGgZrHQr5TP7A@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2021-11-15T18:15:30Z","receivedAt":"2021-11-16T00:54:03Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Mon, Nov 15, 2021 at 1:40 AM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n>\n> $ git log main github/main --graph --decorate -n 3\n> * commit b73d3e132f9638afbf5b98b0c278ed6b93a3ae50 (HEAD -> main)\n> | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> | Date:   Mon Nov 15 15:22:53 2021 +0700\n> |\n> |     init activity api\n> |\n> * commit d370bf256a756a777c14609c8ad4184aa7e9e60f (github/main)\n> | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> | Date:   Sat Nov 13 19:18:45 2021 +0700\n> |\n> |     refactor partitioning migration\n> |\n> * commit 5124511d287f1a6c384ff9766fdcc0e3e07043e8\n> | Author: Erwin Villejo <erwin.villejo@gmail.com>\n> | Date:   Mon Nov 8 17:24:19 2021 +0700\n> |\n> |     wip pg\n>\n> $ git remote -v\n> github    git@github.com:erwinv/database-sandbox.git (fetch)\n> github    git@github.com:erwinv/database-sandbox.git (push)\n>\n> Link to the [upstream branch on\n> GitHub](https://github.com/erwinv/database-sandbox/commits/main) so\n> you could see for yourself that my local is ahead of upstream and that\n> the upstream has no commits ahead of local.\n\nCertainly looks \"ahead\". There _has_ been at least one confirmed bug\nin 2.33 related to how \"ahead\" is handled[1], but it doesn't seem like\nit's related to what you're seeing here. The \"git pull\" output\nsuggests you don't have \"pull.ff=only\" set.\n\nAre you able to pull down either Git 2.32 or the just-released Git\n2.34 and try one of those?\nMy suggestion to try \"git fetch\" could still also be useful, to see if\nyour \"git status\" output changes.\n\n[1] https://lore.kernel.org/git/CH2PR06MB650424B4205102AC6A48F489B1BD9@CH2PR06MB6504.namprd06.prod.outlook.com/\n\n>\n> Best regards,\n> Erwin\n>\n>\n> On Mon, Nov 15, 2021 at 4:19 PM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n> >\n> > > the remote mainline have three commits ahead\n> > Where did you get this info? This is not true in my case.\n> >\n> > * local is ahead of upstream. confirmed by `git status`:\n> >\n> > ```\n> > $ git status\n> > On branch main\n> > Your branch is ahead of 'github/main' by 1 commit.\n> >   (use \"git push\" to publish your local commits)\n> > ```\n> >\n> > If remote was ahead, `git status` would say so. And this is my\n> > personal repo in GitHub with only me as the sole developer/contributor\n> > so I can assure you that the upstream has no commits ahead of my\n> > local.\n> >\n> > Best regards,\n> > Erwin\n> >\n> > On Mon, Nov 15, 2021 at 4:12 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n> > >\n> > > On 15/11/21 15.56, Erwin Villejo wrote:\n> > > > There is nothing to reconcile since the branches have not diverged:\n> > > > local is ahead of upstream. So I think it is a bug, no?\n> > >\n> > > You have the situation like:\n> > >\n> > > ---o---a (your mainline)\n> > >     \\\n> > >      b---c---d (remote mainline)\n> > >\n> > > Your mainline only have one commit ahead of base point `o`, while the remote\n> > > mainline have three commits ahead of `o` but unrelated. In this sense, your and\n> > > remote mainline is divergent - you need to either merge or rebase.\n> > >\n> > > Next time, keep your mainline pristine (don't commit any local changes on it,\n> > > instead branch to the topic branch and commit there).\n> > >\n> > > --\n> > > An old man doll... just what I always wanted! - Clara\n"},{"id":"441220","messageId":"CAGyf7-H5icSmOQ1eDx9RXDTwFcB2y9sgUxNNTF7V7Xu1MfHTEA@mail.gmail.com","threadId":"56902","inReplyTo":"CADL96rvRX2R_4Wm23tz88hDUztcpK531RU+Ops2UVoiOW0bCHw@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2021-11-15T17:56:37Z","receivedAt":"2021-11-16T01:24:12Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Mon, Nov 15, 2021 at 12:42 AM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n>\n> > What did you do before the bug happened? (Steps to reproduce your issue)\n> * make local changes, stage, and commit\n> * local is ahead of upstream. confirmed by `git status`:\n>\n> ```\n> $ git status\n> On branch main\n> Your branch is ahead of 'github/main' by 1 commit.\n>   (use \"git push\" to publish your local commits)\n> ```\n>\n> * try to pull upstream to local\n>\n> > What did you expect to happen? (Expected behavior)\n> No-op (and NO failure) since local is ahead of upstream.\n>\n> > What happened instead? (Actual behavior)\n> `git pull` fails with error:\n>\n> ```\n> $ git pull\n> hint: You have divergent branches and need to specify how to reconcile them.\n> hint: You can do so by running one of the following commands sometime before\n> hint: your next pull:\n> hint:\n> hint:   git config pull.rebase false  # merge (the default strategy)\n> hint:   git config pull.rebase true   # rebase\n> hint:   git config pull.ff only       # fast-forward only\n> hint:\n> hint: You can replace \"git config\" with \"git config --global\" to set a default\n> hint: preference for all repositories. You can also pass --rebase, --no-rebase,\n> hint: or --ff-only on the command line to override the configured default per\n> hint: invocation.\n> fatal: Need to specify how to reconcile divergent branches.\n> ```\n>\n> > What's different between what you expected and what actually happened?\n> I expected no failure and no-op since local is ahead of upstream.\n> Instead, `git pull`\n> fails because it thinks the branches have diverged.\n\nYou're making a logical, but still incorrect, assumption about what\nthe \"git status\" output means. \"git status\" does NOT actually check\nthe remote server.\n\nWhen you pull, there are typically 3 refs that are involved, not 2.\n(Given it appears you're on \"main\", I'll use that name below.)\nrefs/heads/main: This is the local branch you're working on\nrefs/remotes/github/main: This is your _local copy_ of what the\n_remote_ branch was pointed at the last time you fetched or pulled\nsuccessfully\nrefs/heads/main on Github: This is the remote branch you're trying to push to\n\nWhen you run \"git status\", it is NOT talking to Github; it's simply\ncomparing the state of your \"refs/heads/main\" and\n\"refs/remotes/github/main\" branches.\n\nWhen you run \"git pull\", it's actually talking to Github, which allows\nit to find out about commits that are present remotely but have not\nbeen fetched to your \"refs/heads/main\" or \"refs/remotes/github/main\"\nbranches.\n\nIf you run \"git fetch\", rather than \"git pull\", that will update your\nlocal \"refs/remotes/github/main\" branch without trying to also update\n\"refs/heads/main\". If you then run \"git status\", it will tell you your\n\"main\" branch has diverged, just like \"git pull\" does, instead of\nshowing it as ahead.\n\nHope this helps,\nBryan\n\n>\n> > Anything else you want to add:\n> I found this bug in VSCode. VSCode runs `git pull` first before `git\n> push` when pushing to upstream.\n> This bug causes pushing via VSCode to always fail, although it can be\n> worked around by simply opening\n> a terminal and running `git push` manually.\n>\n> [System Info]\n> git version:\n> git version 2.33.1\n> cpu: x86_64\n> no commit associated with this build\n> sizeof-long: 8\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> uname: Linux 5.15.2-arch1-1 #1 SMP PREEMPT Fri, 12 Nov 2021 19:22:10\n> +0000 x86_64\n> compiler info: gnuc: 11.1\n> libc info: glibc: 2.33\n> $SHELL (typically, interactive shell): /bin/bash\n>\n>\n> [Enabled Hooks]\n>\n> Best regards,\n> Erwin\n"},{"id":"441239","messageId":"CADL96rt0ye6KkkoZqzBCgnZyRxRhQSYktkrdP3DtAj8uEZFwMw@mail.gmail.com","threadId":"56902","inReplyTo":"CADL96rsnUCXchnrTa1rZ7WgJz2kDA-3TzeOiCy4AXNFdXtTmng@mail.gmail.com","subject":"Re: git pull bug report","fromName":"Erwin Villejo","fromEmail":"erwinvillejo@gmail.com","sentAt":"2021-11-16T01:43:54Z","receivedAt":"2021-11-16T04:42:15Z","isPatch":false,"sender":{"key":"erwinvillejo@gmail.com","avatar":"https://gravatar.com/avatar/5fe0c1efd06f741b2c545bac37596e9acfe74c118a91d0dd9ccf0961d230e97d?d=mp&s=160"},"body":"Please check PR: https://github.com/gitgitgadget/git/pull/1078\n\nThanks.\n\n\nOn Tue, Nov 16, 2021 at 7:23 AM Erwin Villejo <erwinvillejo@gmail.com> wrote:\n>\n> 361cb523 fixes only the --ff-only case.\n>\n> It's still broken for unspecified/unset fast-forward flag and config (pull.ff and pull.rebase).\n>\n> Br, Erwin\n>\n>\n> On Tue, Nov 16, 2021, 3:40 AM Junio C Hamano, <gitster@pobox.com> wrote:\n>>\n>> Erwin Villejo <erwinvillejo@gmail.com> writes:\n>>\n>> > $ git pull\n>> > hint: You have divergent branches and need to specify how to reconcile them.\n>> > ...\n>> > hint: invocation.\n>> > fatal: Need to specify how to reconcile divergent branches.\n>> > ```\n>> >\n>> >> What's different between what you expected and what actually happened?\n>> > I expected no failure and no-op since local is ahead of upstream.\n>> > Instead, `git pull`\n>> > fails because it thinks the branches have diverged.\n>>\n>> I think this was fixed at 361cb523 (pull: --ff-only should make it a\n>> noop when already-up-to-date, 2021-10-20); it was broken between Git\n>> 2.33 and Git 2.33.1, IIRC.\n>>\n>> Thanks.\n"}]}