{"thread":{"id":"57521","subject":"git notes question","startedAt":"2022-03-08T13:07:59Z","lastAt":"2022-03-11T09:01:45Z","messageCount":9,"participants":["Nuno Sá","Erik Cervin Edin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"450728","messageId":"ea67407120aa710f81af048d22be09281ac28107.camel@gmail.com","threadId":"57521","inReplyTo":null,"subject":"git notes question","fromName":"Nuno Sá","fromEmail":"noname.nuno@gmail.com","sentAt":"2022-03-08T13:08:23Z","receivedAt":"2022-03-08T13:07:59Z","isPatch":false,"sender":{"key":"noname.nuno@gmail.com","avatar":null},"body":"Hi all,\n\nSorry if this is something already asked before...\n\nIs there any way to remove the default \"Notes:\" line on git-notes? I\ndon't really mind to have it in git log but when generating patches for\ninstance, I would like my notes to be something like:\n\ncommit title\n\nmessage\n\ntags...\n---\n\nv3:\n  notes on v3\n\nv2:\n  notes on v2\n\ninstead of having it like:\n\n...\n---\n\nNotes:\n    ...\n\nI did some code inspection and I guess that using a USER format would\nbe a way but I'm hopping there's a more direct way.\n\nThanks!\n- Nuno Sá\n"},{"id":"450820","messageId":"CA+JQ7M-dkV_AGJ8+4C6HcCN1sQgBtyfYbgUbnQQmYz9So3WwQQ@mail.gmail.com","threadId":"57521","inReplyTo":"ea67407120aa710f81af048d22be09281ac28107.camel@gmail.com","subject":"Re: git notes question","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-03-09T08:54:15Z","receivedAt":"2022-03-09T08:54:55Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"Hi Nuno!\n\n> Is there any way to remove the default \"Notes:\" line on git-notes? I\n> don't really mind to have it in git log but when generating patches for\n> instance, I would like my notes to be something like:\n\nJust to be clear, in relation to which command are we talking about?\n\nFor git-format-patch there's\n--notes\nwhich I assume doesn't support customization.\n\nFor git-log it's possible to customize how notes appear in git-log\nusing the standard way of formatting log messages, pretty format.\n%N\nis for the commit notes\nhttps://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emNem\nFor example\n  git log --pretty=format:%h%n%N\ndisplays each short hash and it's corresponding note.\n\nIt's also possible to use it when generating todos for git-rebase,\nhowever, they are written with a prepended new-line which breaks the\ntodo script :/\n"},{"id":"450821","messageId":"d204419925e7a4486d9a66a8a0f807a77be6d1b7.camel@gmail.com","threadId":"57521","inReplyTo":"CA+JQ7M-dkV_AGJ8+4C6HcCN1sQgBtyfYbgUbnQQmYz9So3WwQQ@mail.gmail.com","subject":"Re: git notes question","fromName":"Nuno Sá","fromEmail":"noname.nuno@gmail.com","sentAt":"2022-03-09T09:11:16Z","receivedAt":"2022-03-09T09:10:47Z","isPatch":false,"sender":{"key":"noname.nuno@gmail.com","avatar":null},"body":"Hi Erik,\n\nOn Wed, 2022-03-09 at 09:54 +0100, Erik Cervin Edin wrote:\n> Hi Nuno!\n> \n> > Is there any way to remove the default \"Notes:\" line on git-notes?\n> > I\n> > don't really mind to have it in git log but when generating patches\n> > for\n> > instance, I would like my notes to be something like:\n> \n> Just to be clear, in relation to which command are we talking about?\n> \n> For git-format-patch there's\n> --notes\n> which I assume doesn't support customization.\n> \n\nWell, this is the one I would like (hoped) that we could do something\nabout. When I do '--notes' in git-format-patch, I will always see:\n\n```\n(Typical git commit)\n...\n\n---\n(I just wanted \"Notes:\" to be removed and my notes to start at the\nbeginning of the line).\nNotes: \n\t(my notes go here)\n...\n\nAFAICT, git-format-patch looks to be using --pretty=email and I think\nwe can use --pretty in git-format-patch but having to mimic the email\nformat \"by hand\" is just painful and I was hoping a better way could\nexist.\n\n```\n> For git-log it's possible to customize how notes appear in git-log\n> using the standard way of formatting log messages, pretty format.\n> %N\n> is for the commit notes\n\nI'm aware of this and by briefly looking into the source code this\nseemed the only way to actually remove those predefined strings from\nnotes (I was just hoping I was wrong).\n> \nThanks for the feedback!\n- Nuno Sá\n"},{"id":"450895","messageId":"xmqqee3bm2b8.fsf@gitster.g","threadId":"57521","inReplyTo":"d204419925e7a4486d9a66a8a0f807a77be6d1b7.camel@gmail.com","subject":"Re: git notes question","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-09T18:02:51Z","receivedAt":"2022-03-09T18:03:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nuno Sá <noname.nuno@gmail.com> writes:\n\n> AFAICT, git-format-patch looks to be using --pretty=email and I think\n> we can use --pretty in git-format-patch but having to mimic the email\n> format \"by hand\" is just painful and I was hoping a better way could\n> exist.\n\nWell, this time it was \"Notes:\" label, but the next person who\nwants to see a deviation from the canned \"email\" format would want a\ndeviation different from yours.  Perhaps they want a different way\nto format the author name?  Perhaps they want a different way to\nseparate the title (to be on the \"Subject:\" line) out of the commit\nmessage?  Perhaps they want to see the log message be indented?\nPerhaps they want to see the message from the notes be line-wrapped?\nPerhaps they want to see the message from the notes not to be\nindented?  Perhaps they want to see the \"Notes (amlog):\" label to\nformat the name of the notes tree differently?\n\nWhere would that end?  We have to draw the line somewhere.\n\nThe customizability via --format=<template> is given for these\npeople who want to futz with that line.  One thing that may be a\ngood little project to help them is to make sure that the vanilla\n\"--pretty=email\" can be reimplemented as \"--format=<template>\" (I\ndoubt it is), design a way to fill the gaps (if there are) to get\nthere.  Once that is done, write down the \"--format=<template>\" that\nis equivalent to \"--pretty=email\" somewhere in the doc, to give\nthose who want to derive from the canned format some reasonable\nstarting point.\n"},{"id":"450986","messageId":"f5be5b264f30f689546db3883b4b64c88ba00cb3.camel@gmail.com","threadId":"57521","inReplyTo":"xmqqee3bm2b8.fsf@gitster.g","subject":"Re: git notes question","fromName":"Nuno Sá","fromEmail":"noname.nuno@gmail.com","sentAt":"2022-03-10T08:37:18Z","receivedAt":"2022-03-10T08:36:49Z","isPatch":false,"sender":{"key":"noname.nuno@gmail.com","avatar":null},"body":"On Wed, 2022-03-09 at 10:02 -0800, Junio C Hamano wrote:\n> Nuno Sá <noname.nuno@gmail.com> writes:\n> \n> > AFAICT, git-format-patch looks to be using --pretty=email and I\n> > think\n> > we can use --pretty in git-format-patch but having to mimic the\n> > email\n> > format \"by hand\" is just painful and I was hoping a better way\n> > could\n> > exist.\n> \n> Well, this time it was \"Notes:\" label, but the next person who\n> wants to see a deviation from the canned \"email\" format would want a\n> deviation different from yours.  Perhaps they want a different way\n\nI'm surely missing something but I'm not sure this is specific to the\nemail format? It's just that git-notes by default will always either\nappend the \"Notes:\" or \"Notes (<refname>):\" independent of the\npredefined format you use. The only way to stop it from doing that is,\napparently, by using your own --format=<template>...\n\nWhat I was asking was just if there was a way to not use these default\nstrings. I don't think this would open all kind of deviations... Either\nyou use these default strings or don't. But I think these strings are\nprobably used/important for git log? So we can know what is commit\nmessage and what are notes...\n\n> to format the author name?  Perhaps they want a different way to\n> separate the title (to be on the \"Subject:\" line) out of the commit\n> message?  Perhaps they want to see the log message be indented?\n> Perhaps they want to see the message from the notes be line-wrapped?\n> Perhaps they want to see the message from the notes not to be\n> indented?  Perhaps they want to see the \"Notes (amlog):\" label to\n> format the name of the notes tree differently?\n> \n> Where would that end?  We have to draw the line somewhere.\n> \n> The customizability via --format=<template> is given for these\n> people who want to futz with that line.  One thing that may be a\n> good little project to help them is to make sure that the vanilla\n> \"--pretty=email\" can be reimplemented as \"--format=<template>\" (I\n> doubt it is), design a way to fill the gaps (if there are) to get\n> there.  Once that is done, write down the \"--format=<template>\" that\n> is equivalent to \"--pretty=email\" somewhere in the doc, to give\n> those who want to derive from the canned format some reasonable\n> starting point.\n\nWell, this would be surely nice. For now, I will just remove it by hand\nor script something to do it before calling git-send-email.\n\nThanks for the feedback!\n- Nuno Sá\n\n"},{"id":"450994","messageId":"CA+JQ7M9HUMK8=b0+uxN9Kwx1VSH3OnxvdYTdw4ZoT9COHhJdeA@mail.gmail.com","threadId":"57521","inReplyTo":"f5be5b264f30f689546db3883b4b64c88ba00cb3.camel@gmail.com","subject":"Re: git notes question","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-03-10T13:11:49Z","receivedAt":"2022-03-10T13:12:30Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"> What I was asking was just if there was a way to not use these default\n> strings.\n\nForgive me but I'm somewhat perplexed as to why you want to change it.\nIs there a specific use-case where this is a problem or is it a\npersonal preference? Maybe you have a good reason and my imagination\nisn't stretching that far.\n\n> Well, this would be surely nice. For now, I will just remove it by hand\n> or script something to do it before calling git-send-email.\n\nHere's a simples sed that changes Notes: to setoN:\n  sed '/^---$/{N;N;/^---\\n\\nNotes:$/s@Notes:@setoN:@}'\n"},{"id":"450997","messageId":"1c967bd7f1536078b8972d5fc20bb1e4586f4bb1.camel@gmail.com","threadId":"57521","inReplyTo":"CA+JQ7M9HUMK8=b0+uxN9Kwx1VSH3OnxvdYTdw4ZoT9COHhJdeA@mail.gmail.com","subject":"Re: git notes question","fromName":"Nuno Sá","fromEmail":"noname.nuno@gmail.com","sentAt":"2022-03-10T13:26:55Z","receivedAt":"2022-03-10T13:26:26Z","isPatch":false,"sender":{"key":"noname.nuno@gmail.com","avatar":null},"body":"On Thu, 2022-03-10 at 14:11 +0100, Erik Cervin Edin wrote:\n> > What I was asking was just if there was a way to not use these\n> > default\n> > strings.\n> \n> Forgive me but I'm somewhat perplexed as to why you want to change\n> it.\n> Is there a specific use-case where this is a problem or is it a\n> personal preference? Maybe you have a good reason and my imagination\n> isn't stretching that far.\n> \n\nI think there are some misunderstanding here :). I'm not requesting to\nchange it. I was just asking if there was a way (already implemented\nand other than custom --format to get rid of it). And yes, this boils\ndown to personal preference and on how git-notes are typically written\nin linux kernel mailing lists in patch series. I was actually writing\nthem by hand when I realized I could use git-notes and create patches\nwith them (and that these notes could \"survive\" to rebases so that it\nwould be easier to have them placed across versions of the series).\n\n- Nuno Sá\n\n\n\n"},{"id":"451050","messageId":"xmqqlexhg0fy.fsf@gitster.g","threadId":"57521","inReplyTo":"f5be5b264f30f689546db3883b4b64c88ba00cb3.camel@gmail.com","subject":"Re: git notes question","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-10T17:52:01Z","receivedAt":"2022-03-10T17:52:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nuno Sá <noname.nuno@gmail.com> writes:\n\n>> Well, this time it was \"Notes:\" label, but the next person who\n>> wants to see a deviation from the canned \"email\" format would want a\n>> deviation different from yours.  Perhaps they want a different way\n>\n> I'm surely missing something but I'm not sure this is specific to the\n> email format? It's just that git-notes by default will always either\n> append the \"Notes:\" or \"Notes (<refname>):\" independent of the\n> predefined format you use. The only way to stop it from doing that is,\n> apparently, by using your own --format=<template>...\n> ...\n> What I was asking was just if there was a way to not use these default\n> strings. I don't think this would open all kind of deviations.\n\nNot limited to the email format.  \"git log\" will always prefix\n\"Author: \" before the commit author name, \"Date: \" date with extra\npaddingbefore the author, indents the log message by 4 spaces, adds\n\"Notes (refname):\" before notes, and indentation is given before the\ncontents of the notes.  There are many things, other than the\npresence of the \"Notes\" label, that people may want to customize in\nthe output from the commands in the \"git log\" family, including \"git\nformat-patch\".\n\nI think you were too focused on \"Notes\" tree to lose the view of the\nforest.  A line is drawn not to special case \"Notes\" prefix, because\nthere is no reason to do so without allowing all other things to\nalso be tweaked, and it will \"open all kind of deviations\".\n"},{"id":"451115","messageId":"91437bbc5700596e48fd7d22acb253acdcf628b9.camel@gmail.com","threadId":"57521","inReplyTo":"xmqqlexhg0fy.fsf@gitster.g","subject":"Re: git notes question","fromName":"Nuno Sá","fromEmail":"noname.nuno@gmail.com","sentAt":"2022-03-11T09:02:15Z","receivedAt":"2022-03-11T09:01:45Z","isPatch":false,"sender":{"key":"noname.nuno@gmail.com","avatar":null},"body":"On Thu, 2022-03-10 at 09:52 -0800, Junio C Hamano wrote:\n> Nuno Sá <noname.nuno@gmail.com> writes:\n> \n> > > Well, this time it was \"Notes:\" label, but the next person who\n> > > wants to see a deviation from the canned \"email\" format would\n> > > want a\n> > > deviation different from yours.  Perhaps they want a different\n> > > way\n> > \n> > I'm surely missing something but I'm not sure this is specific to\n> > the\n> > email format? It's just that git-notes by default will always\n> > either\n> > append the \"Notes:\" or \"Notes (<refname>):\" independent of the\n> > predefined format you use. The only way to stop it from doing that\n> > is,\n> > apparently, by using your own --format=<template>...\n> > ...\n> > What I was asking was just if there was a way to not use these\n> > default\n> > strings. I don't think this would open all kind of deviations.\n> \n> Not limited to the email format.  \"git log\" will always prefix\n> \"Author: \" before the commit author name, \"Date: \" date with extra\n> paddingbefore the author, indents the log message by 4 spaces, adds\n> \"Notes (refname):\" before notes, and indentation is given before the\n> contents of the notes.  There are many things, other than the\n> presence of the \"Notes\" label, that people may want to customize in\n> the output from the commands in the \"git log\" family, including \"git\n> format-patch\".\n> \n\nAlright... Now I got it. There's already lot of things that 'git log'\nand friends print by default that there's no reason to give special\ntreatment to \"Notes:\". That would indeed open the box for all kind of\nrequest.\n\nHaving a way to mimic email (or others) template in --format would\nindeed be nice though :).\n\n- Nuno Sá\n> \n\n"}]}