git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Phil Hord <phil.hord@gmail.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 0/2] Improve diffcore-pickaxe documentation
Date: Fri, 17 May 2013 17:53:21 +0530	[thread overview]
Message-ID: <1368793403-4642-1-git-send-email-artagnon@gmail.com> (raw)

[1/2] is unchangd, but [2/2] has some major changes: thanks to inputs
from Junio and Phil.  The inter-diff for [2/2] follows.

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 765abc5..b61a666 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -383,13 +383,13 @@ ifndef::git-format-patch[]
 	that matches other criteria, nothing is selected.
 
 -S<string>::
-	Look for commits where the specified string was added or
-	removed.  More precisely, find commits that change the number
-	of occurrences of the specified string.
+	Look for commits that change the number of occurrences of the
+	specified string (i.e. addition/ deletion) in a file.
+	Intended for the scripter's use.
 +
-It is often useful when you're looking for an exact string (like a
-function prototype), and want to know the history of that string since
-it first came into being.
+It is especially useful when you're looking for an exact block of code
+(like a struct), and want to know the history of that block since it
+first came into being.
 
 -G<regex>::
 	Grep through the patch text of commits for added/removed lines
@@ -419,8 +419,8 @@ information.
 	in <string>.
 
 --pickaxe-regex::
-	Make the <string> not a plain string but an extended POSIX
-	regex to match.  Implied when using `-G`.
+	Treat the <string> not as a plain string, but an extended
+	POSIX regex to match.  It is implied when `-G` is used.
 endif::git-format-patch[]
 
 -O<orderfile>::
diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
index 39b9c51..d0f2b91 100644
--- a/Documentation/gitdiffcore.txt
+++ b/Documentation/gitdiffcore.txt
@@ -223,16 +223,16 @@ diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
 ---------------------------------------------------------------------
 
 There are two kinds of pickaxe: the S kind (corresponding to 'git log
--S') and the G kind (corresponding to 'git log -G').
+-S') and the G kind (mnemonic: grep; corresponding to 'git log -G').
 
 The S kind detects filepairs whose "result" side and "origin" side
-have different number of occurrences of specified string.  While
-rename detection works as usual, 'git log -S' cannot omit commits
-where a the small string being looked for is moved verbatim from one
-file to another (since the number of occurrences of that string
-changed in each of those two filepairs). The implementation
-essentially runs a count, and is significantly cheaper than the G
-kind.
+have different number of occurrences of specified string.  By
+definition, it will not detect in-file moves.  Also, when a commit
+moves a file wholesale without affecting the string being looked at,
+rename detection kicks in as usual, and 'git log -S' omits the commit
+(since the number of occurrences of that string didn't change in that
+rename-detected filepair).  The implementation essentially runs a
+count, and is significantly cheaper than the G kind.
 
 The G kind detects filepairs whose patch text has an added or a
 deleted line that matches the given regexp.  This means that it can
@@ -240,12 +240,16 @@ detect in-file (or what rename-detection considers the same file)
 moves.  The implementation of 'git log -G' runs diff twice and greps,
 and this can be quite expensive.
 
-A diffcore-pickaxe option worth mentioning: `--pickaxe-all`.  When not
-in effect, diffcore-pickaxe leaves only such filepairs that touch the
-specified string in its output.  When in effect, diffcore-pickaxe
-leaves all filepairs intact if there is such a filepair, or makes the
-output empty otherwise.  The latter behavior is designed to make
-reviewing of the changes in the context of the whole changeset easier.
+When `--pickaxe-regex` is used with `-S`, treat the <string> not as a
+plain string, but an extended POSIX regex to match.  It is implied
+when `-G` is used.
+
+When `--pickaxe-all` is not in effect, diffcore-pickaxe leaves only
+the filepairs that touch the specified string in its output.  When in
+effect, diffcore-pickaxe leaves all filepairs intact if there is such
+a filepair, or makes the output empty otherwise.  The latter behavior
+is designed to make reviewing of the changes in the context of the
+whole changeset easier.
 
 diffcore-order: For Sorting the Output Based on Filenames
 ---------------------------------------------------------


Ramkumar Ramachandra (2):
  diffcore-pickaxe: make error messages more consistent
  diffcore-pickaxe doc: document -S and -G properly

 Documentation/diff-options.txt | 37 ++++++++++++++++++++++++++-------
 Documentation/gitdiffcore.txt  | 47 +++++++++++++++++++++++++-----------------
 diffcore-pickaxe.c             |  2 +-
 3 files changed, 58 insertions(+), 28 deletions(-)

-- 
1.8.1.2.432.g070c57d

             reply	other threads:[~2013-05-17 12:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 12:23 Ramkumar Ramachandra [this message]
2013-05-17 12:23 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
2013-05-18  1:25   ` Junio C Hamano
2013-05-17 12:23 ` [PATCH 2/2] diffcore-pickaxe doc: document -S and -G properly Ramkumar Ramachandra
2013-05-18  1:24   ` Junio C Hamano
2013-05-19  7:33     ` Junio C Hamano
2013-05-24  9:37       ` Ramkumar Ramachandra
2013-05-24 14:58         ` Phil Hord
2013-05-24 16:01           ` Ramkumar Ramachandra
2013-05-24 16:54           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368793403-4642-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phil.hord@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).