{"thread":{"id":"18142","subject":"[PATCH] '%S' option for pretty printing to support --source","startedAt":"2009-03-05T07:18:28Z","lastAt":"2009-03-06T05:25:59Z","messageCount":5,"participants":["Petri Hodju","Jeff King","Johannes Schindelin","Deskin Miller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"107022","messageId":"200903050918.29051.petri.hodju@yumesystems.com","threadId":"18142","inReplyTo":null,"subject":"[PATCH] '%S' option for pretty printing to support --source","fromName":"Petri Hodju","fromEmail":"petri.hodju@yumesystems.com","sentAt":"2009-03-05T07:18:28Z","receivedAt":"2009-03-05T07:18:28Z","isPatch":true,"sender":{"key":"petri.hodju@yumesystems.com","avatar":null},"body":"From 79f817e25aada377ccb40ebf76c29af7f21e1ec4 Mon Sep 17 00:00:00 2001\nFrom: Petri Hodju <petrihodju@yahoo.com>\nDate: Thu, 5 Mar 2009 09:00:39 +0200\nSubject: [PATCH] '%S' option for pretty printing to support --source\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\nPrint out the ref name by which each commit was reached. Works only when --source option is used\n\nExamples:\n\ngit-log --graph --pretty=format:\"%h(%S) — %s (%cr)\" --abbrev-commit --date=relative --source\n\nShow ref by which each commit is reachable in current branch\n\ngit-log --graph --pretty=format:\"%h(%S) — %s (%cr)\" --abbrev-commit --date=relative --source --all\n\nShow ref by which each commit is reachable globally\n\nSigned-off-by: Petri Hodju <petrihodju@yahoo.com>\n---\n pretty.c |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 6cd9149..cf05b37 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -544,6 +544,12 @@ static void format_decoration(struct strbuf *sb, const struct commit *commit)\n \t\tstrbuf_addch(sb, ')');\n }\n \n+static void format_source(struct strbuf *sb, const struct commit *commit)\n+{\n+    if (commit->util)\n+\tstrbuf_addstr(sb, (char *) commit->util);\n+}\n+\n static size_t format_commit_item(struct strbuf *sb, const char *placeholder,\n                                void *context)\n {\n@@ -650,6 +656,9 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,\n \tcase 'd':\n \t\tformat_decoration(sb, commit);\n \t\treturn 1;\n+\tcase 'S':\n+\t\tformat_source(sb, commit);\n+\t\treturn 1;\n \t}\n \n \t/* For the rest we have to parse the commit header. */\n-- \n1.6.2.rc2.22.g1d035.dirty\n"},{"id":"107038","messageId":"20090305091758.GC30445@coredump.intra.peff.net","threadId":"18142","inReplyTo":"200903050918.29051.petri.hodju@yumesystems.com","subject":"Re: [PATCH] '%S' option for pretty printing to support --source","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-05T09:17:58Z","receivedAt":"2009-03-05T09:17:58Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 05, 2009 at 09:18:28AM +0200, Petri Hodju wrote:\n\n> +static void format_source(struct strbuf *sb, const struct commit *commit)\n> +{\n> +    if (commit->util)\n> +\tstrbuf_addstr(sb, (char *) commit->util);\n> +}\n> +\n\nHmm. This is the second patch in the last few weeks to use commit->util\nto carry information for --pretty=format: (I am cc'ing Deskin Miller,\nwho wrote the first).\n\nThey cannot both work, obviously. So we need to do one of:\n\n  - refactor the information out of commit->util to somewhere else\n\n  - allow multiple commit->util users somehow (which I think is a\n    potential performance problem -- the simplistic design is meant to\n    avoid things like allocation overhead)\n\n  - gracefully block concurrent use of conflicting features\n\n-Peff\n"},{"id":"107056","messageId":"alpine.DEB.1.00.0903051157070.6524@intel-tinevez-2-302","threadId":"18142","inReplyTo":"20090305091758.GC30445@coredump.intra.peff.net","subject":"Re: [PATCH] '%S' option for pretty printing to support --source","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-05T10:59:57Z","receivedAt":"2009-03-05T10:59:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 5 Mar 2009, Jeff King wrote:\n\n> On Thu, Mar 05, 2009 at 09:18:28AM +0200, Petri Hodju wrote:\n> \n> > +static void format_source(struct strbuf *sb, const struct commit *commit)\n> > +{\n> > +    if (commit->util)\n> > +\tstrbuf_addstr(sb, (char *) commit->util);\n> > +}\n> > +\n> \n> Hmm. This is the second patch in the last few weeks to use commit->util\n> to carry information for --pretty=format: (I am cc'ing Deskin Miller,\n> who wrote the first).\n> \n> They cannot both work, obviously. So we need to do one of:\n> \n>   - refactor the information out of commit->util to somewhere else\n> \n>   - allow multiple commit->util users somehow (which I think is a\n>     potential performance problem -- the simplistic design is meant to\n>     avoid things like allocation overhead)\n\nThe common way to do this is to use struct decoration.  I was under the \nimpression that --source already used that method (IIRC both --source and \nstruct decoration come from Linus, the latter of which having been \nrejected when I submitted it as a struct object_hash patch, which would \nhave been a better name IMHO).\n\nCiao,\nDscho\n"},{"id":"107089","messageId":"86d4c5e00903051141u61a131beg26b3df95bafd65d3@mail.gmail.com","threadId":"18142","inReplyTo":"20090305091758.GC30445@coredump.intra.peff.net","subject":"Re: [PATCH] '%S' option for pretty printing to support --source","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2009-03-05T19:41:44Z","receivedAt":"2009-03-05T19:41:44Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"On Thu, Mar 5, 2009 at 04:17, Jeff King <peff@peff.net> wrote:\n> On Thu, Mar 05, 2009 at 09:18:28AM +0200, Petri Hodju wrote:\n>\n>> +static void format_source(struct strbuf *sb, const struct commit *commit)\n>> +{\n>> +    if (commit->util)\n>> +     strbuf_addstr(sb, (char *) commit->util);\n>> +}\n>> +\n>\n> Hmm. This is the second patch in the last few weeks to use commit->util\n> to carry information for --pretty=format: (I am cc'ing Deskin Miller,\n> who wrote the first).\n\nThanks Jeff.  Fortunately I managed to catch this one anyway.\n\nPetri, the patch series from me which Jeff is referring to is viewable at\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/111524/\n\nfor reference.\n\nI am in the middle of a move and ought to be packing right now, so\nneedless to say my git budget at the moment is pretty much nil, and\nwill be so for at least another week I'd guess.  This is to say, I've\nnot done any additional work in light of Jeff's or Dscho's comments on\nmy series, though I intend to once I'm relocated.\n\n> They cannot both work, obviously. So we need to do one of:\n>\n>  - refactor the information out of commit->util to somewhere else\n>\n>  - allow multiple commit->util users somehow (which I think is a\n>    potential performance problem -- the simplistic design is meant to\n>    avoid things like allocation overhead)\n\nI'm inclined to do as Dscho suggests here: glancing at the current\nstruct decoration usage briefly I think my reflog printing could work\nthat way with no problem.  However, this would largely ignore your\nother comments about prettifying the pretty-printing code.  If a new\nseries using struct decoration isn't useful, let me know, otherwise\nI'll plan on doing this once I have a chance.\n\n>  - gracefully block concurrent use of conflicting features\n\nI agree that any blocking should be graceful, but ultimately I find\nthe idea of disallowing features because they happen to use the same\nunderlying implementation distasteful.  With a little work we should\nbe able to allow both with no problem.\n\nDeskin Miller\n"},{"id":"107148","messageId":"20090306052558.GC3426@sigill.intra.peff.net","threadId":"18142","inReplyTo":"86d4c5e00903051141u61a131beg26b3df95bafd65d3@mail.gmail.com","subject":"Re: [PATCH] '%S' option for pretty printing to support --source","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-06T05:25:59Z","receivedAt":"2009-03-06T05:25:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 05, 2009 at 02:41:44PM -0500, Deskin Miller wrote:\n\n> >  - gracefully block concurrent use of conflicting features\n> \n> I agree that any blocking should be graceful, but ultimately I find\n> the idea of disallowing features because they happen to use the same\n> underlying implementation distasteful.  With a little work we should\n> be able to allow both with no problem.\n\nYes, I would prefer to avoid blocking if at all possible. But I included\nit as a last resort until things can be fixed correctly. IOW, by\n\"graceful\" I just meant \"die with an error instead of segfaulting\".\nWhich would still arguably be a bug, but at least would clue the user in\nto what is happening.\n\nAnyway, happy moving and I'll look forward to seeing your patch when it\nis ready. :)\n\n-Peff\n"}]}