Skip to content

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

Closed

Description

@NickCraver

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!

Activity

  1. added
    bug
    priority-3
    on Mar 17, 2020
  2. tierninho commented on Mar 17, 2020

    @tierninho
    Contributor

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

    tags: spinning, looping, loops, spins, endless

  3. Listbd commented on Jun 25, 2020

    @Listbd

    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>
    
  4. tierninho commented on Jul 7, 2020

    @tierninho
    Contributor
  5. tierninho commented on Jul 7, 2020

    @tierninho
    Contributor

    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.

  6. steveward commented on Oct 7, 2020

    @steveward
    Contributor

    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.

  7. Listbd commented on Oct 7, 2020

    @Listbd

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

  8. cliff-km commented on Oct 8, 2020

    @cliff-km

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

  9. cliff-km commented on Oct 15, 2020

    @cliff-km

    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.

  10. niik commented on Oct 19, 2020

    @niik
    Member

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

  11. cliff-km commented on Oct 20, 2020

    @cliff-km

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

  12. niik commented on Oct 30, 2020

    @niik
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions