{"thread":{"id":"60016","subject":"[bug] lots of changes including .gitignore, many rebases, can't legally share the repo","startedAt":"2023-07-20T21:52:46Z","lastAt":"2023-07-21T10:04:15Z","messageCount":3,"participants":["Radu Dan","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"479694","messageId":"CAH3jj7fS3wziLfnAfKz49W+aZVPvF8Nm9UVBMWyeHLvYov7A-w@mail.gmail.com","threadId":"60016","inReplyTo":null,"subject":"[bug] lots of changes including .gitignore, many rebases, can't legally share the repo","fromName":"Radu Dan","fromEmail":"radu@fullthrottle.ro","sentAt":"2023-07-20T21:52:30Z","receivedAt":"2023-07-20T21:52:46Z","isPatch":false,"sender":{"key":"radu@fullthrottle.ro","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\n> What did you do before the bug happened? (Steps to reproduce your issue)\n\n% git stash\nNo local changes to save\n\n% git commit -m wtf\nOn branch test\nYour branch is up to date with 'origin/test'.\n\nnothing to commit, working tree clean\n\n% git checkout main\nerror: Your local changes to the following files would be overwritten\nby checkout:\nsettings/local.py\nPlease commit your changes or stash them before you switch branches.\nAborting\n\n> What did you expect to happen? (Expected behavior)\n\nSwitch to `main`\n\n> What happened instead? (Actual behavior)\n\nStill on current branch\n\n> What's different between what you expected and what actually happened?\n\nBetter error message\n\n> Anything else you want to add:\n\nFirst bug in 10 years of usage, great work!\n\n> Please review the rest of the bug report below.\n> You can delete any lines you don't wish to share.\n\n[System Info]\ngit version:\ngit version 2.39.2 (Apple Git-143)\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22\nPDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64\ncompiler info: clang: 14.0.3 (clang-1403.0.22.14.1)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\n"},{"id":"479718","messageId":"20230721065833.q2zshssu4clbzxq6@tb-raspi4","threadId":"60016","inReplyTo":"CAH3jj7fS3wziLfnAfKz49W+aZVPvF8Nm9UVBMWyeHLvYov7A-w@mail.gmail.com","subject":"Re: [bug] lots of changes including .gitignore, many rebases, can't legally share the repo","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-07-21T06:58:33Z","receivedAt":"2023-07-21T06:58:41Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Fri, Jul 21, 2023 at 12:52:30AM +0300, Radu Dan wrote:\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n>\n> > What did you do before the bug happened? (Steps to reproduce your issue)\n>\n> % git stash\n> No local changes to save\n>\n> % git commit -m wtf\n> On branch test\n> Your branch is up to date with 'origin/test'.\n>\n> nothing to commit, working tree clean\n>\n> % git checkout main\n> error: Your local changes to the following files would be overwritten\n> by checkout:\n> settings/local.py\n> Please commit your changes or stash them before you switch branches.\n> Aborting\n\nFirst of all: thanks for your feedback.\nHowever, the situation on your local disk is hard to debug from remote.\nWhich could be frustrating on both sides, so to say.\n\nSo we may come further by asking some questions:\n- Is the repo you are talking about public ?\nDoes settings/local.py exist is both branches, origin/test and main ?\n- What does\n  git ls-files --eol setings/local.py\n  give you ?\n\n- Is there a .gitignore, which is different on both branches ?\n- What does\n  git ls-files | grep -i local.py\n  give you ?\n\n\n\n>\n> > What did you expect to happen? (Expected behavior)\n>\n> Switch to `main`\n>\n> > What happened instead? (Actual behavior)\n>\n> Still on current branch\n>\n> > What's different between what you expected and what actually happened?\n>\n> Better error message\n\nThe error message as such is probably the best information that Git has,\nthe question is, which changes does Git see ?\n\nAnother question :\nwhat does\ngit add --renormalize .\ngive you ? (Please do not omit the '.')\n\n\n\n>\n> > Anything else you want to add:\n>\n> First bug in 10 years of usage, great work!\n>\n> > Please review the rest of the bug report below.\n> > You can delete any lines you don't wish to share.\n>\n> [System Info]\n> git version:\n> git version 2.39.2 (Apple Git-143)\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> feature: fsmonitor--daemon\n> uname: Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22\n> PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64\n> compiler info: clang: 14.0.3 (clang-1403.0.22.14.1)\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): /bin/zsh\n>\n>\n> [Enabled Hooks]\n"},{"id":"479720","messageId":"CAH3jj7dDazpYGdJsixQ9jpwdoJMSS+uXM-xkAZT2UR7h81enig@mail.gmail.com","threadId":"60016","inReplyTo":"20230721065833.q2zshssu4clbzxq6@tb-raspi4","subject":"Re: [bug] lots of changes including .gitignore, many rebases, can't legally share the repo","fromName":"Radu Dan","fromEmail":"radu@fullthrottle.ro","sentAt":"2023-07-21T10:03:58Z","receivedAt":"2023-07-21T10:04:15Z","isPatch":false,"sender":{"key":"radu@fullthrottle.ro","avatar":null},"body":"I'm sadly aware of the difficulty in debugging this, so thank you for\ncaring! The code isn't super sensitive so I'll try to get approval to\nshare it (privately) but the client might insist on a background check\n(commercial). I'll only do this with your consent, and after we have\nexhausted all other options.\n\n> Is the repo you are talking about public ?\nThe repo isn't public but it is hosted on github (private).\nThe main reason I reported it is that github was able to rebase the\ntwo branches with no conflicts, so the problem seems to be related to\nmy local copy, which I made a backup of before cloning the merged one\nso I could try to answer some of these questions.\nSome weirdness (5xx errors) started happening to our deploy pipeline a\nbit after CI picked up the new branch which might suggest that\nsomething similar happened with those copies, but it seems to have\nrecovered so it was either an unrelated fluke, or this something that\nonly happens on certain versions of git.\n\n> Does settings/local.py exist is both branches, origin/test and main ?\nI can't really tell you what `main` contains at the moment since I\ndon't know how to open it, but assuming it was up to date with\n`origin/main` (high likelihood: it was stale for almost two years\nprior to yesterday), then `settings/local.py` only exists on `test`.\nThe two branches have diverged significantly over time: CI picks up\n`main` and deploys it to production (this would have been the first\nsuch deploy), whereas `test` is deployed to staging and has been the\nmain merge target thus far.\n\nWhat does git ls-files --eol setings/local.py give you ?\nNothing:\n% git ls-files --eol setings/local.py\n%\n\n> Is there a .gitignore, which is different on both branches ?\nYes, this is what I too suspect is the root cause. A placeholder\n`settings/local.py` file was added to `test`, and then gitignored so\nthat devs can override their own settings without pushing them back.\nIn this case, the error message makes a lot of sense since that is\nexactly what would be happening: since `main` does not have a\ncorresponding file, all local changes would be lost.\nThe files are however bit for bit identical:\n\n9b4988c3a70e41db3b5ef8eb2d9d1eb92fc08c68  settings/local.py <-- `test`\nin bugged repo\n9b4988c3a70e41db3b5ef8eb2d9d1eb92fc08c68  settings/local.py <-- `test`\nafter reset --hard\n\nWeirdly enough, the error goes away after the hard reset and I am able\nto checkout `main` even though the conflicting file wasn't changed\n(other than maybe some internal flag)\n\n> The error message as such is probably the best information that Git has,\nMentioning gitignore in this case might be a good idea though\n\n> what does git add --renormalize . give you ? (Please do not omit the '.')\nThat also solves it!\n\ngit add --renormalize .\ngit status\nOn branch test\n\nYour branch is up to date with 'origin/test'.\n\n% git checkout main\nbranch 'main' set up to track 'origin/main'.\nSwitched to a new branch 'main'\n\nSo it seems like there's a dirty flag that's not updated to reflect the shasum.\nIn my book, we can write this one off as random bit flip caused by a\ncosmic ray but if you'd rather investigate it further, let me know how\nI can help; I've kept an archive of the offending repo just in case.\n\nThanks and best wishes!\n\nOn Fri, Jul 21, 2023 at 9:58 AM Torsten Bögershausen <tboegi@web.de> wrote:\n>\n> On Fri, Jul 21, 2023 at 12:52:30AM +0300, Radu Dan wrote:\n> > Thank you for filling out a Git bug report!\n> > Please answer the following questions to help us understand your issue.\n> >\n> > > What did you do before the bug happened? (Steps to reproduce your issue)\n> >\n> > % git stash\n> > No local changes to save\n> >\n> > % git commit -m wtf\n> > On branch test\n> > Your branch is up to date with 'origin/test'.\n> >\n> > nothing to commit, working tree clean\n> >\n> > % git checkout main\n> > error: Your local changes to the following files would be overwritten\n> > by checkout:\n> > settings/local.py\n> > Please commit your changes or stash them before you switch branches.\n> > Aborting\n>\n> First of all: thanks for your feedback.\n> However, the situation on your local disk is hard to debug from remote.\n> Which could be frustrating on both sides, so to say.\n>\n> So we may come further by asking some questions:\n> - Is the repo you are talking about public ?\n> Does settings/local.py exist is both branches, origin/test and main ?\n> - What does\n>   git ls-files --eol setings/local.py\n>   give you ?\n>\n> - Is there a .gitignore, which is different on both branches ?\n> - What does\n>   git ls-files | grep -i local.py\n>   give you ?\n>\n>\n>\n> >\n> > > What did you expect to happen? (Expected behavior)\n> >\n> > Switch to `main`\n> >\n> > > What happened instead? (Actual behavior)\n> >\n> > Still on current branch\n> >\n> > > What's different between what you expected and what actually happened?\n> >\n> > Better error message\n>\n> The error message as such is probably the best information that Git has,\n> the question is, which changes does Git see ?\n>\n> Another question :\n> what does\n> git add --renormalize .\n> give you ? (Please do not omit the '.')\n>\n>\n>\n> >\n> > > Anything else you want to add:\n> >\n> > First bug in 10 years of usage, great work!\n> >\n> > > Please review the rest of the bug report below.\n> > > You can delete any lines you don't wish to share.\n> >\n> > [System Info]\n> > git version:\n> > git version 2.39.2 (Apple Git-143)\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> > feature: fsmonitor--daemon\n> > uname: Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22\n> > PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64\n> > compiler info: clang: 14.0.3 (clang-1403.0.22.14.1)\n> > libc info: no libc information available\n> > $SHELL (typically, interactive shell): /bin/zsh\n> >\n> >\n> > [Enabled Hooks]\n"}]}