* [PATCH v4 0/2] Improve diffcore-pickaxe documentation
@ 2013-05-31 12:12 Ramkumar Ramachandra
2013-05-31 12:12 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
2013-05-31 12:12 ` [PATCH 2/2] diffcore-pickaxe doc: document -S and -G properly Ramkumar Ramachandra
0 siblings, 2 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-31 12:12 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano
Junio had some suggestions in the previous round. The inter-diff
follows.
Yeah, word-diff is a bit messy. Which brings me to: is it possible to
turn on word-diff only where heuristically appropriate? word-diff
applied on the rewrite of the first paragraph of gitdiffcore.txt is a
disaster, but okay everywhere else.
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index efb5dfe..a85288f 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -387,11 +387,11 @@ ifndef::git-format-patch[]
the specified string (i.e. addition/deletion) in a file.
Intended for the scripter's use.
+
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: use the feature iteratively to feed the interesting
block in the preimage back into `-S`, and keep going until you get the
very first version of the block.
-G<regex>::
Look for differences whose patch text contains added/removed
diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
index ef4c04a..c8b3e51 100644
--- a/Documentation/gitdiffcore.txt
+++ b/Documentation/gitdiffcore.txt
@@ -222,25 +222,27 @@ version prefixed with '+'.
diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
---------------------------------------------------------------------
[-There are two kinds of pickaxe:-]{+This transformation limits+} the [-S kind (corresponding-]{+set of filepairs+} to [-'git log-]
[--S')-]{+those that change+}
{+specified strings between the preimage+} and the [-G kind (mnemonic: grep; corresponding-]{+postimage in a certain+}
{+way. -S<block of text> and -G<regular expression> options are used+} to
[-'git log -G').-]{+specify different ways these strings are sought.+}
"-S<block of text>" detects filepairs whose preimage and postimage
have different number of occurrences of the specified block of text.
By definition, it will not detect in-file moves. Also, when a
changeset moves a file wholesale without affecting the interesting
string, [-rename detection-]{+diffcore-rename+} kicks in as usual, and `-S` omits the filepair
(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.-] When used with `--pickaxe-regex`, treat
the <block of text> as an extended POSIX regular expression to match,
instead of a literal string.
"-G<regular expression>" {+(mnemonic: grep)+} detects filepairs whose
textual diff has an added or a deleted line that matches the given
regular expression. This means that it [-can-]{+will+} detect in-file (or what
rename-detection considers the same file) [-moves.-]{+moves, which is noise.+} The
implementation runs diff twice and greps, and this can be quite
expensive.
When `-S` or `-G` are used without `--pickaxe-all`, only filepairs
that match their respective criterion are kept in the output. When
Ramkumar Ramachandra (2):
diffcore-pickaxe: make error messages more consistent
diffcore-pickaxe doc: document -S and -G properly
Documentation/diff-options.txt | 38 +++++++++++++++++++++++++++--------
Documentation/gitdiffcore.txt | 45 +++++++++++++++++++++++++-----------------
diffcore-pickaxe.c | 4 ++--
3 files changed, 59 insertions(+), 28 deletions(-)
--
1.8.3.114.gcd03571
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/2] diffcore-pickaxe: make error messages more consistent
2013-05-31 12:12 [PATCH v4 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
@ 2013-05-31 12:12 ` Ramkumar Ramachandra
2013-06-03 17:52 ` Junio C Hamano
2013-05-31 12:12 ` [PATCH 2/2] diffcore-pickaxe doc: document -S and -G properly Ramkumar Ramachandra
1 sibling, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-31 12:12 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano
Currently, diffcore-pickaxe reports two distinct errors for the same
user error:
$ git log --pickaxe-regex -S'\1'
fatal: invalid pickaxe regex: Invalid back reference
$ git log -G'\1' # --pickaxe-regex is implied
fatal: invalid log-grep regex: Invalid back reference
Since the error has nothing to do with "log-grep", change the -G and -S
error messages to say "invalid regex".
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
diffcore-pickaxe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 63722f8..c97ac9b 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
char errbuf[1024];
regerror(err, ®ex, errbuf, 1024);
regfree(®ex);
- die("invalid log-grep regex: %s", errbuf);
+ die("invalid regex: %s", errbuf);
}
pickaxe(&diff_queued_diff, o, ®ex, NULL, diff_grep);
@@ -246,7 +246,7 @@ static void diffcore_pickaxe_count(struct diff_options *o)
char errbuf[1024];
regerror(err, ®ex, errbuf, 1024);
regfree(®ex);
- die("invalid pickaxe regex: %s", errbuf);
+ die("invalid regex: %s", errbuf);
}
regexp = ®ex;
} else {
--
1.8.3.114.gcd03571
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] diffcore-pickaxe: make error messages more consistent
2013-05-31 12:12 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
@ 2013-06-03 17:52 ` Junio C Hamano
0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2013-06-03 17:52 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Git List
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> Currently, diffcore-pickaxe reports two distinct errors for the same
> user error:
>
> $ git log --pickaxe-regex -S'\1'
> fatal: invalid pickaxe regex: Invalid back reference
>
> $ git log -G'\1' # --pickaxe-regex is implied
> fatal: invalid log-grep regex: Invalid back reference
>
> Since the error has nothing to do with "log-grep", change the -G and -S
> error messages to say "invalid regex".
I'll reword the above somewhat; as I repeatedly explained, -G does
*not* imply pickaxe-regex at all.
While -G was being developed, it was internally called log-grep (no
relation to "git log --grep=<pattern>"), and that seeped through to
the error message. Removing that is a good idea.
Thanks, will queue.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> diffcore-pickaxe.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
> index 63722f8..c97ac9b 100644
> --- a/diffcore-pickaxe.c
> +++ b/diffcore-pickaxe.c
> @@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
> char errbuf[1024];
> regerror(err, ®ex, errbuf, 1024);
> regfree(®ex);
> - die("invalid log-grep regex: %s", errbuf);
> + die("invalid regex: %s", errbuf);
> }
>
> pickaxe(&diff_queued_diff, o, ®ex, NULL, diff_grep);
> @@ -246,7 +246,7 @@ static void diffcore_pickaxe_count(struct diff_options *o)
> char errbuf[1024];
> regerror(err, ®ex, errbuf, 1024);
> regfree(®ex);
> - die("invalid pickaxe regex: %s", errbuf);
> + die("invalid regex: %s", errbuf);
> }
> regexp = ®ex;
> } else {
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] diffcore-pickaxe doc: document -S and -G properly
2013-05-31 12:12 [PATCH v4 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
2013-05-31 12:12 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
@ 2013-05-31 12:12 ` Ramkumar Ramachandra
2013-06-03 17:54 ` Junio C Hamano
1 sibling, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-31 12:12 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano
The documentation of -S and -G is very sketchy. Completely rewrite the
sections in Documentation/diff-options.txt and
Documentation/gitdiffcore.txt.
References:
52e9578 ([PATCH] Introducing software archaeologist's tool "pickaxe".)
f506b8e (git log/diff: add -G<regexp> that greps in the patch text)
Inputs-from: Phil Hord <phil.hord@gmail.com>
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Documentation/diff-options.txt | 38 +++++++++++++++++++++++++++--------
Documentation/gitdiffcore.txt | 45 +++++++++++++++++++++++++-----------------
2 files changed, 57 insertions(+), 26 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index b8a9b86..a85288f 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -383,14 +383,36 @@ ifndef::git-format-patch[]
that matches other criteria, nothing is selected.
-S<string>::
- Look for differences that introduce or remove an instance of
- <string>. Note that this is different than the string simply
- appearing in diff output; see the 'pickaxe' entry in
- linkgit:gitdiffcore[7] for more details.
+ Look for differences 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 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: use the feature iteratively to feed the interesting
+block in the preimage back into `-S`, and keep going until you get the
+very first version of the block.
-G<regex>::
- Look for differences whose added or removed line matches
- the given <regex>.
+ Look for differences whose patch text contains added/removed
+ lines that match <regex>.
++
+To illustrate the difference between `-S<regex> --pickaxe-regex` and
+`-G<regex>`, consider a commit with the following diff in the same
+file:
++
+----
++ return !regexec(regexp, two->ptr, 1, ®match, 0);
+...
+- hit = !regexec(regexp, mf2.ptr, 1, ®match, 0);
+----
++
+While `git log -G"regexec\(regexp"` will show this commit, `git log
+-S"regexec\(regexp" --pickaxe-regex` will not (because the number of
+occurrences of that string did not change).
++
+See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
+information.
--pickaxe-all::
When `-S` or `-G` finds a change, show all the changes in that
@@ -398,8 +420,8 @@ ifndef::git-format-patch[]
in <string>.
--pickaxe-regex::
- Make the <string> not a plain string but an extended POSIX
- regex to match.
+ Treat the <string> given to `-S` as an extended POSIX regular
+ expression to match.
endif::git-format-patch[]
-O<orderfile>::
diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
index 568d757..c8b3e51 100644
--- a/Documentation/gitdiffcore.txt
+++ b/Documentation/gitdiffcore.txt
@@ -222,26 +222,35 @@ version prefixed with '+'.
diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
---------------------------------------------------------------------
-This transformation is used to find filepairs that represent
-changes that touch a specified string, and is controlled by the
--S option and the `--pickaxe-all` option to the 'git diff-*'
-commands.
-
-When diffcore-pickaxe is in use, it checks if there are
-filepairs whose "result" side and whose "origin" side have
-different number of specified string. Such a filepair represents
-"the string appeared in this changeset". It also checks for the
-opposite case that loses the specified string.
-
-When `--pickaxe-all` is not in effect, diffcore-pickaxe leaves
-only such filepairs that touch the specified string in its
-output. When `--pickaxe-all` is used, diffcore-pickaxe leaves all
-filepairs intact if there is such a filepair, or makes the
-output empty otherwise. The latter behaviour is designed to
-make reviewing of the changes in the context of the whole
+This transformation limits the set of filepairs to those that change
+specified strings between the preimage and the postimage in a certain
+way. -S<block of text> and -G<regular expression> options are used to
+specify different ways these strings are sought.
+
+"-S<block of text>" detects filepairs whose preimage and postimage
+have different number of occurrences of the specified block of text.
+By definition, it will not detect in-file moves. Also, when a
+changeset moves a file wholesale without affecting the interesting
+string, diffcore-rename kicks in as usual, and `-S` omits the filepair
+(since the number of occurrences of that string didn't change in that
+rename-detected filepair). When used with `--pickaxe-regex`, treat
+the <block of text> as an extended POSIX regular expression to match,
+instead of a literal string.
+
+"-G<regular expression>" (mnemonic: grep) detects filepairs whose
+textual diff has an added or a deleted line that matches the given
+regular expression. This means that it will detect in-file (or what
+rename-detection considers the same file) moves, which is noise. The
+implementation runs diff twice and greps, and this can be quite
+expensive.
+
+When `-S` or `-G` are used without `--pickaxe-all`, only filepairs
+that match their respective criterion are kept in the output. When
+`--pickaxe-all` is used, if even one filepair matches their respective
+criterion in a changeset, the entire changeset is kept. This behavior
+is designed to make reviewing changes in the context of the whole
changeset easier.
-
diffcore-order: For Sorting the Output Based on Filenames
---------------------------------------------------------
--
1.8.3.114.gcd03571
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 0/2] Improve diffcore-pickaxe documentation
@ 2013-05-24 10:33 Ramkumar Ramachandra
2013-05-24 10:33 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
0 siblings, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-24 10:33 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano
[1/2] replaces "pickaxe regex" with "regex", as suggested by Junio.
[2/2] is now co-authored by Junio. I've taken what I think are the
best changes introduced by both versions and merged them. The
inter-diff follows.
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index b61a666..2835eef 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -383,18 +383,19 @@ ifndef::git-format-patch[]
that matches other criteria, nothing is selected.
-S<string>::
- Look for commits that change the number of occurrences of the
- specified string (i.e. addition/ deletion) in a file.
+ Look for differences 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 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.
+first came into being: use the feature iteratively to feed the
+interesting block in the preimage back into `-S`, and keep going until
+you get the very first version of the block.
-G<regex>::
- Grep through the patch text of commits for added/removed lines
- that match <regex>. `--pickaxe-regex` is implied in this
- mode.
+ Look for differences whose patch text contains added/removed
+ lines that match <regex>.
+
To illustrate the difference between `-S<regex> --pickaxe-regex` and
`-G<regex>`, consider a commit with the following diff in the same
@@ -408,7 +409,7 @@ file:
+
While `git log -G"regexec\(regexp"` will show this commit, `git log
-S"regexec\(regexp" --pickaxe-regex` will not (because the number of
-occurrences of that string didn't change).
+occurrences of that string did not change).
+
See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
information.
@@ -419,8 +420,8 @@ information.
in <string>.
--pickaxe-regex::
- Treat the <string> not as a plain string, but an extended
- POSIX regex to match. It is implied when `-G` is used.
+ Treat the <string> given to `-S` as an extended POSIX regular
+ expression to match.
endif::git-format-patch[]
-O<orderfile>::
diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
index d0f2b91..ef4c04a 100644
--- a/Documentation/gitdiffcore.txt
+++ b/Documentation/gitdiffcore.txt
@@ -225,31 +225,29 @@ 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 (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. 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
-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.
-
-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.
+"-S<block of text>" detects filepairs whose preimage and postimage
+have different number of occurrences of the specified block of text.
+By definition, it will not detect in-file moves. Also, when a
+changeset moves a file wholesale without affecting the interesting
+string, rename detection kicks in as usual, and `-S` omits the
+filepair (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. When used
+with `--pickaxe-regex`, treat the <block of text> as an extended POSIX
+regular expression to match, instead of a literal string.
+
+"-G<regular expression>" detects filepairs whose textual diff has an
+added or a deleted line that matches the given regular expression.
+This means that it can detect in-file (or what rename-detection
+considers the same file) moves. The implementation runs diff twice
+and greps, and this can be quite expensive.
+
+When `-S` or `-G` are used without `--pickaxe-all`, only filepairs
+that match their respective criterion are kept in the output. When
+`--pickaxe-all` is used, if even one filepair matches their respective
+criterion in a changeset, the entire changeset is kept. This behavior
+is designed to make reviewing 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 | 38 +++++++++++++++++++++++++++++--------
Documentation/gitdiffcore.txt | 43 ++++++++++++++++++++++++------------------
diffcore-pickaxe.c | 4 ++--
3 files changed, 57 insertions(+), 28 deletions(-)
--
1.8.3.rc3.17.gd95ec6c.dirty
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/2] diffcore-pickaxe: make error messages more consistent
2013-05-24 10:33 [PATCH v3 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
@ 2013-05-24 10:33 ` Ramkumar Ramachandra
0 siblings, 0 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-24 10:33 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano
Currently, diffcore-pickaxe reports two distinct errors for the same
user error:
$ git log --pickaxe-regex -S'\1'
fatal: invalid pickaxe regex: Invalid back reference
$ git log -G'\1' # --pickaxe-regex is implied
fatal: invalid log-grep regex: Invalid back reference
Since the error has nothing to do with "log-grep", change the -G and -S
error messages to say "invalid regex".
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
diffcore-pickaxe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 63722f8..c97ac9b 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
char errbuf[1024];
regerror(err, ®ex, errbuf, 1024);
regfree(®ex);
- die("invalid log-grep regex: %s", errbuf);
+ die("invalid regex: %s", errbuf);
}
pickaxe(&diff_queued_diff, o, ®ex, NULL, diff_grep);
@@ -246,7 +246,7 @@ static void diffcore_pickaxe_count(struct diff_options *o)
char errbuf[1024];
regerror(err, ®ex, errbuf, 1024);
regfree(®ex);
- die("invalid pickaxe regex: %s", errbuf);
+ die("invalid regex: %s", errbuf);
}
regexp = ®ex;
} else {
--
1.8.3.rc3.17.gd95ec6c.dirty
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 0/2] Improve diffcore-pickaxe documentation
@ 2013-05-17 12:23 Ramkumar Ramachandra
2013-05-17 12:23 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
0 siblings, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-17 12:23 UTC (permalink / raw)
To: Git List; +Cc: Phil Hord, Junio C Hamano
[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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/2] diffcore-pickaxe: make error messages more consistent
2013-05-17 12:23 [PATCH v2 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
@ 2013-05-17 12:23 ` Ramkumar Ramachandra
2013-05-18 1:25 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-17 12:23 UTC (permalink / raw)
To: Git List; +Cc: Phil Hord, Junio C Hamano
Currently, diffcore-pickaxe reports two distinct errors for the same
user error:
$ git log --pickaxe-regex -S'\1'
fatal: invalid pickaxe regex: Invalid back reference
$ git log -G'\1' # --pickaxe-regex is implied
fatal: invalid log-grep regex: Invalid back reference
Since the error has nothing to do with "log-grep", change the -G error
message to match the -S error message.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
diffcore-pickaxe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 63722f8..d69a7a2 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
char errbuf[1024];
regerror(err, ®ex, errbuf, 1024);
regfree(®ex);
- die("invalid log-grep regex: %s", errbuf);
+ die("invalid pickaxe regex: %s", errbuf);
}
pickaxe(&diff_queued_diff, o, ®ex, NULL, diff_grep);
--
1.8.1.2.432.g070c57d
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-03 17:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 12:12 [PATCH v4 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
2013-05-31 12:12 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
2013-06-03 17:52 ` Junio C Hamano
2013-05-31 12:12 ` [PATCH 2/2] diffcore-pickaxe doc: document -S and -G properly Ramkumar Ramachandra
2013-06-03 17:54 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2013-05-24 10:33 [PATCH v3 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
2013-05-24 10:33 ` [PATCH 1/2] diffcore-pickaxe: make error messages more consistent Ramkumar Ramachandra
2013-05-17 12:23 [PATCH v2 0/2] Improve diffcore-pickaxe documentation Ramkumar Ramachandra
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
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 NNTP newsgroup(s).