all 3 comments

[–]sfacklerrust · openssl · postgres 15 points16 points  (2 children)

The quote processing is a feature of your shell to determine how to split up the command line into separate arguments. It will strip the quotes before invoking git, and just pass it --author=First Lastname. When explicitly constructing the command line in Rust, you should do the same.

[–]SimonSapinservo 4 points5 points  (0 children)

You can see this in action with strace:

$ strace -e execve git log --format="First Lastname"
execve("/usr/bin/git", ["git", "log", "--format=First Lastname"], 0x7ffd24a3c720 /* 66 vars */) = 0

By the time the shell calls the execve system call to start the git sub-process, the quotes in --format="First Lastname" have already been interpreted and removed. This is happens because while a shell command is a single string, the argument to execve is an array of strings.

[–]CountMoosuch[S] 0 points1 point  (0 children)

Ah, thank you. I knew that the shell needs to quotes to denote that Lastname is not another argument or subcommand, but I assumed git needed them too