* [PATCH] Add grep.fullName config variable
@ 2014-03-12 7:11 Andreas Schwab
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2014-03-12 7:11 UTC (permalink / raw)
To: git
This configuration variable sets the default for the --full-name option.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
Documentation/git-grep.txt | 3 +++
grep.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index f837334..31811f1 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -53,6 +53,9 @@ grep.extendedRegexp::
option is ignored when the 'grep.patternType' option is set to a value
other than 'default'.
+grep.fullName::
+ If set to true, enable '--full-name' option by default.
+
OPTIONS
-------
diff --git a/grep.c b/grep.c
index c668034..ece04bf 100644
--- a/grep.c
+++ b/grep.c
@@ -86,6 +86,11 @@ int grep_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "grep.fullname")) {
+ opt->relative = !git_config_bool(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "color.grep"))
opt->color = git_config_colorbool(var, value);
else if (!strcmp(var, "color.grep.context"))
--
1.9.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] Add grep.fullName config variable
@ 2014-03-17 19:16 Andreas Schwab
2014-03-17 22:21 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2014-03-17 19:16 UTC (permalink / raw)
To: git
This configuration variable sets the default for the --full-name option.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
Documentation/git-grep.txt | 3 +++
grep.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index f837334..31811f1 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -53,6 +53,9 @@ grep.extendedRegexp::
option is ignored when the 'grep.patternType' option is set to a value
other than 'default'.
+grep.fullName::
+ If set to true, enable '--full-name' option by default.
+
OPTIONS
-------
diff --git a/grep.c b/grep.c
index c668034..ece04bf 100644
--- a/grep.c
+++ b/grep.c
@@ -86,6 +86,11 @@ int grep_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "grep.fullname")) {
+ opt->relative = !git_config_bool(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "color.grep"))
opt->color = git_config_colorbool(var, value);
else if (!strcmp(var, "color.grep.context"))
--
1.9.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-17 19:16 Andreas Schwab
@ 2014-03-17 22:21 ` Junio C Hamano
2014-03-18 10:16 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2014-03-17 22:21 UTC (permalink / raw)
To: Andreas Schwab; +Cc: git
Andreas Schwab <schwab@linux-m68k.org> writes:
> This configuration variable sets the default for the --full-name option.
>
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
Would this change break Porcelains (e.g. Emacs modes) and force them
to be updated to explicitly pass --no-full-name to unbreak them?
> Documentation/git-grep.txt | 3 +++
> grep.c | 5 +++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
> index f837334..31811f1 100644
> --- a/Documentation/git-grep.txt
> +++ b/Documentation/git-grep.txt
> @@ -53,6 +53,9 @@ grep.extendedRegexp::
> option is ignored when the 'grep.patternType' option is set to a value
> other than 'default'.
>
> +grep.fullName::
> + If set to true, enable '--full-name' option by default.
> +
>
> OPTIONS
> -------
> diff --git a/grep.c b/grep.c
> index c668034..ece04bf 100644
> --- a/grep.c
> +++ b/grep.c
> @@ -86,6 +86,11 @@ int grep_config(const char *var, const char *value, void *cb)
> return 0;
> }
>
> + if (!strcmp(var, "grep.fullname")) {
> + opt->relative = !git_config_bool(var, value);
> + return 0;
> + }
> +
> if (!strcmp(var, "color.grep"))
> opt->color = git_config_colorbool(var, value);
> else if (!strcmp(var, "color.grep.context"))
> --
> 1.9.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-17 22:21 ` Junio C Hamano
@ 2014-03-18 10:16 ` Andreas Schwab
2014-03-18 18:39 ` Junio C Hamano
2014-03-18 20:01 ` Andreas Schwab
0 siblings, 2 replies; 8+ messages in thread
From: Andreas Schwab @ 2014-03-18 10:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> This configuration variable sets the default for the --full-name option.
>>
>> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
>> ---
>
> Would this change break Porcelains (e.g. Emacs modes) and force them
> to be updated to explicitly pass --no-full-name to unbreak them?
Yes, that would be required. On the other hand, currently it is
impossible to cut-n-paste a file name without --full-name, since the
pager is always started in top-level. Perhaps it is better to fix the
latter?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-18 10:16 ` Andreas Schwab
@ 2014-03-18 18:39 ` Junio C Hamano
2014-03-18 19:51 ` Andreas Schwab
2014-03-18 20:01 ` Andreas Schwab
1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2014-03-18 18:39 UTC (permalink / raw)
To: Andreas Schwab; +Cc: git
Andreas Schwab <schwab@linux-m68k.org> writes:
> Yes, that would be required. On the other hand, currently it is
> impossible to cut-n-paste a file name without --full-name, since the
> pager is always started in top-level. Perhaps it is better to fix the
> latter?
So far we never cared where the pager runs, but as a principle, I
think it would be nice if we run it in the original subdirectory,
not at the top of the working tree (unless we have to bend backwards
to make the codepath involved too ugly, that is).
Don't we have the exact same issue for the editor, by the way?
Shouldn't we be running it in the original subdirectory as well?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-18 18:39 ` Junio C Hamano
@ 2014-03-18 19:51 ` Andreas Schwab
2014-03-18 20:16 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2014-03-18 19:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Don't we have the exact same issue for the editor, by the way?
> Shouldn't we be running it in the original subdirectory as well?
It's called with an absolute name, so it shouldn't care.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-18 10:16 ` Andreas Schwab
2014-03-18 18:39 ` Junio C Hamano
@ 2014-03-18 20:01 ` Andreas Schwab
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2014-03-18 20:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Andreas Schwab <schwab@linux-m68k.org> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Andreas Schwab <schwab@linux-m68k.org> writes:
>>
>>> This configuration variable sets the default for the --full-name option.
>>>
>>> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
>>> ---
>>
>> Would this change break Porcelains (e.g. Emacs modes) and force them
>> to be updated to explicitly pass --no-full-name to unbreak them?
>
> Yes, that would be required. On the other hand, currently it is
> impossible to cut-n-paste a file name without --full-name, since the
> pager is always started in top-level. Perhaps it is better to fix the
> latter?
On the third hand, git grep isn't plumbing, so variation of output is to
be expected? We already have grep.lineNumber and grep.patternType /
grep.extendedRegexp (vc-git-grep uses -n itself, but does not protect
against grep.patternType).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add grep.fullName config variable
2014-03-18 19:51 ` Andreas Schwab
@ 2014-03-18 20:16 ` Junio C Hamano
0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2014-03-18 20:16 UTC (permalink / raw)
To: Andreas Schwab; +Cc: git
Andreas Schwab <schwab@linux-m68k.org> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Don't we have the exact same issue for the editor, by the way?
>> Shouldn't we be running it in the original subdirectory as well?
>
> It's called with an absolute name, so it shouldn't care.
But we should not have to call with absolute paths when a short and
sweet pathname relative to the user's current directory. That is the
primary point of my comment.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-03-18 20:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-12 7:11 [PATCH] Add grep.fullName config variable Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
2014-03-17 19:16 Andreas Schwab
2014-03-17 22:21 ` Junio C Hamano
2014-03-18 10:16 ` Andreas Schwab
2014-03-18 18:39 ` Junio C Hamano
2014-03-18 19:51 ` Andreas Schwab
2014-03-18 20:16 ` Junio C Hamano
2014-03-18 20:01 ` Andreas Schwab
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).