stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
2.02k stars 229 forks source link

Fix checking out branch names with / chars #113

Closed docwhat closed 4 years ago

docwhat commented 4 years ago

If git can't automatically figure out if the argument is a branch or a path, it will need to be told explicitly by using --:

Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Fixes: #106

docwhat commented 4 years ago

Here's a version of #106 that keeps using git checkout instead of git switch. 😃

stefanzweifel commented 4 years ago

Thanks!

docwhat commented 4 years ago

Sorry about not updating the tests. I didn't realize you were mocking git.

stefanzweifel commented 4 years ago

@docwhat No problem. Those tests are all really new (and a bit complicated). I don't expect contributors to update those.

docwhat commented 4 years ago

I would recommend not mocking git and instead use real git and a known repository instead. e.g. your own repo.

That way you are testing the functionality of the code and can prevent regressions.

stefanzweifel commented 4 years ago

@docwhat Thanks for the advice. I'm aware of that problem.

I even mentioned it in the PR which added the tests (#109) and it has become painfully clear in this PR that it's not the way to go forward. :)