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

Puff breaks when a rebase fails to merge #18

Closed
milesj opened this issue Apr 7, 2016 · 4 comments · Fixed by #24
Closed

Puff breaks when a rebase fails to merge #18

milesj opened this issue Apr 7, 2016 · 4 comments · Fixed by #24

Comments

@milesj
Copy link

milesj commented Apr 7, 2016

When you attempt a rebase, and one of the commits fail to merge, a handful of the commands no longer work. I had to solve this through the VCS support in my IDE.

Here's an example output:

Auto-merging package.json
CONFLICT (content): Merge conflict in package.json
Recorded preimage for 'package.json'
error: Failed to merge in the changes.
Patch failed at 0024 Updated package deps.
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

[10:18:39] miles_johnson:lux > gs
2016/04/07 10:18:54 Failed to parse branch name for output: [## HEAD (no branch)]
[10:18:54] miles_johnson:lux > git status
rebase in progress; onto ea3b6d7
You are currently rebasing branch 'milesj/new-header' on 'ea3b6d7'.
  (fix conflicts and then run "git rebase --continue")
  (use "git rebase --skip" to skip this patch)
  (use "git rebase --abort" to check out the original branch)

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

    both modified:   package.json

no changes added to commit (use "git add" and/or "git commit -a")
[10:20:34] miles_johnson:lux > ga 1
2016/04/07 10:21:18 Failed to parse branch name for output: [## HEAD (no branch)]
[10:21:18] miles_johnson:lux > git add package.json 
2016/04/07 10:21:21 Failed to parse branch name for output: [## HEAD (no branch)]
@mroth mroth added the bug label Apr 14, 2016
@dleve123
Copy link

@mroth Any thoughts on this issue? This looks like an awesome utility and I would be stoked to help address this.

@mroth
Copy link
Owner

mroth commented May 21, 2016

It looks like what's happening here is whatever state the repository is in in the middle of the failed rebase generates output that scmpuff fails to parse during branch extraction.

I'm traveling pretty extensive currently, if someone wants to start on this steps would be:

  1. Reliably generate the failing edge case above, and run a git status -z -b within a repo in that status to see what the output scmpuff will be looking at is.
  2. Once that's obtained, you'll probably want to integrate it into the test cases for commands/status/process_test.go, and look at testCasesExtractBranch as a failing test with the expected output.
  3. Fix this in commands/status/process.go (Currently this is regex-based, which is a bit icky, but such is life...)

(If someone is not familiar with Go but wants to get involved, step 1 would be helpful in itself as added info as a comment in this issue!)

@adamv
Copy link

adamv commented Jul 29, 2016

The bug report contains the string the branch is trying to be extracted from: ## HEAD (no branch)

@bingocaller
Copy link

I just wanted to chime in and say that I can reproduce this consistently whenever I'm doing a rebase and there's a conflict. As @adamv pointed out it seems scmpuff is choking on this string: ## HEAD (no branch).

I had a look through commands/status/process.go and found the culprit inside the decodeBranchName function.
I tried fiddling around with an updated RegEx and came up with this:

re := regexp.MustCompile(`^## (?:Initial commit on )?(?:(\S+?)(?:\.{3}|$)|(?:HEAD \(no branch\)))`)

This seems to work to the extent that it will either match an actual branch name or this specific string. However, I am by no means a RegEx expert, nor have I ever worked with Go before, so if anyone has a less hard-coded and more robust solution to this problem that would be much preferred.
Also, I haven't been able to actually test this inside scmpuff yet. I can try to pull down the project tomorrow, get it set up and run some tests then.

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

Successfully merging a pull request may close this issue.

5 participants