nemisj / git-removed-branches

Git: List or remove local tracked branches, which are deleted from the remote.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not finding branch name

IgorRebeche opened this issue · comments

Hello, today i tried to prune my branches using your approach but when i tried to delete some error occurred as you can see in the screenshot
image

I think it can be a problem with the deleteBranches implementation in find-stale.js.
It is using single quotes

i would change the line 256

var exec = utils.asyncExec(['git', 'branch', dFlag, "'" + branchName + "'"]);

To

var exec = utils.asyncExec(['git', 'branch', dFlag, branchName ]);

I am using windows, maybe in linux could work with single quote but i didn't test yet

I'm having the same issue. I want to add extra information:
If I get the error:

ERROR: Unable to remove: Command failed: git branch -D 'feature/add-button'
error: branch ''feature/add-button'' not found.

But if I run the exact same command (with the single quote) in the console manually, it works as expected:

 C:\Code\Project\*****> git branch -D 'feature/add-button'
 Deleted branch feature/add-button (was *****).

I'm running this on Windows

Hi,

I've made that change because of #6 in #8 . It works on macOS and Linux. I'll try to figure it out what's different on Windows and make a fix for it.

@erkage @nemisj I confirm: It works on macOS. It does not work on Win.

I can run both git branch -d 'foo' and git branch -d foo successfully on my mac.

My Win colleagues can run git branch -d foo successfully, but when they run git branch -d 'foo', they get the Error
branch ''foo'' not found

Even on v1.0.4? @DerZyklop

@nemisj yes. We are on 1.0.4 for ~two months now.

@nemisj which makes sense. With 1.0.3 the problematic single quotes came in. The 1.0.4 release only contains text changes in README.md

@DerZyklop yes, indeed, sorry.
I will have a look at this one.

1.0.5 should fix that @DerZyklop @IgorRebeche, can you please confirm?
@IgorRebeche, sorry for such a long answer, there is some issues with notifications to my email, haven't seen your message.

Tested it with 2.0.1 on Mac and Win.
Confirmed. Bug is fixed.
Thank you 💚

@rhalaly Thanks for reporting, but your issue is not related to this ticket. And it’s also not a bug.

The message says "branch … is not fully merged". This means the branch exists, and the git-removed-branches command could find it, but It contains changes that have not been merged into your main branch yet.

@DerZyklop it was a false alarm, indeed. Sorry!