seachicken / gh-poi

✨ Safely clean up your local branches
https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
MIT License
673 stars 19 forks source link

Fails when a branch name matches a directory name #64

Closed corbob closed 2 years ago

corbob commented 2 years ago

Describe the bug

I have a branch named tests and the git repository has a directory named tests. This results in the git log --first-parent --max-count=30 --format=%H tests call failing. According to the error output from git this can be resolved by appending -- to the existing command to denote that the tests being referenced is a revision and not a file.

2022-06-24_08-28-44
~/git/chocolatey/choco [develop ≡]> gh poi
✕ Fetching pull requests...
failed to run external command: git, args: [log --first-parent --max-count=30 --format=%H tests]
exit status 128
~/git/chocolatey/choco [develop ≡]> git log --first-parent --max-count=30 --format=%H tests   
fatal: ambiguous argument 'tests': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
~/git/chocolatey/choco [develop ≡]> git log --first-parent --max-count=30 --format=%H tests --
5f8887de82aefb45f0315cf4225d3302fa050507
546113291cc9e81aa179a2495ce5a8d271f37391
cbba584692e2d02012e3eb03ba366b63d741d110
9a2b91f59c2ff8e052813e44f5e66c745395ff8c
1df303186b1a795e8bbaaffe9df428940e24ea97
a418b8f9b06270f0db4069e1221e4ba027e57eb3
2390806810b3ec259a78210e0157c21c3ed2ae1a
a30fa79913f4571a6cdad518635e1fbdfcfedcb5
edb0721d1fc901cb1f3f41aa8f84ed72d39ebfa6
ab61d531cad8460fb42246d3021cdb80c0023c9f
9ebdc627a7ff8b96de797c10315d2cc3b7dd3208
ca6511b52a1bef5a60f4430f85313985aeb28353
e3d39f410f469203c3e70df05a018c57d7f00787
c6f1c35aba8cc65b76b5c4ef581a2bd09ef6ea96
3e6f778f551720013921ac0b2d0991d5e583c9b1
483a551e2caa7a6c1b620512a95426b8a6f070d3
28e8bc26f92564273db80019d66576d71d3b976b
2dad2d47895ab87efdee2580bbb030e3994452bb
1a969c22a36ef1c8b35d9d28e895552d308b13fa
ed34ee73c364da5a698d17e8200992af152cb84a
cb5d5f1cac6f9f05096baa0af7361bbb9547cea5
9a61954a9e2a47c8604946c28c327b49652b20e7
66281ed2459e0a222be290691e1b81bd4a593a3a
72e62bd9a37c3e4ad5b0b12db21d51d002cc17a0
5784d931ca7f8aad92dd50a81671c304bcd20626
415cc7fb4c6d968849b748cbad7629c1bd852a49
0b2f41c3e570f88af0353bcaaa5057aadf124cc7
4353138d7c305ae90522e73bf0f9e475b0a9a9c9
7f1ed0b7620bb56aa30b8250e2a4d0f8712e21c0
5d1db42329d79579da95fa4c4f7375116acbdcf7
~/git/chocolatey/choco [develop ≡]> git branch 
  InstallCommand
  add_dev_vagrant
  add_husky
  add_tests
  choco_add_tests
* develop
  filter-invalid-features
  master
  testing
  tests

Your Environment

seachicken commented 2 years ago

Thank you for the clear issue and solution! I released now, please gh extension upgrade seachicken/gh-poi