{"thread":{"id":"42905","subject":"[PATCH 0/3] minor git-jump improvements","startedAt":"2016-07-22T16:27:15Z","lastAt":"2016-07-24T15:33:00Z","messageCount":7,"participants":["Jeff King","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"291971","messageId":"20160722162707.GA13905@sigill.intra.peff.net","threadId":"42905","inReplyTo":null,"subject":"[PATCH 0/3] minor git-jump improvements","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-22T16:27:07Z","receivedAt":"2016-07-22T16:27:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Here are a few quick fixes and features for git-jump. The first is a bug\nI noticed and fixed recently. And that reminded me of the second one,\nwhich I'd been carrying in my local copy for a long time.\n\n  [1/3]: contrib/git-jump: fix greedy regex when matching hunks\n  [2/3]: contrib/git-jump: add whitespace-checking mode\n  [3/3]: contrib/git-jump: fix typo in README\n\n-Peff\n"},{"id":"291972","messageId":"20160722162844.GA14080@sigill.intra.peff.net","threadId":"42905","inReplyTo":"20160722162707.GA13905@sigill.intra.peff.net","subject":"[PATCH 1/3] contrib/git-jump: fix greedy regex when matching hunks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-22T16:28:44Z","receivedAt":"2016-07-22T16:28:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The hunk-header regex looks for \"\\+\\d+\" to find the\npost-image line numbers, but it skips the pre-image line\nnumbers with a simple \".*\". That means we may greedily eat\nthe post-image numbers and match a \"\\+\\d\" further on, in the\nfuncname text.\n\nFor example, commit 6b9c38e has this hunk header:\n\n  diff --git a/t/t0006-date.sh b/t/t0006-date.sh\n  [...]\n  @@ -50,8 +50,8 @@ check_show iso-local \"$TIME\" '2016-06-15 14:13:20 +0000'\n\nIf you run:\n\n  git checkout 6b9c38e\n  git jump diff HEAD^ t/\n\nit will erroneously match \"+0000\" as the starting line\nnumber and jump there, rather than line 50.\n\nWe can fix it by just making the \"skip\" regex non-greedy,\ntaking the first \"+\" we see, which should be the post-image\nline information.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n contrib/git-jump/git-jump | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex dc90cd6..1f1b996 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -25,7 +25,7 @@ mode_diff() {\n \tperl -ne '\n \tif (m{^\\+\\+\\+ (.*)}) { $file = $1; next }\n \tdefined($file) or next;\n-\tif (m/^@@ .*\\+(\\d+)/) { $line = $1; next }\n+\tif (m/^@@ .*?\\+(\\d+)/) { $line = $1; next }\n \tdefined($line) or next;\n \tif (/^ /) { $line++; next }\n \tif (/^[-+]\\s*(.*)/) {\n-- \n2.9.2.506.g8452fe7\n\n"},{"id":"291973","messageId":"20160722162945.GB14080@sigill.intra.peff.net","threadId":"42905","inReplyTo":"20160722162707.GA13905@sigill.intra.peff.net","subject":"[PATCH 2/3] contrib/git-jump: add whitespace-checking mode","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-22T16:29:46Z","receivedAt":"2016-07-22T16:29:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"If you have whitespace errors in lines you've introduced, it\ncan be convenient to be able to jump directly to them for\nfixing.  You can't quite use \"git jump diff\" for this,\nbecause though it passes arbitrary options to \"git diff\", it\nexpects to see an actual unified diff in the output.\n\nWhereas \"git diff --check\" actually produces lines that look\nlike compiler quickfix lines already, meaning we just need\nto run it and feed the output directly to the editor.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n contrib/git-jump/git-jump | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 1f1b996..427f206 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -12,6 +12,8 @@ diff: elements are diff hunks. Arguments are given to diff.\n merge: elements are merge conflicts. Arguments are ignored.\n \n grep: elements are grep hits. Arguments are given to grep.\n+\n+ws: elements are whitespace errors. Arguments are given to diff --check.\n EOF\n }\n \n@@ -55,6 +57,10 @@ mode_grep() {\n \t'\n }\n \n+mode_ws() {\n+\tgit diff --check \"$@\"\n+}\n+\n if test $# -lt 1; then\n \tusage >&2\n \texit 1\n-- \n2.9.2.506.g8452fe7\n\n"},{"id":"291974","messageId":"20160722163057.GC14080@sigill.intra.peff.net","threadId":"42905","inReplyTo":"20160722162707.GA13905@sigill.intra.peff.net","subject":"[PATCH 3/3] contrib/git-jump: fix typo in README","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-22T16:30:58Z","receivedAt":"2016-07-22T16:31:05Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Signed-off-by: Jeff King <peff@peff.net>\n---\n contrib/git-jump/README | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 1cebc32..202b499 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -83,7 +83,7 @@ complete list of files and line numbers for each match.\n Limitations\n -----------\n \n-This scripts was written and tested with vim. Given that the quickfix\n+This script was written and tested with vim. Given that the quickfix\n format is the same as what gcc produces, I expect emacs users have a\n similar feature for iterating through the list, but I know nothing about\n how to activate it.\n-- \n2.9.2.506.g8452fe7\n"},{"id":"291975","messageId":"20160722163518.GA14600@sigill.intra.peff.net","threadId":"42905","inReplyTo":"20160722162945.GB14080@sigill.intra.peff.net","subject":"[PATCH v2 2/3] contrib/git-jump: add whitespace-checking mode","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-22T16:35:19Z","receivedAt":"2016-07-22T16:35:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jul 22, 2016 at 12:29:45PM -0400, Jeff King wrote:\n\n> If you have whitespace errors in lines you've introduced, it\n> can be convenient to be able to jump directly to them for\n> fixing.  You can't quite use \"git jump diff\" for this,\n> because though it passes arbitrary options to \"git diff\", it\n> expects to see an actual unified diff in the output.\n> \n> Whereas \"git diff --check\" actually produces lines that look\n> like compiler quickfix lines already, meaning we just need\n> to run it and feed the output directly to the editor.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  contrib/git-jump/git-jump | 6 ++++++\n>  1 file changed, 6 insertions(+)\n\nWhoops. I updated the README, too, but forgot to actually commit it.\nHere's an updated patch.\n\n-- >8 --\nSubject: contrib/git-jump: add whitespace-checking mode\n\nIf you have whitespace errors in lines you've introduced, it\ncan be convenient to be able to jump directly to them for\nfixing.  You can't quite use \"git jump diff\" for this,\nbecause though it passes arbitrary options to \"git diff\", it\nexpects to see an actual unified diff in the output.\n\nWhereas \"git diff --check\" actually produces lines that look\nlike compiler quickfix lines already, meaning we just need\nto run it and feed the output directly to the editor.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n contrib/git-jump/README   | 4 +++-\n contrib/git-jump/git-jump | 6 ++++++\n 2 files changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 1cebc32..3e0b65b 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -29,7 +29,7 @@ Obviously this trivial case isn't that interesting; you could just open\n `foo.c` yourself. But when you have many changes scattered across a\n project, you can use the editor's support to \"jump\" from point to point.\n \n-Git-jump can generate three types of interesting lists:\n+Git-jump can generate four types of interesting lists:\n \n   1. The beginning of any diff hunks.\n \n@@ -37,6 +37,8 @@ Git-jump can generate three types of interesting lists:\n \n   3. Any grep matches.\n \n+  4. Any whitespace errors detected by `git diff --check`.\n+\n \n Using git-jump\n --------------\ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 1f1b996..427f206 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -12,6 +12,8 @@ diff: elements are diff hunks. Arguments are given to diff.\n merge: elements are merge conflicts. Arguments are ignored.\n \n grep: elements are grep hits. Arguments are given to grep.\n+\n+ws: elements are whitespace errors. Arguments are given to diff --check.\n EOF\n }\n \n@@ -55,6 +57,10 @@ mode_grep() {\n \t'\n }\n \n+mode_ws() {\n+\tgit diff --check \"$@\"\n+}\n+\n if test $# -lt 1; then\n \tusage >&2\n \texit 1\n-- \n2.9.2.506.g8452fe7\n\n"},{"id":"292034","messageId":"alpine.DEB.2.20.1607231050360.14111@virtualbox","threadId":"42905","inReplyTo":"20160722162707.GA13905@sigill.intra.peff.net","subject":"Re: [PATCH 0/3] minor git-jump improvements","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-23T08:52:09Z","receivedAt":"2016-07-23T08:53:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Peff,\n\nOn Fri, 22 Jul 2016, Jeff King wrote:\n\n> Here are a few quick fixes and features for git-jump. The first is a bug\n> I noticed and fixed recently. And that reminded me of the second one,\n> which I'd been carrying in my local copy for a long time.\n> \n>   [1/3]: contrib/git-jump: fix greedy regex when matching hunks\n>   [2/3]: contrib/git-jump: add whitespace-checking mode\n>   [3/3]: contrib/git-jump: fix typo in README\n\nThese 3 patches look good to me.\n\nThey also made me aware of git-jump's existence and purpose. I think I\nshall use this script a lot myself from now on.\n\nThanks,\nDscho\n"},{"id":"292058","messageId":"20160724153251.GA32609@sigill.intra.peff.net","threadId":"42905","inReplyTo":"alpine.DEB.2.20.1607231050360.14111@virtualbox","subject":"Re: [PATCH 0/3] minor git-jump improvements","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-24T15:32:51Z","receivedAt":"2016-07-24T15:33:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jul 23, 2016 at 10:52:09AM +0200, Johannes Schindelin wrote:\n\n> On Fri, 22 Jul 2016, Jeff King wrote:\n> \n> > Here are a few quick fixes and features for git-jump. The first is a bug\n> > I noticed and fixed recently. And that reminded me of the second one,\n> > which I'd been carrying in my local copy for a long time.\n> > \n> >   [1/3]: contrib/git-jump: fix greedy regex when matching hunks\n> >   [2/3]: contrib/git-jump: add whitespace-checking mode\n> >   [3/3]: contrib/git-jump: fix typo in README\n> \n> These 3 patches look good to me.\n> \n> They also made me aware of git-jump's existence and purpose. I think I\n> shall use this script a lot myself from now on.\n\nYay, now there are at least 2 users.\n\nBug reports and patches very welcome. :)\n\n-Peff\n"}]}