git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use --abbrev in git-whatchanged
@ 2005-12-21 22:37 Johannes Schindelin
  2005-12-22  6:21 ` [PATCH] whatchanged: customize diff-tree output Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-21 22:37 UTC (permalink / raw)
  To: git, junkio


The output is much nicer on standard 80 columns. If you want the old
behaviour, you can still do

	git-whatchanged --abbrev=40

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

---

 git-whatchanged.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

5d0a4d9aedc8af48666744ab240cdc30b9c6cae3
diff --git a/git-whatchanged.sh b/git-whatchanged.sh
index b170f74..a30f64d 100755
--- a/git-whatchanged.sh
+++ b/git-whatchanged.sh
@@ -8,5 +8,5 @@ rev_list_args=$(git-rev-parse --sq --def
 diff_tree_args=$(git-rev-parse --sq --no-revs "$@") &&
 
 eval "git-rev-list $rev_list_args" |
-eval "git-diff-tree --stdin --pretty -r $diff_tree_args" |
+eval "git-diff-tree --stdin --pretty -r --abbrev $diff_tree_args" |
 LESS="$LESS -S" ${PAGER:-less}
-- 
0.99.9.GIT

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] whatchanged: customize diff-tree output
  2005-12-21 22:37 [PATCH] Use --abbrev in git-whatchanged Johannes Schindelin
@ 2005-12-22  6:21 ` Junio C Hamano
  2005-12-22  6:48   ` Linus Torvalds
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-22  6:21 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> The output is much nicer on standard 80 columns. If you want the old
> behaviour, you can still do
>
> 	git-whatchanged --abbrev=40
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

You already know I am in favor of this; it was the motivation
behind --abbrev.  With an 80-column terminal, especially with
the hardcoded LESS=-S switch, the default diff-raw output was
unusable.

How about doing something like this patch first, and then decide
what the default should be?

I would recommend "--pretty -r --name-status -M" as the default.
But I am not particularly interested in imposing my preference
over that of Linus to the end users.

-- >8 --
This allows the configuration item whatchanged.difftree to
control the output from git-whatchanged command.  For example:

	[whatchanged]
        	difftree = --pretty=fuller --name-status -M

does rename detection, shows the commit header in "fuller"
format and lists modified pathnames with the kind of change
instead of the default hash pairs.

Not having the configuration item is the same as the original
output format (--pretty -r).

Signed-off-by: Junio C Hamano <junkio@cox.net>

---
diff --git a/git-whatchanged.sh b/git-whatchanged.sh
index b170f74..b651b3f 100755
--- a/git-whatchanged.sh
+++ b/git-whatchanged.sh
@@ -4,9 +4,15 @@ USAGE='[-p] [--max-count=<n>] [<since>..
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
+diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@")
+test -z "$diff_tree_flags" &&
+	diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
+test -z "$diff_tree_flags" &&
+	diff_tree_flags='' # NEW DEFAULT HERE
+
 rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
-diff_tree_args=$(git-rev-parse --sq --no-revs "$@") &&
+diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
 
 eval "git-rev-list $rev_list_args" |
-eval "git-diff-tree --stdin --pretty -r $diff_tree_args" |
+eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
 LESS="$LESS -S" ${PAGER:-less}

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22  6:21 ` [PATCH] whatchanged: customize diff-tree output Junio C Hamano
@ 2005-12-22  6:48   ` Linus Torvalds
  2005-12-22 11:16     ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Torvalds @ 2005-12-22  6:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git



On Wed, 21 Dec 2005, Junio C Hamano wrote:
> 
> How about doing something like this patch first, and then decide
> what the default should be?
> 
> I would recommend "--pretty -r --name-status -M" as the default.
> But I am not particularly interested in imposing my preference
> over that of Linus to the end users.

I'm certainly ok with the short format by default. And making it 
configurable per repo sounds fine, although at the same time I wonder if 
that perhaps confuses people more (something that works in one project one 
way works subtly differently in another project..)

		Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22  6:48   ` Linus Torvalds
@ 2005-12-22 11:16     ` Johannes Schindelin
  2005-12-22 21:06       ` Alex Riesen
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-22 11:16 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, git

Hi,

On Wed, 21 Dec 2005, Linus Torvalds wrote:

> On Wed, 21 Dec 2005, Junio C Hamano wrote:
> > 
> > How about doing something like this patch first, and then decide
> > what the default should be?

I see you already applied it, with a sane default. That's great!

> I'm certainly ok with the short format by default. And making it 
> configurable per repo sounds fine, although at the same time I wonder if 
> that perhaps confuses people more (something that works in one project one 
> way works subtly differently in another project..)

I cannot think of a saner way to have an overridable policy. Just provide 
a template config, and you're done. Everyone gets those flags per default, 
and if someone does not like it: go ahead, change it yourself!

Besides, you are usually calling git-whatchanged in your private working 
tree, where not many people can change the config.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22 11:16     ` Johannes Schindelin
@ 2005-12-22 21:06       ` Alex Riesen
  2005-12-22 22:24         ` Johannes Schindelin
  2005-12-23  4:19         ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Alex Riesen @ 2005-12-22 21:06 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Linus Torvalds, Junio C Hamano, git

Johannes Schindelin, Thu, Dec 22, 2005 12:16:00 +0100:
> > I'm certainly ok with the short format by default. And making it 
> > configurable per repo sounds fine, although at the same time I wonder if 
> > that perhaps confuses people more (something that works in one project one 
> > way works subtly differently in another project..)
> 
> I cannot think of a saner way to have an overridable policy. Just provide 
> a template config, and you're done. Everyone gets those flags per default, 
> and if someone does not like it: go ahead, change it yourself!
> 
> Besides, you are usually calling git-whatchanged in your private working 
> tree, where not many people can change the config.
> 

That's the point, isn't it? A script from ~user1/bin, which calls
git-whatchanged suddenly stops working in ~user2/repo.
Besides, how can user1 know what he has to specify to git-whatchanged
(I assume the command line overrides .git/config) so that his script
works everywhere?

Maybe such configuration better left to environment variables?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22 21:06       ` Alex Riesen
@ 2005-12-22 22:24         ` Johannes Schindelin
  2005-12-23 18:12           ` Alex Riesen
  2005-12-23  4:19         ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-22 22:24 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Hi,

On Thu, 22 Dec 2005, Alex Riesen wrote:

> A script from ~user1/bin, which calls git-whatchanged suddenly stops 
> working in ~user2/repo.
> [...]
> 
> Maybe such configuration better left to environment variables?

And that makes the script not stop how?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22 21:06       ` Alex Riesen
  2005-12-22 22:24         ` Johannes Schindelin
@ 2005-12-23  4:19         ` Junio C Hamano
       [not found]           ` <20051223182047.GB3165@steel.home>
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-23  4:19 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Johannes Schindelin, Linus Torvalds, git

Alex Riesen <raa.lkml@gmail.com> writes:

> That's the point, isn't it? A script from ~user1/bin, which calls
> git-whatchanged suddenly stops working in ~user2/repo.

For scripted use you can give command line arguments yourself to
whatchanged and you can bypass the repoconfig.  I do not think
whatchanged is meant for scripted use, though --- it is such a
simple script, and if you want to build on it to do something
more elaborate, I think you would be better off writing those
rev-list and diff-tree in your script.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
  2005-12-22 22:24         ` Johannes Schindelin
@ 2005-12-23 18:12           ` Alex Riesen
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Riesen @ 2005-12-23 18:12 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin, Thu, Dec 22, 2005 23:24:48 +0100:
> > A script from ~user1/bin, which calls git-whatchanged suddenly stops 
> > working in ~user2/repo.
> > [...]
> > 
> > Maybe such configuration better left to environment variables?
> 
> And that makes the script not stop how?
> 

It is another user, who does not have the variable set, or just unsets
the variable in his scripts (now he _can_ rely upon git-whatchanged
always doing the same)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] whatchanged: customize diff-tree output
       [not found]           ` <20051223182047.GB3165@steel.home>
@ 2005-12-24  9:44             ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2005-12-24  9:44 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Johannes Schindelin, Linus Torvalds, git

> But you cannot know which ones you have to give, unless you parsed
> output of git-repo-config!

Why?

I was suggesting that you would literally write something like
this in your script:

	git-whatchanged --name-status "$1".."$2"

Then whatchanged uses the '--name-status', and ignores whatever
is in the repository configuration, so you do not need to care
what repo-config says.  Neither used are its built-in defaults.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-24  9:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-21 22:37 [PATCH] Use --abbrev in git-whatchanged Johannes Schindelin
2005-12-22  6:21 ` [PATCH] whatchanged: customize diff-tree output Junio C Hamano
2005-12-22  6:48   ` Linus Torvalds
2005-12-22 11:16     ` Johannes Schindelin
2005-12-22 21:06       ` Alex Riesen
2005-12-22 22:24         ` Johannes Schindelin
2005-12-23 18:12           ` Alex Riesen
2005-12-23  4:19         ` Junio C Hamano
     [not found]           ` <20051223182047.GB3165@steel.home>
2005-12-24  9:44             ` 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).