git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug Report - Git does not require a space between shorthand flags and the commit-message

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jul 14, 2023, 00:48 UTC
Message-ID
<ZLCbWn2qXZhmf8XD@tapette.crustytoothpaste.net>
In-Reply-To
<fcdf19b3-269b-aa9f-38c2-d0f775524a89@student.kit.edu>
On 2023-07-13 at 13:04:37, uxecw wrote:
Show 15 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> Rebasing.
> I entered `git commit —amend` (one hypen istead of two) accidently and it
> passed as defacto `git commit —all —message "end"`.
> I think because of the missing space git should have rejected the given
> input.
> 
> What did you expect to happen? (Expected behavior)
> Input should have been rejected
> 
> What happened instead? (Actual behavior)
> `git commit —all —message "end"`

I believe this is standard Unix behaviour. One can combine single-character options, including a final single-character option that takes an argument, and the argument can be appended to the option.

For example, I frequently type "git commit -svS", and I could well type "git commit -svS0223b187" (my OpenPGP key ID). That also works similarly with OpenSSH: the command "ssh -CoUser=foo server" works just fine.

So I think it's best for Git to preserve the existing behaviour since it's standard for other tools as well (and, I believe, the POSIX-mandated behaviour).

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: uxecw
Message 2 of 2 in “Bug Report - Git does not require a space between shorthand flags and the commit-message”
  1. uxecwJul 13, 2023
  2. brian m. carlsonJul 14, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.