Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --commit-args command line option to cz commit #451

Closed
adamcunnington-mlg opened this issue Nov 5, 2021 · 15 comments · Fixed by #621
Closed

Add --commit-args command line option to cz commit #451

adamcunnington-mlg opened this issue Nov 5, 2021 · 15 comments · Fixed by #621

Comments

@adamcunnington-mlg
Copy link

Given cz commit wraps git commit, it would be great to be able to pass arbitrary args to the underlying git commit. This is a common pattern, for example, pip-tools' pip-compile has a --pip-args option.

Specifically, I need to be able to pass --no-verify to some commits to occasionally brute force supress hooks but I think you can just allow the user to pass a string of arbitrary --commit-args to cz commit which you then pass through to git commit.

@adamcunnington-mlg adamcunnington-mlg added the type: feature A new enhacement proposal label Nov 5, 2021
@Bogay
Copy link
Contributor

Bogay commented Apr 7, 2022

I am interesting to implementing this feature.
But some of git arguments might conflict with cz arguments?
For example, cz c --commit-args -m foo should be invalid because the commit message will be generated by cz?
I am not sure how to process these cases. Just ignore them or print a warning?

@woile
Copy link
Member

woile commented Apr 7, 2022

It seems similar to this discussion:
#248

Which of all the proposed methods would be best?
Alternatively we can manually add one by one as they are required (which might not be the best)

@Bogay
Copy link
Contributor

Bogay commented Apr 7, 2022

@woile I read the discussion of #248 and I think -- is a good idea.
About handling invalid arguments, I come up with two approach:

  1. Directly pass all arguments after -- to git commit and let git handle them. Leave the responsibility of giving correct args to the user. But there are so many edge cases might brake cz's behavior, which affects the UX.
  2. Add a whitelist to filter which argument can use. For example, -S/--gpg-sign, -s/--signoff, -n/--no-verify. At least I saw issues which discuss about these features. But this is less flexible if the whitelist is hard-coded in source.

@Lee-W
Copy link
Member

Lee-W commented Apr 11, 2022

I like the first solution a bit more. @woile what do you think?

@adamcunnington-mlg
Copy link
Author

Hi all, thanks for the consideration on this ticket. Really keen for this - is anyone picking it up?

@Lee-W
Copy link
Member

Lee-W commented May 6, 2022

@adamcunnington-mlg AFAIK, no one is picking it. Feel free to create a PR if you're interested in it. Thanks!

@adamcunnington-mlg
Copy link
Author

I've not had chance to pick this up but would really love this

@woile
Copy link
Member

woile commented Oct 11, 2022 via email

@SCrocky
Copy link
Contributor

SCrocky commented Oct 12, 2022

Is anybody working on this?

@Lee-W
Copy link
Member

Lee-W commented Oct 13, 2022

AFAIK, there's no one working on it. Feel free to take it :)

SCrocky pushed a commit to SCrocky/commitizen that referenced this issue Oct 26, 2022
… for `cz commit` command

Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git`

Closes commitizen-tools#451
@SCrocky SCrocky mentioned this issue Nov 26, 2022
4 tasks
@adamcunnington-mlg
Copy link
Author

@Lee-W did anyone review @SCrocky's MR?

@Lee-W
Copy link
Member

Lee-W commented Dec 15, 2022

Hi @adamcunnington-mlg, I just took a look. The idea is great. But we still need some test and doc

SCrocky pushed a commit to SCrocky/commitizen that referenced this issue May 13, 2023
… for `cz commit` command

Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git`

Closes commitizen-tools#451
@SCrocky
Copy link
Contributor

SCrocky commented May 14, 2023

@Lee-W I've added tests on the raises.

I wanted to add a test on successfully passing the extra arguments to the git.commit call, but I'm having a hard time mocking the commands.commit.Commit.__call__ in a way that will allow me to test the arguments property.

As for documentation, I can spare the time to add it. Did you have anything in mind?

@SCrocky
Copy link
Contributor

SCrocky commented May 14, 2023

Added some simple documentation for the syntax in docs/commit.md

SCrocky pushed a commit to SCrocky/commitizen that referenced this issue Sep 24, 2023
… for `cz commit` command

Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git`

Closes commitizen-tools#451
@SCrocky
Copy link
Contributor

SCrocky commented Sep 24, 2023

Modifications done, branch rebased, ready for next round

SCrocky pushed a commit to SCrocky/commitizen that referenced this issue Oct 2, 2023
… for `cz commit` command

Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git`

Closes commitizen-tools#451
Lee-W pushed a commit that referenced this issue Oct 17, 2023
… for `cz commit` command

Additional edits were made in class `commitizen.commands.Commit` and `commit` func from `commitizen.git`

Closes #451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants