Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3.2 beta has a UI Loop when checkout in isn't possible #9297

Closed
NickCraver opened this issue Mar 17, 2020 · 11 comments · Fixed by #10957
Closed

2.3.2 beta has a UI Loop when checkout in isn't possible #9297

NickCraver opened this issue Mar 17, 2020 · 11 comments · Fixed by #10957
Labels
bug Confirmed bugs or reports that are very likely to be bugs priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature

Comments

@NickCraver
Copy link
Contributor

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

GHD-Loop

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!

@tierninho tierninho added bug Confirmed bugs or reports that are very likely to be bugs priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature labels Mar 17, 2020
@tierninho
Copy link
Contributor

tierninho commented Mar 17, 2020

@NickCraver Thanks for filing. Marking this as a bug pending further investigation.

tags: spinning, looping, loops, spins, endless

@Listbd
Copy link

Listbd commented 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.

C:\Source\my-portal>git checkout 1732-accounting
error: Your local changes to the following files would be overwritten by checkout:
        MyPortal/src/MyPortal.Web/Web.config
Please commit your changes or stash them before you switch branches.
Aborting

C:\Source\my-portal>

@tierninho
Copy link
Contributor

Another report of this #7718 (comment):

Hi, I am facing the same error on Github desktop. My version is 2.5.3
logs: https://send.firefox.com/download/8f262f6eb4177211/#eoM87NtIxRsImhYaUpqZ5w
error video

@tierninho
Copy link
Contributor

tierninho commented Jul 7, 2020

From the logs above, these are the errors I spotted. This issue seems related to #7691, #4592, #8064, and #9434

2020-07-07T08:24:14.653Z - info: [ui] No submodules found. Skipping "git submodule status"
2020-07-07T08:24:49.498Z - error: [ui] Could not load old contents for syntax highlighting
Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
    at ChildProcess.<anonymous> (C:\Users\arjun\AppData\Local\GitHubDesktop\app-2.5.3\webpack:\app\src\lib\git\spawn.ts:111:15)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
2020-07-07T08:24:53.360Z - info: [ui] No submodules found. Skipping "git submodule status"
2020-07-07T08:24:58.150Z - info: [ui] No submodules found. Skipping "git submodule status"
2020-07-07T08:25:01.940Z - error: [ui] Could not load old contents for syntax highlighting
Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
    at ChildProcess.<anonymous> (C:\Users\arjun\AppData\Local\GitHubDesktop\app-2.5.3\webpack:\app\src\lib\git\spawn.ts:111:15)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
2020-07-07T08:25:09.424Z - error: [ui] `git merge dev` exited with an unexpected code: 128.
stderr:
error: Your local changes to the following files would be overwritten by merge:
DeliveryHeroMENA.VendorPortal.InternalApi/DeliveryHeroMENA.VendorPortal.InternalApi.EntityFramework/obj/Debug/netstandard2.0/DeliveryHeroMENA.VendorPortal.InternalApi.EntityFramework.AssemblyInfoInputs.cache
Please commit your changes or stash them before you merge.
Aborting

The video may hold some clues. I could not reproduce.

@steveward
Copy link
Member

From #10733:

The branch selector flickers until I close the application. Reopening the application stops the flickering but attempting to switch branches again will recreate the issue. The only way I've found to resolve the issue is to remove the repo and re-clone it.

@Listbd
Copy link

Listbd commented Oct 7, 2020

@steveward Try going to the command line and checking out the branch.
>git checkout mybranch

If 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
Copy link

cliff-km commented 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
Copy link

I was able to reproduce this today.

When I try to check out in the command-line I do get an error:

error: Your local changes to the following files would be overwritten by checkout:
        .yarnrc.yml
        packages/btw-organization-request/functions/.npmrc
Please commit your changes or stash them before you switch branches.
Aborting

If I git status:

On branch BTW-1063/fix-confirm-values
Your branch is based on 'origin/BTW-1063/fix-confirm-values', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

nothing to commit, working tree clean

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
Copy link
Member

niik commented Oct 19, 2020

@CliffWMiller Just to confirm, have you also been using git update-index --assume-unchanged? I'm struggling to see how git checkout would tell you that you have local changes when git status says 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-unchanged so this workflow is new to me. Do you do a forced checkout or what?

@cliff-km
Copy link

cliff-km commented 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
Copy link
Member

niik commented Oct 30, 2020

Edit: I lied. I looked through the scripts for the project and that is done to these files.

@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.

Users often try to use the assume-unchanged and skip-worktree bits to tell Git to ignore changes to files that are tracked. This does not work as expected, since Git may still check working tree files against the index when performing certain operations. In general, Git does not provide a way to ignore changes to tracked files, so alternate solutions are recommended.

For example, if the file you want to change is some sort of config file, the repository can include a sample config file that can then be copied into the ignored name and modified. The repository can even include a script to treat the sample file as a template, modifying and copying it automatically.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs priority-3 Bugs that affect small number of users and/or relatively cosmetic in nature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@NickCraver @niik @steveward @cliff-km @Listbd @tierninho and others