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

[PATCH 2/3] contrib/git-jump: add whitespace-checking mode

From
Jeff King <peff@peff.net>
Date
Jul 22, 2016, 16:29 UTC
Message-ID
<20160722162945.GB14080@sigill.intra.peff.net>
In-Reply-To
<20160722162707.GA13905@sigill.intra.peff.net>

If you have whitespace errors in lines you've introduced, it can be convenient to be able to jump directly to them for fixing. You can't quite use "git jump diff" for this, because though it passes arbitrary options to "git diff", it expects to see an actual unified diff in the output.

Whereas "git diff --check" actually produces lines that look like compiler quickfix lines already, meaning we just need to run it and feed the output directly to the editor.

Signed-off-by: Jeff King <peff@peff.net>
---
 contrib/git-jump/git-jump | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
index 1f1b996..427f206 100755
--- a/contrib/git-jump/git-jump
+++ b/contrib/git-jump/git-jump
@@ -12,6 +12,8 @@ diff: elements are diff hunks. Arguments are given to diff.
 merge: elements are merge conflicts. Arguments are ignored.
 
 grep: elements are grep hits. Arguments are given to grep.
+
+ws: elements are whitespace errors. Arguments are given to diff --check.
 EOF
 }
 
@@ -55,6 +57,10 @@ mode_grep() {
 	'
 }
 
+mode_ws() {
+	git diff --check "$@"
+}
+
 if test $# -lt 1; then
 	usage >&2
 	exit 1
-- 
2.9.2.506.g8452fe7
Previous: Jeff KingNext: Jeff King
Message 3 of 7 in “minor git-jump improvements”
  1. 0/3 minor git-jump improvementsJeff King, Jul 22, 2016
  2. 1/3 contrib/git-jump: fix greedy regex when matching hunksJeff King, Jul 22, 2016
  3. 2/3 contrib/git-jump: add whitespace-checking modeJeff King, Jul 22, 2016
  4. 2/3 contrib/git-jump: add whitespace-checking modeJeff King, Jul 22, 2016
  5. 3/3 contrib/git-jump: fix typo in READMEJeff King, Jul 22, 2016
  6. Johannes SchindelinJul 23, 2016
  7. Jeff KingJul 24, 2016

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.