* [PATCH] Make -s flag to show-diff a no-op.
@ 2005-04-27 22:06 Junio C Hamano
2005-04-27 22:20 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-04-27 22:06 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
With the recent "no-patch-by-default" change, the -s flag to
the show-diff command (and silent variable in the show-diff.c)
became meaningless. This patch deprecates it.
Cogito uses "show-diff -s" for the purpose of "I do not want the
patch text. I just want to know if something has potentially
changed, in which case I know you will have some output. I'll
run update-cache --refresh if you say something", so we cannot
barf on seeing -s on our command line yet.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
show-diff.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
--- k/show-diff.c
+++ l/show-diff.c
@@ -6,12 +6,12 @@
#include "cache.h"
#include "diff.h"
-static const char *show_diff_usage = "show-diff [-q] [-s] [-z] [-p] [paths...]";
+static const char *show_diff_usage =
+"show-diff [-p] [-q] [-r] [-z] [paths...]";
static int generate_patch = 0;
static int line_termination = '\n';
static int silent = 0;
-static int silent_on_nonexisting_files = 0;
static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt)
{
@@ -69,16 +69,16 @@ int main(int argc, char **argv)
int i;
while (1 < argc && argv[1][0] == '-') {
- if (!strcmp(argv[1], "-s"))
- silent_on_nonexisting_files = silent = 1;
- else if (!strcmp(argv[1], "-p"))
+ if (!strcmp(argv[1], "-p"))
generate_patch = 1;
else if (!strcmp(argv[1], "-q"))
- silent_on_nonexisting_files = 1;
- else if (!strcmp(argv[1], "-z"))
- line_termination = 0;
+ silent = 1;
else if (!strcmp(argv[1], "-r"))
; /* no-op */
+ else if (!strcmp(argv[1], "-s"))
+ ; /* no-op */
+ else if (!strcmp(argv[1], "-z"))
+ line_termination = 0;
else
usage(show_diff_usage);
argv++; argc--;
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
perror(ce->name);
continue;
}
- if (silent_on_nonexisting_files)
+ if (silent)
continue;
show_file('-', ce);
continue;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make -s flag to show-diff a no-op.
2005-04-27 22:06 [PATCH] Make -s flag to show-diff a no-op Junio C Hamano
@ 2005-04-27 22:20 ` Linus Torvalds
2005-04-27 22:35 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-04-27 22:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 27 Apr 2005, Junio C Hamano wrote:
>
> With the recent "no-patch-by-default" change, the -s flag to
> the show-diff command (and silent variable in the show-diff.c)
> became meaningless. This patch deprecates it.
I also wonder whether "-p" should turn on recursion by default (for all
the tools). "-p" without "-r" doesn't really seem to make much sense, does
it?
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make -s flag to show-diff a no-op.
2005-04-27 22:20 ` Linus Torvalds
@ 2005-04-27 22:35 ` Junio C Hamano
2005-04-27 23:05 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-04-27 22:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> I also wonder whether "-p" should turn on recursion by default (for all
LT> the tools). "-p" without "-r" doesn't really seem to make much sense, does
LT> it?
When I know which path I am interested in,
$ diff-tree -p <tree-1> <tree-2> ls-tree.c
would still get the benefit of not descending down into ppc and
mozilla-sha1 subdirectories, if I am not mistaken.
Think of the kernel sources, and I would say leaving the option
of not recursing down is a good thing.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make -s flag to show-diff a no-op.
2005-04-27 22:35 ` Junio C Hamano
@ 2005-04-27 23:05 ` Linus Torvalds
2005-04-27 23:11 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-04-27 23:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 27 Apr 2005, Junio C Hamano wrote:
>
> When I know which path I am interested in,
>
> $ diff-tree -p <tree-1> <tree-2> ls-tree.c
>
> would still get the benefit of not descending down into ppc and
> mozilla-sha1 subdirectories, if I am not mistaken.
It won't. It will see that those two aren't interesting, because they
don't match the pathname, so it will ignore them regardless of whether
there is a -r or not.
> Think of the kernel sources, and I would say leaving the option
> of not recursing down is a good thing.
Well, if you give pathnames, it's always going to limit recursion to only
those subdirectories that match one of them.
And if you don't give pathnames, then nor recursing will do something
pretty strange, ie give a diff of only the files in the top-level
directory, and totally ignore the subdirectories that did change:
torvalds@ppc970:~/v2.6/linux> diff-tree e8108c98dd6d65613fa0ec9d2300f89c48d554bf $(cat .git/HEAD)
*040000->040000 tree d44b45026cd1c9530a78756b11d6bb9a78718cc3->474afcccb9cac147aa3b95a9afdd91c2edb139f5 arch
*040000->040000 tree 2394cd732a73c793ba93c32be6e7f058bd7171d8->da5f26fc8b12defe39e58b76e8087281effbf6bf drivers
*040000->040000 tree 8d5010b0ff2b7325131536c63ed04071a563e310->cf51450069a2ab187b611599d1a0e037f176c6c3 fs
*040000->040000 tree a06b4fb363dcfd3225cfe3ac3a0aa02e8d628975->c27a22db91b056499a5c1198ace432768475b5bd include
and then
torvalds@ppc970:~/v2.6/linux> diff-tree -p e8108c98dd6d65613fa0ec9d2300f89c48d554bf $(cat .git/HEAD)
<no output what-so-ever>
where showing things as if nothing changed seems to be actively _wrong_,
I'd say..
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make -s flag to show-diff a no-op.
2005-04-27 23:05 ` Linus Torvalds
@ 2005-04-27 23:11 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2005-04-27 23:11 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> Well, if you give pathnames, it's always going to limit recursion to only
LT> those subdirectories that match one of them.
If that is the case then -p should imply -r. Will fix it up.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-27 23:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-27 22:06 [PATCH] Make -s flag to show-diff a no-op Junio C Hamano
2005-04-27 22:20 ` Linus Torvalds
2005-04-27 22:35 ` Junio C Hamano
2005-04-27 23:05 ` Linus Torvalds
2005-04-27 23:11 ` 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