Skip to content

Stash error with conflicted file upon new branch creation #7827

Closed

Description

@tierninho
  1. checkout master at sha A
  2. create branch-a at sha A
  3. commit to master a change to config/routes.rb so master is now at sha B
  4. checkout branch-a (which is at sha A)
  5. make a conflicting change to config/routes.rb
  6. hit the "current branch" button and create a new branch (branch-b), based off master, bring changes with me
  7. after a moment branch-a will be checked out, the changes are gone
  8. but git stash show will show the changes
  9. and the new branch (branch-b) will have been created, if you switch to it manually, the UI Shows the stashed changes

Step 9:
image

2019-06-18T11:22:55.114Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: github - latentflip (has token)
2019-06-18T11:22:56.120Z - error: [ui] `git -c credential.helper= -c protocol.version=2 checkout --progress live-update-new-notifications --` exited with an unexpected code: 1.
stderr:
error: Your local changes to the following files would be overwritten by checkout:
	config/routes.rb
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.)
2019-06-18T11:23:00.092Z - info: [ui] Executing createStashEntry: git stash push --include-untracked -m !!GitHub_Desktop<live-update-new-notifications> (took 3.968s)
2019-06-18T11:23:01.252Z - warn: [ui] failed fetching updated PRs for repository github/github
Error: got max pull requests, aborting
    at Object.continue (/webpack:/app/src/lib/api.ts:677:23)
    at k.fetchAll (/webpack:/app/src/lib/api.ts:755:5)
2019-06-18T11:23:02.251Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 5.190s)
2019-06-18T11:23:34.681Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 3.567s)
2019-06-18T11:23:50.231Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 3.341s)
2019-06-18T11:24:28.502Z - info: [ui] Executing getCommits: git log HEAD --date=raw --max-count=100 --pretty=%H%x1F%h%x1F%s%x1F%b%x1F%an <%ae> %ad%x1F%cn <%ce> %cd%x1F%P%x1F%(trailers:unfold,only) -z --no-show-signature --no-color --not --remotes -- (took 1.928s)
2019-06-18T11:24:32.343Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 5.799s)
2019-06-18T11:24:51.958Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 5.367s)
2019-06-18T11:24:53.423Z - info: [ui] Executing getCommits: git log HEAD --date=raw --max-count=100 --pretty=%H%x1F%h%x1F%s%x1F%b%x1F%an <%ae> %ad%x1F%cn <%ce> %cd%x1F%P%x1F%(trailers:unfold,only) -z --no-show-signature --no-color --not --remotes -- (took 1.230s)
2019-06-18T11:25:03.645Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 5.927s)
2019-06-18T11:25:22.263Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: github - latentflip (has token)
2019-06-18T11:25:25.580Z - info: [ui] Executing checkoutBranch: git -c credential.helper= -c protocol.version=2 checkout --progress new-notifications-banner -- (took 3.291s)
2019-06-18T11:25:27.190Z - info: [ui] Executing getStatus: git --no-optional-locks status --untracked-files=all --branch --porcelain=2 -z (took 1.609s)
2019-06-18T11:25:41.509Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 14.318s)
2019-06-18T11:25:49.379Z - info: [ui] Executing getStatus: git --no-optional-locks status --untracked-files=all --branch --porcelain=2 -z (took 1.428s)
2019-06-18T11:26:11.440Z - info: [ui] Executing getStatus: git --no-optional-locks status --untracked-files=all --branch --porcelain=2 -z (took 1.022s)
2019-06-18T11:26:19.724Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(objectname:short)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 8.268s)
2019-06-18T11:26:37.620Z - info: [ui] Executing createCommit: git commit -F - (took 10.268s)

build 2.0.4, mac

Activity

  1. added
    bug
    priority-2
    epic:stashing
    on Jun 18, 2019
  2. tierninho commented on Jun 19, 2019

    @tierninho
    ContributorAuthor

    Confirming the above steps do reproduce the issue.

    After step 6, this is what Desktop looked like. Note the changes are stashed and you are on the new branch.
    image

    2.0.4-beta1, mac

  3. changed the title [-]Stashed error is suppressed upon new branch creation[/-] [+]Stash error with conflicted file upon new branch creation[/+] on Jun 19, 2019
  4. tierninho commented on Jul 24, 2019

    @tierninho
    ContributorAuthor

    Bumping this up as two more users experienced this. 😿 ⬆️

  5. tierninho commented on Aug 3, 2019

    @tierninho
    ContributorAuthor

    Summary of the issue from a user perspective:

    As a user, when I have two branches and create conflicting changes, and then create a new branch and opt to bring some of the conflicting changes with me, I end up with a short error message and my changes appear to be lost. I would expect my changes to be visible and the error message to be more helpful and descriptive.

  6. kuychaco commented on Aug 8, 2019

    @kuychaco
    Contributor

    @tierninho I tried to reproduce this based on the steps you outlined in the body of this issue and was unable to (on development a6a2bf7). The new branch branch-b was checked out successfully and changes brought over, with a resulting merge conflict. @outofambit also failed to reproduce on their machine with 2.1.1-beta3.

    We do, however, see the same error in the console Unable to switch branches as there are working directory changes which would be overwritten.. Which seems puzzling because the UI shows that the branch switching was successful.

    And it seems like the error in #7827 (comment) might be a separate but related... specifically showing up when untracked files are involved.

    Could you please see if you could still reproduce this on dev?

  7. self-assigned this
    on Aug 8, 2019
  8. tierninho commented on Aug 8, 2019

    @tierninho
    ContributorAuthor

    @kuychaco So I tested the steps again on v2.1.0 and could not reproduce the bug. After Step 6, I ended up in this state while testing:

    Screen Shot 2019-08-08 at 1 46 25 PM

    I too received the console error and the file I changed was marked as conflicted as expected.

    I believe the error is related to Step 7 in the initial comment. The logic is trying to switch back to previous branch, but can't as the merge conflicted file "blocks" it. The console shows the error and the UI shows the conflicted file.

    I will try similar scenarios to see if I can trip it up.

  9. kuychaco commented on Aug 9, 2019

    @kuychaco
    Contributor

    Ah I see, so maybe there's a bug related to switching branches and carrying over conflicted changes...? I can definitely dig into that once you're able to find solid repro steps.

    And it seems like the error in #7827 (comment) might be a separate but related... specifically showing up when untracked files are involved.

    ☝️ extracted this into a separate issue (#8084) since it's a bug specifically related to untracked files

  10. tierninho commented on Aug 9, 2019

    @tierninho
    ContributorAuthor

    So I can reproduce this with untracked files but we are siphoned this specific issue off into #8084

    I am therefore going to close this bug for now in light of #8084 and as I believe they are the same underlying issue, ie: Attempting to stash files that conflict with existing files on the target branch will fail.

    I do not think creating a new branch is directly related, it is just an extra step in the same process.

    Happy to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugepic:stashingpriority-2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions