{"thread":{"id":"2901","subject":"[PATCH] Use --abbrev in git-whatchanged","startedAt":"2005-12-21T22:37:00Z","lastAt":"2005-12-24T09:44:27Z","messageCount":9,"participants":["Johannes Schindelin","Junio C Hamano","Linus Torvalds","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13898","messageId":"Pine.LNX.4.63.0512212336230.18908@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2901","inReplyTo":null,"subject":"[PATCH] Use --abbrev in git-whatchanged","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-21T22:37:00Z","receivedAt":"2005-12-21T22:37:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThe output is much nicer on standard 80 columns. If you want the old\nbehaviour, you can still do\n\n\tgit-whatchanged --abbrev=40\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n git-whatchanged.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\n5d0a4d9aedc8af48666744ab240cdc30b9c6cae3\ndiff --git a/git-whatchanged.sh b/git-whatchanged.sh\nindex b170f74..a30f64d 100755\n--- a/git-whatchanged.sh\n+++ b/git-whatchanged.sh\n@@ -8,5 +8,5 @@ rev_list_args=$(git-rev-parse --sq --def\n diff_tree_args=$(git-rev-parse --sq --no-revs \"$@\") &&\n \n eval \"git-rev-list $rev_list_args\" |\n-eval \"git-diff-tree --stdin --pretty -r $diff_tree_args\" |\n+eval \"git-diff-tree --stdin --pretty -r --abbrev $diff_tree_args\" |\n LESS=\"$LESS -S\" ${PAGER:-less}\n-- \n0.99.9.GIT\n"},{"id":"13922","messageId":"7vvexhr6rc.fsf@assigned-by-dhcp.cox.net","threadId":"2901","inReplyTo":"Pine.LNX.4.63.0512212336230.18908@wbgn013.biozentrum.uni-wuerzburg.de","subject":"[PATCH] whatchanged: customize diff-tree output","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-22T06:21:59Z","receivedAt":"2005-12-22T06:21:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> The output is much nicer on standard 80 columns. If you want the old\n> behaviour, you can still do\n>\n> \tgit-whatchanged --abbrev=40\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\nYou already know I am in favor of this; it was the motivation\nbehind --abbrev.  With an 80-column terminal, especially with\nthe hardcoded LESS=-S switch, the default diff-raw output was\nunusable.\n\nHow about doing something like this patch first, and then decide\nwhat the default should be?\n\nI would recommend \"--pretty -r --name-status -M\" as the default.\nBut I am not particularly interested in imposing my preference\nover that of Linus to the end users.\n\n-- >8 --\nThis allows the configuration item whatchanged.difftree to\ncontrol the output from git-whatchanged command.  For example:\n\n\t[whatchanged]\n        \tdifftree = --pretty=fuller --name-status -M\n\ndoes rename detection, shows the commit header in \"fuller\"\nformat and lists modified pathnames with the kind of change\ninstead of the default hash pairs.\n\nNot having the configuration item is the same as the original\noutput format (--pretty -r).\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\ndiff --git a/git-whatchanged.sh b/git-whatchanged.sh\nindex b170f74..b651b3f 100755\n--- a/git-whatchanged.sh\n+++ b/git-whatchanged.sh\n@@ -4,9 +4,15 @@ USAGE='[-p] [--max-count=<n>] [<since>..\n SUBDIRECTORY_OK='Yes'\n . git-sh-setup\n \n+diff_tree_flags=$(git-rev-parse --sq --no-revs --flags \"$@\")\n+test -z \"$diff_tree_flags\" &&\n+\tdiff_tree_flags=$(git-repo-config --get whatchanged.difftree)\n+test -z \"$diff_tree_flags\" &&\n+\tdiff_tree_flags='' # NEW DEFAULT HERE\n+\n rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only \"$@\") &&\n-diff_tree_args=$(git-rev-parse --sq --no-revs \"$@\") &&\n+diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags \"$@\") &&\n \n eval \"git-rev-list $rev_list_args\" |\n-eval \"git-diff-tree --stdin --pretty -r $diff_tree_args\" |\n+eval \"git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args\" |\n LESS=\"$LESS -S\" ${PAGER:-less}\n"},{"id":"13923","messageId":"Pine.LNX.4.64.0512212245440.4827@g5.osdl.org","threadId":"2901","inReplyTo":"7vvexhr6rc.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-12-22T06:48:31Z","receivedAt":"2005-12-22T06:48:31Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 21 Dec 2005, Junio C Hamano wrote:\n> \n> How about doing something like this patch first, and then decide\n> what the default should be?\n> \n> I would recommend \"--pretty -r --name-status -M\" as the default.\n> But I am not particularly interested in imposing my preference\n> over that of Linus to the end users.\n\nI'm certainly ok with the short format by default. And making it \nconfigurable per repo sounds fine, although at the same time I wonder if \nthat perhaps confuses people more (something that works in one project one \nway works subtly differently in another project..)\n\n\t\tLinus\n"},{"id":"13931","messageId":"Pine.LNX.4.63.0512221200190.7112@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2901","inReplyTo":"Pine.LNX.4.64.0512212245440.4827@g5.osdl.org","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-22T11:16:00Z","receivedAt":"2005-12-22T11:16:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 21 Dec 2005, Linus Torvalds wrote:\n\n> On Wed, 21 Dec 2005, Junio C Hamano wrote:\n> > \n> > How about doing something like this patch first, and then decide\n> > what the default should be?\n\nI see you already applied it, with a sane default. That's great!\n\n> I'm certainly ok with the short format by default. And making it \n> configurable per repo sounds fine, although at the same time I wonder if \n> that perhaps confuses people more (something that works in one project one \n> way works subtly differently in another project..)\n\nI cannot think of a saner way to have an overridable policy. Just provide \na template config, and you're done. Everyone gets those flags per default, \nand if someone does not like it: go ahead, change it yourself!\n\nBesides, you are usually calling git-whatchanged in your private working \ntree, where not many people can change the config.\n\nCiao,\nDscho\n"},{"id":"13960","messageId":"20051222210620.GA4679@steel.home","threadId":"2901","inReplyTo":"Pine.LNX.4.63.0512221200190.7112@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-22T21:06:20Z","receivedAt":"2005-12-22T21:06:20Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Thu, Dec 22, 2005 12:16:00 +0100:\n> > I'm certainly ok with the short format by default. And making it \n> > configurable per repo sounds fine, although at the same time I wonder if \n> > that perhaps confuses people more (something that works in one project one \n> > way works subtly differently in another project..)\n> \n> I cannot think of a saner way to have an overridable policy. Just provide \n> a template config, and you're done. Everyone gets those flags per default, \n> and if someone does not like it: go ahead, change it yourself!\n> \n> Besides, you are usually calling git-whatchanged in your private working \n> tree, where not many people can change the config.\n> \n\nThat's the point, isn't it? A script from ~user1/bin, which calls\ngit-whatchanged suddenly stops working in ~user2/repo.\nBesides, how can user1 know what he has to specify to git-whatchanged\n(I assume the command line overrides .git/config) so that his script\nworks everywhere?\n\nMaybe such configuration better left to environment variables?\n"},{"id":"13964","messageId":"Pine.LNX.4.63.0512222323110.12241@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2901","inReplyTo":"20051222210620.GA4679@steel.home","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-22T22:24:48Z","receivedAt":"2005-12-22T22:24:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Dec 2005, Alex Riesen wrote:\n\n> A script from ~user1/bin, which calls git-whatchanged suddenly stops \n> working in ~user2/repo.\n> [...]\n> \n> Maybe such configuration better left to environment variables?\n\nAnd that makes the script not stop how?\n\nCiao,\nDscho\n"},{"id":"13973","messageId":"7vvexgfns4.fsf@assigned-by-dhcp.cox.net","threadId":"2901","inReplyTo":"20051222210620.GA4679@steel.home","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-23T04:19:39Z","receivedAt":"2005-12-23T04:19:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> That's the point, isn't it? A script from ~user1/bin, which calls\n> git-whatchanged suddenly stops working in ~user2/repo.\n\nFor scripted use you can give command line arguments yourself to\nwhatchanged and you can bypass the repoconfig.  I do not think\nwhatchanged is meant for scripted use, though --- it is such a\nsimple script, and if you want to build on it to do something\nmore elaborate, I think you would be better off writing those\nrev-list and diff-tree in your script.\n"},{"id":"13986","messageId":"20051223181249.GA3165@steel.home","threadId":"2901","inReplyTo":"Pine.LNX.4.63.0512222323110.12241@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-23T18:12:49Z","receivedAt":"2005-12-23T18:12:49Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Thu, Dec 22, 2005 23:24:48 +0100:\n> > A script from ~user1/bin, which calls git-whatchanged suddenly stops \n> > working in ~user2/repo.\n> > [...]\n> > \n> > Maybe such configuration better left to environment variables?\n> \n> And that makes the script not stop how?\n> \n\nIt is another user, who does not have the variable set, or just unsets\nthe variable in his scripts (now he _can_ rely upon git-whatchanged\nalways doing the same)\n"},{"id":"13998","messageId":"7vzmmqu8w4.fsf@assigned-by-dhcp.cox.net","threadId":"2901","inReplyTo":"20051223182047.GB3165@steel.home","subject":"Re: [PATCH] whatchanged: customize diff-tree output","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-24T09:44:27Z","receivedAt":"2005-12-24T09:44:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"> But you cannot know which ones you have to give, unless you parsed\n> output of git-repo-config!\n\nWhy?\n\nI was suggesting that you would literally write something like\nthis in your script:\n\n\tgit-whatchanged --name-status \"$1\"..\"$2\"\n\nThen whatchanged uses the '--name-status', and ignores whatever\nis in the repository configuration, so you do not need to care\nwhat repo-config says.  Neither used are its built-in defaults.\n"}]}