Closed milesj closed 7 years ago
@mroth Any thoughts on this issue? This looks like an awesome utility and I would be stoked to help address this.
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:
git status -z -b
within a repo in that status to see what the output scmpuff will be looking at is.commands/status/process_test.go
, and look at testCasesExtractBranch
as a failing test with the expected output.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!)
The bug report contains the string the branch is trying to be extracted from: ## HEAD (no branch)
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.
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: