GitLab has a few push options for which I'd like to create switches in magit-push's transient.

Causing -n to add -oci.skip is simple enough:

(transient-append-suffix 'magit-push "-n" '("-s" "skip CI" "-oci.skip"))

I would also like that -m adds three different options (-omerge_request.create, -omerge_request.merge_when_pipeline_succeeds, and -omerge_request.remove_source_branch). The following code fails to achieve that goal:

(transient-append-suffix 'magit-push "-n"
  '("-m" "auto-merge on success" 
    "-omerge_request.create -omerge_request.merge_when_pipeline_succeeds -omerge_request.remove_source_branch"))

The above causes the string containing the three options to be passed as a single argument to git push. I.e., the spaces are not argument separators, but belong to the argument.

Unfortunately, git wants to receive these as three arguments. I could make three different switches in magit-pull, but that would be cumbersome to use. I'd prefer to have a single switch that activates these three arguments. How can I do that?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.