Browse Source

Merge branch 'jk/git-jump'

"git jump" script (in contrib/) has been updated a bit.

* jk/git-jump:
  contrib/git-jump: fix typo in README
  contrib/git-jump: add whitespace-checking mode
  contrib/git-jump: fix greedy regex when matching hunks
maint
Junio C Hamano 9 years ago
parent
commit
5569c01be8
  1. 6
      contrib/git-jump/README
  2. 8
      contrib/git-jump/git-jump

6
contrib/git-jump/README

@ -29,7 +29,7 @@ Obviously this trivial case isn't that interesting; you could just open @@ -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: @@ -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
--------------
@ -83,7 +85,7 @@ complete list of files and line numbers for each match. @@ -83,7 +85,7 @@ complete list of files and line numbers for each match.
Limitations
-----------

This scripts was written and tested with vim. Given that the quickfix
This script was written and tested with vim. Given that the quickfix
format is the same as what gcc produces, I expect emacs users have a
similar feature for iterating through the list, but I know nothing about
how to activate it.

8
contrib/git-jump/git-jump

@ -12,6 +12,8 @@ diff: elements are diff hunks. Arguments are given to diff. @@ -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
}

@ -25,7 +27,7 @@ mode_diff() { @@ -25,7 +27,7 @@ mode_diff() {
perl -ne '
if (m{^\+\+\+ (.*)}) { $file = $1; next }
defined($file) or next;
if (m/^@@ .*\+(\d+)/) { $line = $1; next }
if (m/^@@ .*?\+(\d+)/) { $line = $1; next }
defined($line) or next;
if (/^ /) { $line++; next }
if (/^[-+]\s*(.*)/) {
@ -55,6 +57,10 @@ mode_grep() { @@ -55,6 +57,10 @@ mode_grep() {
'
}

mode_ws() {
git diff --check "$@"
}

if test $# -lt 1; then
usage >&2
exit 1

Loading…
Cancel
Save