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

[PATCH/RFC] bash: add --word-diff option to diff auto-completion

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 13, 2011, 19:14 UTC
Message-ID
<20110913191448.GC14917@elie>
In-Reply-To
<4E6FA541.7000100@yahoo.com.br>
From: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
Date: Tue, 13 Sep 2011 15:24:38 -0300

Add "--word-diff" to diff completion, since this is a common desired option when looking at diffs.

Signed-off-by: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
---
Hi Gábor,
Here's a patch.  What do you think?

I was thinking it would be nice to complete --word-diff-regex, too, and to be able to do

	git diff --color-words=<TAB>
	git diff --word-diff=<TAB>

but I couldn't find any examples of the latter to crib from, so I've left the patch unmangled except for stealing a patch description from a separate email.

Rodrigo Rosenfeld Rosas wrote:
> I use Thunderbird, but couldn't find all options as instructed in 'git help
> format-patch'.

Indeed, sending patches unmangled seems to be a common difficult step when starting to contribute to projects like linux and git. I wonder if it would make sense to include some sort of patch-sending-reviewing-tweaking-and-receiving tutorial to point to in the documentation.

Thanks for keeping the completion code in good shape. Jonathan

 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8648a36..f4aaffe 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1300,7 +1300,7 @@ _git_describe ()
 
 __git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch-with-stat --name-only --name-status --color
-			--no-color --color-words --no-renames --check
+			--no-color --color-words --word-diff --no-renames --check
 			--full-index --binary --abbrev --diff-filter=
 			--find-copies-harder
 			--text --ignore-space-at-eol --ignore-space-change
-- 
1.7.5.4
Next: SZEDER Gábor
Message 1 of 5 in “bash: add --word-diff option to diff auto-completion”
  1. bash: add --word-diff option to diff auto-completionJonathan Nieder, Sep 13, 2011
  2. SZEDER GáborSep 13, 2011
  3. SZEDER GáborSep 13, 2011
  4. Rodrigo Rosenfeld RosasSep 16, 2011
  5. Jonathan NiederSep 16, 2011

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.