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

[PATCH/RFC resend] diff-options: make --patch a synonym for -p

From
Will Palmer <wmpalmer@gmail.com>
Date
May 13, 2010, 08:59 UTC
Message-ID
<1273741140.2516.15.camel@wpalmer.simply-domain>

Here we simply make --patch a synonym for -p, whose mnemonic was "patch" all along.

Signed-off-by: Will Palmer <wmpalmer@gmail.com>
---

Re-sending, as this seems to have slipped under the radar last time. In case a justification is non-obvious: -p has always meant "patch", and the synonym (-u) has a long-form. I always find myself typing out the long-form --patch, only to be surprised that it doesn't exist. This patch seeks to correct what I can only assume was an oversight.

 Documentation/diff-options.txt |    1 +
 diff.c                         |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index c9c6c2b..4a96859 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -21,6 +21,7 @@ endif::git-format-patch[]
 ifndef::git-format-patch[]
 -p::
 -u::
+--patch::
 	Generate patch (see section on generating patches).
 	{git-diff? This is the default.}
 endif::git-format-patch[]
diff --git a/diff.c b/diff.c
index d0ecbc3..8ea9f97 100644
--- a/diff.c
+++ b/diff.c
@@ -2722,7 +2722,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 	const char *arg = av[0];
 
 	/* Output format options */
-	if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
+	if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch"))
 		options->output_format |= DIFF_FORMAT_PATCH;
 	else if (opt_arg(arg, 'U', "unified", &options->context))
 		options->output_format |= DIFF_FORMAT_PATCH;
Next: Matthieu Moy
Message 1 of 3 in “diff-options: make --patch a synonym for -p”
  1. diff-options: make --patch a synonym for -pWill Palmer, May 13, 2010
  2. Matthieu MoyMay 13, 2010
  3. Jeff KingMay 13, 2010

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.