{"thread":{"id":"4199","subject":"[PATCH] Allow pickaxe to be used via git log.","startedAt":"2006-05-19T01:31:24Z","lastAt":"2006-05-19T06:05:34Z","messageCount":10,"participants":["Sean","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"20258","messageId":"BAYC1-PASMTP04945C92FB14DA65AB1AC7AEA70@CEZ.ICE","threadId":"4199","inReplyTo":null,"subject":"[PATCH] Allow pickaxe to be used via git log.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-05-19T01:31:24Z","receivedAt":"2006-05-19T01:31:24Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"Handle the -S option when passed to git log such that only the appropriate\ncommits are displayed.  Unlike \"whatchanged\", by default no diff output\nis produced.\n\n---\n\nThis came out of recent comments on #git and will hopefully further reduce\nthe need for git-whatchanged.\n\n\necdfaa21dbff93a6a387b02e1f1d3ebf05ee517d\n revision.c |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\necdfaa21dbff93a6a387b02e1f1d3ebf05ee517d\ndiff --git a/revision.c b/revision.c\nindex 2294b16..2e18b2b 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -743,6 +743,13 @@ int setup_revisions(int argc, const char\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\topts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);\n+\t\t\tif (revs->diffopt.pickaxe && revs->always_show_header) {\n+\t\t\t\trevs->always_show_header = 0;\n+\t\t\t\trevs->diff = 1;\n+\t\t\t\trevs->diffopt.recursive = 1;\n+\t\t\t\tif (revs->diffopt.output_format == DIFF_FORMAT_RAW)\n+\t\t\t\t\trevs->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;\n+\t\t\t}\n \t\t\tif (opts > 0) {\n \t\t\t\trevs->diff = 1;\n \t\t\t\ti += opts - 1;\n-- \n1.3.GIT\n"},{"id":"20259","messageId":"7v4pzmn32g.fsf@assigned-by-dhcp.cox.net","threadId":"4199","inReplyTo":"BAYC1-PASMTP04945C92FB14DA65AB1AC7AEA70@CEZ.ICE","subject":"Re: [PATCH] Allow pickaxe to be used via git log.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-19T02:47:19Z","receivedAt":"2006-05-19T02:47:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> Handle the -S option when passed to git log such that only the appropriate\n> commits are displayed.  Unlike \"whatchanged\", by default no diff output\n> is produced.\n\nIf that (specifically, \"when passed to git log\") is what you\nwant, do all of that in \"git log\" please.  I haven't checked,\nbut I suspect your changes would break git-rev-list and makes it\ndisobey the options the user gives it.\n"},{"id":"20260","messageId":"BAYC1-PASMTP07581788E7BAAC19B2A159AEA70@CEZ.ICE","threadId":"4199","inReplyTo":"7v4pzmn32g.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow pickaxe to be used via git log.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-05-19T02:56:12Z","receivedAt":"2006-05-19T02:56:12Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Thu, 18 May 2006 19:47:19 -0700\nJunio C Hamano <junkio@cox.net> wrote:\n\n> If that (specifically, \"when passed to git log\") is what you\n> want, do all of that in \"git log\" please.  I haven't checked,\n> but I suspect your changes would break git-rev-list and makes it\n> disobey the options the user gives it.\n> \n\nWell, it's more general than just git log, but that's primarily where one\nwould see it.  Essentially the patch is saying that specifying both a\n\"revs->diffopt.pickaxe\" string and \"revs->always_show_header\" is illegal\nand proceeds to use pickaxe instead of the other.\n\nIs there any place that depends on the ability to specify both a pickaxe\nstring _and_ always_show_header?  If not, it's hard to see how this patch\ncould break anything.\n\nSean\n"},{"id":"20262","messageId":"7vk68ilnoi.fsf@assigned-by-dhcp.cox.net","threadId":"4199","inReplyTo":"BAYC1-PASMTP07581788E7BAAC19B2A159AEA70@CEZ.ICE","subject":"Re: [PATCH] Allow pickaxe to be used via git log.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-19T03:05:01Z","receivedAt":"2006-05-19T03:05:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> Is there any place that depends on the ability to specify both a pickaxe\n> string _and_ always_show_header?  If not, it's hard to see how this patch\n> could break anything.\n\nUser's scripts.  The point is the set of arguments rev-list as\nthe lowest level machinery should not be modified by an\narbitrary policy decision that happens to suit \"git log\" usage.\n"},{"id":"20264","messageId":"BAYC1-PASMTP10904A6D8E8EC08830C8F3AEA70@CEZ.ICE","threadId":"4199","inReplyTo":"7vk68ilnoi.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow pickaxe to be used via git log.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-05-19T03:38:03Z","receivedAt":"2006-05-19T03:38:03Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Thu, 18 May 2006 20:05:01 -0700\nJunio C Hamano <junkio@cox.net> wrote:\n\n\n> User's scripts.  The point is the set of arguments rev-list as\n> the lowest level machinery should not be modified by an\n> arbitrary policy decision that happens to suit \"git log\" usage.\n> \n\nOkay, thanks.\n\nThis moves the policy up a level and into the log/show/whatchanged code\nand makes the code match the commit message better.  However, it will still\n\"disobey\" user options if the user tries to combine both pickaxe and\n--always for these commands; but hopefully that's okay at this level.\n\nSean\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex d5bbc1c..d2c3df0 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -23,6 +23,11 @@ static int cmd_log_wc(int argc, const ch\n \trev->commit_format = CMIT_FMT_DEFAULT;\n \trev->verbose_header = 1;\n \targc = setup_revisions(argc, argv, rev, \"HEAD\");\n+\tif (rev->diffopt.pickaxe && rev->always_show_header) {\n+\t\trev->always_show_header = 0;\n+\t\tif (rev->diffopt.output_format == DIFF_FORMAT_RAW)\n+\t\t\trev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;\n+\t}\n \n \tif (argc > 1)\n \t\tdie(\"unrecognized argument: %s\", argv[1]);\n"},{"id":"20263","messageId":"7vac9elm2p.fsf@assigned-by-dhcp.cox.net","threadId":"4199","inReplyTo":"BAYC1-PASMTP04945C92FB14DA65AB1AC7AEA70@CEZ.ICE","subject":"Re: [PATCH] Allow pickaxe to be used via git log.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-19T03:39:42Z","receivedAt":"2006-05-19T03:39:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> Handle the -S option when passed to git log such that only the appropriate\n> commits are displayed.  Unlike \"whatchanged\", by default no diff output\n> is produced.\n\nIf your goal is to make whatchanged less necessary, I think you\nwould need to special case --diff-filter as well for \"git log\",\nalthough nobody on #git channel seems to have noticed.  I often\nrun --diff-filter=A when I am trying to see when I added a\nparticular file, to avoid getting distracted by other types of\nchanges; log would be still shown if do not disable --always.\n"},{"id":"20265","messageId":"BAYC1-PASMTP096010F052E9BF78B5FD4AAEA70@CEZ.ICE","threadId":"4199","inReplyTo":"7vac9elm2p.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Allow pickaxe and diff-filter options to be used by git log.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-05-19T04:19:20Z","receivedAt":"2006-05-19T04:19:20Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"Handle the -S option when passed to git log such that only the\nappropriate commits are displayed.  Also per Junio's comments, do\nthe same for \"--diff-filter\", so that it too can be used as an option\nto git log.  By default no patch or diff information is displayed.\n\nSigned-off-by: Sean Estabrooks <seanlkml@sympatico.ca>\n\n---\n\n> If your goal is to make whatchanged less necessary, I think you\n> would need to special case --diff-filter as well for \"git log\",\n> although nobody on #git channel seems to have noticed.  I often\n> run --diff-filter=A when I am trying to see when I added a\n> particular file, to avoid getting distracted by other types of\n> changes; log would be still shown if do not disable --always.\n\nMakes sense.  This patch should cover that case too.\n\nSean\n\n\na2221c07a94bc378ef40182fa6b260ac88804073\n builtin-log.c |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\na2221c07a94bc378ef40182fa6b260ac88804073\ndiff --git a/builtin-log.c b/builtin-log.c\nindex d5bbc1c..12a6d19 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -23,6 +23,13 @@ static int cmd_log_wc(int argc, const ch\n \trev->commit_format = CMIT_FMT_DEFAULT;\n \trev->verbose_header = 1;\n \targc = setup_revisions(argc, argv, rev, \"HEAD\");\n+\tif (rev->always_show_header) {\n+\t\tif (rev->diffopt.pickaxe || rev->diffopt.filter) {\n+\t\t\trev->always_show_header = 0;\n+\t\t\tif (rev->diffopt.output_format == DIFF_FORMAT_RAW)\n+\t\t\t\trev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;\n+\t\t}\n+\t}\n \n \tif (argc > 1)\n \t\tdie(\"unrecognized argument: %s\", argv[1]);\n-- \n1.3.GIT\n"},{"id":"20266","messageId":"7vbqtuk1uw.fsf@assigned-by-dhcp.cox.net","threadId":"4199","inReplyTo":"BAYC1-PASMTP096010F052E9BF78B5FD4AAEA70@CEZ.ICE","subject":"Re: [PATCH] Allow pickaxe and diff-filter options to be used by git log.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-19T05:41:43Z","receivedAt":"2006-05-19T05:41:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> +\tif (rev->always_show_header) {\n> +\t\tif (rev->diffopt.pickaxe || rev->diffopt.filter) {\n\nI understand and agree to the change up to this part, but I do\nnot necessarily agree with what follows:\n\n> +\t\t\trev->always_show_header = 0;\n> +\t\t\tif (rev->diffopt.output_format == DIFF_FORMAT_RAW)\n> +\t\t\t\trev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;\n\nTo me, if the user explicitly says --diff-filter or -S, it seems\nmore natural to interpret that the user wanted _some_ sort of\ndiff.  Now, there are people who say raw format is anti-human,\nwhich I consider is a valid view, but I think it is better than\nNO_OUTPUT in that case.\n\nI wonder if doing something like this instead makes more sense\nperhaps?\n\n-- >8 --\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 69f2911..e68bfad 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -23,6 +23,35 @@ static int cmd_log_wc(int argc, const ch\n \tif (argc > 1)\n \t\tdie(\"unrecognized argument: %s\", argv[1]);\n \n+\tif (rev->always_show_header) {\n+\t\t/* Log command is primarily about the message for human\n+\t\t * consumption, but if the user asks for any diff, it\n+\t\t * is human unfriendly to give the raw diff.\n+\t\t *\n+\t\t * Show command is the same way, but there the default is\n+\t\t * always give patch output, so this does not trigger.\n+\t\t */\n+\t\tif (rev->diffopt.output_format == DIFF_FORMAT_RAW) {\n+\t\t\tif (rev->diffopt.pickaxe)\n+\t\t\t\trev->diffopt.output_format = DIFF_FORMAT_PATCH;\n+\t\t\telse {\n+\t\t\t\trev->diffopt.output_format = DIFF_FORMAT_DIFFSTAT;\n+\t\t\t\trev->diffopt.summary = 1;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* If the user is limiting the commits to the ones\n+\t\t * that have particular classes of diff, we should not\n+\t\t * show the log message for irrelevant ones.\n+\t\t *\n+\t\t * git show --diff-filter=R -M --all can be used to view\n+\t\t * the branch tips that renames something.  I do not know\n+\t\t * how useful that is, though.\n+\t\t */\n+\t\tif (rev->diffopt.pickaxe || rev->diffopt.filter)\n+\t\t\trev->always_show_header = 0;\n+\t}\n+\n \tprepare_revision_walk(rev);\n \tsetup_pager();\n \twhile ((commit = get_revision(rev)) != NULL) {\n"},{"id":"20268","messageId":"BAYC1-PASMTP092CB0667E05EA20FBA30EAEA70@CEZ.ICE","threadId":"4199","inReplyTo":"7vbqtuk1uw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow pickaxe and diff-filter options to be used by git log.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-05-19T05:49:38Z","receivedAt":"2006-05-19T05:49:38Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Thu, 18 May 2006 22:41:43 -0700\nJunio C Hamano <junkio@cox.net> wrote:\n\n> To me, if the user explicitly says --diff-filter or -S, it seems\n> more natural to interpret that the user wanted _some_ sort of\n> diff.  Now, there are people who say raw format is anti-human,\n> which I consider is a valid view, but I think it is better than\n> NO_OUTPUT in that case.\n> \n> I wonder if doing something like this instead makes more sense\n> perhaps?\n\nWell, I was looking at the use of diff-filter and -S as a way\nto prune uninteresting commits from the log rather than as an \ndesire to see the patch information.\n\nIt's pretty natural to add -p or --stat along with the above \noptions if that is what the user wants.  If you make those implied\nby using --diff-filter or -S is there a way for the user to say,\nno patch and no stat?\n\nSean\n"},{"id":"20269","messageId":"7v3bf6k0r5.fsf@assigned-by-dhcp.cox.net","threadId":"4199","inReplyTo":"BAYC1-PASMTP092CB0667E05EA20FBA30EAEA70@CEZ.ICE","subject":"Re: [PATCH] Allow pickaxe and diff-filter options to be used by git log.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-19T06:05:34Z","receivedAt":"2006-05-19T06:05:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> Well, I was looking at the use of diff-filter and -S as a way\n> to prune uninteresting commits from the log rather than as an \n> desire to see the patch information.\n\nFair enough.\n\n> It's pretty natural to add -p or --stat along with the above \n> options if that is what the user wants.  If you make those implied\n> by using --diff-filter or -S is there a way for the user to say,\n> no patch and no stat?\n\nWell, I was sneaking in a hidden feature with that tweak.\n\nRegardless of the diff-filter/-S issues, with that alternative\npatch, you could do:\n\n\t$ git log -r\n\nIt lets you do a wonderful thing with surprisingly small number\nof keystrokes ;-).\n"}]}