Repository navigation
Description
Describe the bug
When trying to checkout a PR, it goes into a fun loop retrying the checkout but not presenting an error (screenshot below).
At the console, here's what the error was:
[19:45] ❯ git checkout pr/1389
error: Your local changes to the following files would be overwritten by checkout:
tests/RedisConfigs/Sentinel/sentinel-26379.conf
tests/RedisConfigs/Sentinel/sentinel-26380.conf
Please commit your changes or stash them before you switch branches.
Aborting
[19:46] ❯ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Note that the 2 files in question do not show as pending differences, because they have both been:
git update-index --assume-unchanged <file>
(this is because Redis stores state in the config, and we shouldn't be updating master with that state constantly)
This combination seems to confuse the UI and it doesn't present an error...it just gets in a fun loop. Closing the app is the only way I've found to escape it.
Version & OS
OS: Windows 10
Client: 2.3.2-beta5
Steps to reproduce the behavior
See above description...unfortunately not trivial to reproduce. But it's possible this repros without any PR needed on any branch checkout.
Expected behavior
User gets an error indicating why checkout isn't possible.
Actual behavior
Infinite merry-go-round loop of fun!
Screenshots
Logs
Logs have sensitive data from our GHE instance, but the only related bits are this in a loop:
2020-03-16T23:45:28.667Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: StackExchange.Redis - NickCraver (has token)
2020-03-16T23:45:29.139Z - error: [ui] `git -c credential.helper= -c protocol.version=2 checkout --progress pr/1389 --recurse-submodules --` exited with an unexpected code: 1.
stderr:
error: Your local changes to the following files would be overwritten by checkout:
tests/RedisConfigs/Sentinel/sentinel-26379.conf
tests/RedisConfigs/Sentinel/sentinel-26380.conf
Please commit your changes or stash them before you switch branches.
Aborting
(The error was parsed as 37: Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.)
2020-03-16T23:45:29.671Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: StackExchange.Redis - NickCraver (has token)
2020-03-16T23:45:30.127Z - error: [ui] `git -c credential.helper= -c protocol.version=2 checkout --progress pr/1389 --recurse-submodules --` exited with an unexpected code: 1.
stderr:
error: Your local changes to the following files would be overwritten by checkout:
tests/RedisConfigs/Sentinel/sentinel-26379.conf
tests/RedisConfigs/Sentinel/sentinel-26380.conf
Please commit your changes or stash them before you switch branches.
Aborting
(The error was parsed as 37: Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.)
2020-03-16T23:45:30.596Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: StackExchange.Redis - NickCraver (has token)
2020-03-16T23:45:31.046Z - error: [ui] `git -c credential.helper= -c protocol.version=2 checkout --progress pr/1389 --recurse-submodules --` exited with an unexpected code: 1.
stderr:
error: Your local changes to the following files would be overwritten by checkout:
tests/RedisConfigs/Sentinel/sentinel-26379.conf
tests/RedisConfigs/Sentinel/sentinel-26380.conf
Please commit your changes or stash them before you switch branches.
Aborting
(The error was parsed as 37: Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.)
Hope this helps!

Activity
tierninho commentedon Mar 17, 2020
@NickCraver Thanks for filing. Marking this as a bug pending further investigation.
tags: spinning, looping, loops, spins, endless
Listbd commentedon Jun 25, 2020
Also experiencing this bug in Version 2.5.3. The UI gets stuck just as demonstrated above, and has the same git error.
tierninho commentedon Jul 7, 2020
Another report of this #7718 (comment):
tierninho commentedon Jul 7, 2020
From the logs above, these are the errors I spotted. This issue seems related to #7691, #4592, #8064, and #9434
The video may hold some clues. I could not reproduce.
steveward commentedon Oct 7, 2020
From #10733:
Listbd commentedon Oct 7, 2020
@steveward Try going to the command line and checking out the branch.
>git checkout mybranchIf you get an error there and it specifies the problem file, then you can just delete that file and you should be able to switch branches.
cliff-km commentedon Oct 8, 2020
@Listbd I was the submitter on #10733. For me, this is very intermittent but the next time it happens (which has been days or weeks apart) I can try that and provide some additional info here. Regardless, I'd still expect the GUI to error handle whatever the issue is properly.
Edit to clarify: I have tried to purposefully recreate this without luck but I have seen it multiple times.
cliff-km commentedon Oct 15, 2020
I was able to reproduce this today.
When I try to check out in the command-line I do get an error:
If I
git status:The upstream is gone because it was squashed and merged.
I'll create a new clone for my work and leave this in place for any further info gathering.
niik commentedon Oct 19, 2020
@CliffWMiller Just to confirm, have you also been using
git update-index --assume-unchanged? I'm struggling to see howgit checkoutwould tell you that you have local changes whengit statussays there are none.@NickCraver What's your typical way to get yourself out of that scenario when you do get into it? I've never had to use
--assume-unchangedso this workflow is new to me. Do you do a forced checkout or what?cliff-km commentedon Oct 20, 2020
@niik
No, for this project I'm almost exclusively using the GitHub app. I'm confused about the same thing.Edit: I lied. I looked through the scripts for the project and that is done to these files.
niik commentedon Oct 30, 2020
@CliffWMiller Thank you so much for confirming, I think I have a pretty clear understanding of what's going on now!
I am looking into how we can prevent the loop from occurring and I hope to have something ready for review soon to remedy that. I did read up on assume-unchanged/skip-worktree and food this interesting note in the Git documentation.
All that to say is that I think Desktop's solution here will need to be to surface the error from Git and let users who manually update this bit to resolve the situation outside of Desktop.