contrib/git-jump: add whitespace-checking mode
authorJeff King <peff@peff.net>
Fri, 22 Jul 2016 16:35:19 +0000 (12:35 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jul 2016 19:33:58 +0000 (12:33 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/git-jump/README
contrib/git-jump/git-jump
index 1cebc328cbfa1daffd1e0ce9f4fe1807140340d5..3e0b65b9b38c1c6bed6d4caf9c4fa72148d9f701 100644 (file)
@@ -29,7 +29,7 @@ Obviously this trivial case isn't that interesting; you could just open
 `foo.c` yourself. But when you have many changes scattered across a
 project, you can use the editor's support to "jump" from point to point.
 
-Git-jump can generate three types of interesting lists:
+Git-jump can generate four types of interesting lists:
 
   1. The beginning of any diff hunks.
 
@@ -37,6 +37,8 @@ Git-jump can generate three types of interesting lists:
 
   3. Any grep matches.
 
+  4. Any whitespace errors detected by `git diff --check`.
+
 
 Using git-jump
 --------------
index 1f1b996be1d4e68c54c53a6163f11b04f7bc4aad..427f206a45b326f2ee80af0fae7080d5f794c14a 100755 (executable)
@@ -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