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

[Fix] quotes escape in stash/commit messages #21

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ let commit message_words =
Process.proc "git add .";
match message with
| "" -> Process.proc "git commit"
| message ->
Process.proc @@ Printf.sprintf "git commit --message=\"%s\"" message
(* TODO: Escape quotes in message *)
| message -> Process.proc @@ Printf.sprintf "git commit --message=%S" message

let log commit =
(* Log format is:
Expand Down Expand Up @@ -127,8 +125,7 @@ let stash msg_opt =
let msg_arg =
match msg_opt with
| None -> ""
| Some msg ->
Printf.sprintf "--message='%s'" msg (* TODO: proper escaping *)
| Some msg -> Printf.sprintf "--message=%S" msg
in
Process.proc @@ Printf.sprintf "git stash push --include-untracked %s" msg_arg

Expand Down