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

[PATCH v2] completion: add diff --color-moved[-ws]

From
Kir Kolyshkin <kolyshkin@gmail.com>
Date
Feb 21, 2020, 20:15 UTC
Message-ID
<20200221201545.1244861-1-kolyshkin@gmail.com>
In-Reply-To
<20200220214647.451064-1-kolyshkin@gmail.com>

These options are available since git v2.15, but somehow eluded from the completion script.

Note that while --color-moved-ws= accepts comma-separated list of values, there is no (easy?) way to make it work with completion (see e.g. [1]).

[1]: https://github.com/scop/bash-completion/issues/240
[v2: added missing ignore-space-change]
Acked-by: Matheus Tavares Bernardino <matheus.bernardino@usp.br>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
---
 contrib/completion/git-completion.bash | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1aac5a56c0..348f0c0c57 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1487,9 +1487,16 @@ __git_diff_algorithms="myers minimal patience histogram"
 
 __git_diff_submodule_formats="diff log short"
 
+__git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
+
+__git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
+			ignore-all-space allow-indentation-change"
+
 __git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch-with-stat --name-only --name-status --color
 			--no-color --color-words --no-renames --check
+			--color-moved --color-moved= --no-color-moved
+			--color-moved-ws= --no-color-moved-ws
 			--full-index --binary --abbrev --diff-filter=
 			--find-copies-harder --ignore-cr-at-eol
 			--text --ignore-space-at-eol --ignore-space-change
@@ -1520,6 +1527,14 @@ _git_diff ()
 		__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
 		return
 		;;
+	--color-moved=*)
+		__gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}"
+		return
+		;;
+	--color-moved-ws=*)
+		__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
+		return
+		;;
 	--*)
 		__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
 			--base --ours --theirs --no-index
-- 
2.24.1
Previous: Kirill KolyshkinNext: Matheus Tavares
Message 5 of 8 in “completion: add diff --color-moved[-ws]”
  1. completion: add diff --color-moved[-ws]Kir Kolyshkin, Feb 20, 2020
  2. Matheus Tavares BernardinoFeb 20, 2020
  3. Matheus Tavares BernardinoFeb 21, 2020
  4. Kirill KolyshkinFeb 21, 2020
  5. completion: add diff --color-moved[-ws]Kir Kolyshkin, Feb 21, 2020
  6. Matheus TavaresFeb 23, 2020
  7. Kirill KolyshkinFeb 24, 2020
  8. Matheus Tavares BernardinoFeb 24, 2020

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.