jasonmccreary / git-trim

MIT License
367 stars 10 forks source link

BUG: git trim -p listing files as branches #10

Closed the-dijkstra closed 2 years ago

the-dijkstra commented 2 years ago

Description

Not sure what went wrong with the filter branch. But running git trim -p --dry-run is showing the following output:

app will be deleted.
artisan will be deleted.
bin will be deleted.
bootstrap will be deleted.
composer.json will be deleted.
composer.lock will be deleted.
composer.scan.php will be deleted.
config will be deleted.
database will be deleted.
deploy.php will be deleted.
_ide_helper_models.php will be deleted.
_ide_helper.php will be deleted.
packages will be deleted.
phpstan.neon will be deleted.
phpunit.xml will be deleted.
public will be deleted.
README.md will be deleted.
resources will be deleted.
routes will be deleted.
server.php will be deleted.
storage will be deleted.
tests will be deleted.
vendor will be deleted.

PS: I'm inside a Laravel project. Release before 0.2.0 was working just fine.

the-dijkstra commented 2 years ago

@jasonmccreary I'm on (#139167a)

image

jasonmccreary commented 2 years ago

Seems like it's expanding the * that might be returned from the branch output...

the-dijkstra commented 2 years ago

@jasonmccreary I guess it is yes, because here is the output I get when running LANG=C git branch -vv | awk '/: gone]/{print $1}'

*
jasonmccreary commented 2 years ago

Yeah. Let me see if I can reproduce it locally and tweak that command to remove the current branch.

jasonmccreary commented 2 years ago

Seems like this would occur if the current branch were pruned. Which seems a bit odd.

Either way, I have added logic to exclude the current branch from the list of branches. Please check the code from main and if it works, I'll tag 0.2.1.

the-dijkstra commented 2 years ago

@jasonmccreary it works, but would it be normal ?, that the script now is taking some time to show output ? Compared to the other flags which show output immediately

jasonmccreary commented 2 years ago

Yes, if you have a lot of remotes or a slow internet connection as this command runs fetch underneath.

I would expect subsequent runs to be faster though.

the-dijkstra commented 2 years ago

Actually, you are right. I forget that we are pruning, so it would be obvious that we do a fetch.