{"thread":{"id":"66049","subject":"[PATCH 0/1] Extract only the message log body from git commit.","startedAt":"2026-07-22T08:38:49Z","lastAt":"2026-07-23T07:55:02Z","messageCount":7,"participants":["hardikxk","Pablo Sabater","Hardik Kumar","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"548767","messageId":"20260722083836.744338-1-hardikxk@gmail.com","threadId":"66049","inReplyTo":null,"subject":"[PATCH 0/1] Extract only the message log body from git commit.","fromName":"hardikxk","fromEmail":"hardikxk@gmail.com","sentAt":"2026-07-22T08:38:35Z","receivedAt":"2026-07-22T08:38:49Z","isPatch":true,"body":"\nThe patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.\n\nPreviously the function would return the entire data of the objects\nincluding authors tree and SHAs. This patch fixes that to skip over all\nthat and just return the body of the log message.\n\nhardikxk (1):\n  Extract only the message body from git commit.\n\n git-p4.py | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\n\nbase-commit: 48bbf81c29ca9a4479ec7850fe206518682cdb2f\n-- \n2.55.0\n\n"},{"id":"548768","messageId":"20260722083836.744338-2-hardikxk@gmail.com","threadId":"66049","inReplyTo":"20260722083836.744338-1-hardikxk@gmail.com","subject":"[PATCH 1/1] Extract only the message body from git commit.","fromName":"hardikxk","fromEmail":"hardikxk@gmail.com","sentAt":"2026-07-22T08:38:36Z","receivedAt":"2026-07-22T08:38:59Z","isPatch":true,"body":"The patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.\n\nPreviously the function would return the entire data of the objects\nincluding authors tree and SHAs. This patch fixes that to skip over all\nthat and just return the body of the log message.\n\nSigned-off-by: hardikxk <hardikxk@gmail.com>\n---\n git-p4.py | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex c0ca7be..589efcd 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1003,12 +1003,18 @@ def branchExists(ref):\n def extractLogMessageFromGitCommit(commit):\n     logMessage = \"\"\n \n-    # fixme: title is first line of commit, not 1st paragraph.\n+    foundNewLine = False\n     foundTitle = False\n     for log in read_pipe_lines([\"git\", \"cat-file\", \"commit\", commit]):\n-        if not foundTitle:\n+        if not foundNewLine:\n+            # skip anything that is not the commit message\n             if len(log) == 1:\n-                foundTitle = True\n+                foundNewLine = True\n+            continue\n+\n+        # everything from here is the commit message\n+        if not foundTitle:\n+            foundTitle = True\n             continue\n \n         logMessage += log\n-- \n2.55.0\n\n"},{"id":"548774","messageId":"DK53I00U9FJS.2MUNWC5000IZ5@gmail.com","threadId":"66049","inReplyTo":"20260722083836.744338-2-hardikxk@gmail.com","subject":"Re: [PATCH 1/1] Extract only the message body from git commit.","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-07-22T12:23:12Z","receivedAt":"2026-07-22T12:23:20Z","isPatch":true,"body":"On Wed Jul 22, 2026 at 10:38 AM CEST, hardikxk wrote:\n> The patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.\n\nnit: wrap this long line to a max of ~72 columns.\nnit: s/metada/metadata/\n\n>\n> Previously the function would return the entire data of the objects\n> including authors tree and SHAs. This patch fixes that to skip over all\n> that and just return the body of the log message.\n\nnit: I think this can be written more clearly. Let's use present tense\nand state things affirmatively:\n\n  extractLogMessageFromGitCommit() returns the entire object data,\n  including authors, tree and SHAs.\n  Make it return only the log message body.\n\nDon't take this suggestion literally, as we find below that this log\ndoes not match reality.\n\nYou may find Documentation/CodingGuidelines and\nDocumentation/SubmittingPatches interesting.\n\n>\n> Signed-off-by: hardikxk <hardikxk@gmail.com>\n> ---\n>  git-p4.py | 12 +++++++++---\n>  1 file changed, 9 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index c0ca7be..589efcd 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1003,12 +1003,18 @@ def branchExists(ref):\n>  def extractLogMessageFromGitCommit(commit):\n>      logMessage = \"\"\n>\n> -    # fixme: title is first line of commit, not 1st paragraph.\n> +    foundNewLine = False\n>      foundTitle = False\n>      for log in read_pipe_lines([\"git\", \"cat-file\", \"commit\", commit]):\n> -        if not foundTitle:\n> +        if not foundNewLine:\n> +            # skip anything that is not the commit message\n>              if len(log) == 1:\n> -                foundTitle = True\n> +                foundNewLine = True\n> +            continue\n> +\n> +        # everything from here is the commit message\n> +        if not foundTitle:\n> +            foundTitle = True\n>              continue\n>\n>          logMessage += log\n\nReading the code, this doesn't seem to do what the log says it does.\nTesting it against what it did before this patch:\n\nFirst we need to do a bit of investigation, but we end up finding\nthat the commit that introduced this '# fixme' was:\n\n  b016d39756 (Robustness fixes for pipes, 2007-05-23)\n\nI couldn't find a thread about this commit.\n\n*Note that the output does not have line breaks; I'm adding them for\nreadability*.\n\npreviously:\n\n'Extract only the message body from git commit.\\n\\nThe patch fixes the\n`extractLogMessageFromGitCommit` function to skip all the metada of the\ncommit object and only return back the message body.\\n\\nPreviously the\nfunction would return the entire data of the objects\\nincluding authors\ntree and SHAs. This patch fixes that to skip over all\\nthat and just\nreturn the body of the log message.\\n\\nSigned-off-by: hardikxk <hardikxk@gmail.com>\\n'\n\nafter the patch:\n\n'\\nThe patch fixes the `extractLogMessageFromGitCommit` function to skip\nall the metada of the commit object and only return back the message\nbody.\\n\\nPreviously the function would return the entire data of the\nobjects\\nincluding authors tree and SHAs. This patch fixes that to skip\nover all\\nthat and just return the body of the log message.\n\\n\\nSigned-off-by: hardikxk <hardikxk@gmail.com>\\n'\n\nWe can see that the previous output only shows the commit log, title\n+ body. There were no SHAs, tree, etc., the opposite of what this\npatch's log claimed.\n\nWhat this patch actually does is drop the commit subject.\n\nIs this what the '# fixme' meant? I'm making assumptions here, since I\ncouldn't find a thread to be sure why it was added, but I think it is\neither about the loop stopping at the blank line rather than at the title\nitself, or a warning that a title is just one line and not a paragraph.\n\nEither way, this patch does not address the '# fixme' correctly.\n\nBefore continuing, I think we should try to understand what the '# fixme'\nmeant in the first place.\n\nRegards,\nPablo.\n\n"},{"id":"548775","messageId":"DK53TFGRDS4W.3SYPSLD4HJWIV@gmail.com","threadId":"66049","inReplyTo":"20260722083836.744338-1-hardikxk@gmail.com","subject":"Re: [PATCH 0/1] Extract only the message log body from git commit.","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-07-22T12:38:08Z","receivedAt":"2026-07-22T12:38:11Z","isPatch":true,"body":"On Wed Jul 22, 2026 at 10:38 AM CEST, hardikxk wrote:\n>\n> The patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.\n\nnit: Let's wrap this at ~72 columns.\n\n>\n> Previously the function would return the entire data of the objects\n> including authors tree and SHAs. This patch fixes that to skip over all\n> that and just return the body of the log message.\n\nThis repeats what the commit message already says. For a single-patch\nseries a cover letter is usually not needed.\n\nDocumentation/MyFirstContribution [1] notes that the commit message\nshould already explain the change at a high level, and that any extra\ncontext can go below the '---' line instead. I would drop this cover\nletter unless there's something else to say.\n\n>\n> hardikxk (1):\n>   Extract only the message body from git commit.\n>\n>  git-p4.py | 12 +++++++++---\n>  1 file changed, 9 insertions(+), 3 deletions(-)\n>\n>\n> base-commit: 48bbf81c29ca9a4479ec7850fe206518682cdb2f\n\n[1]: https://github.com/git/git/blob/master/Documentation/MyFirstContribution.adoc#bonus-chapter-one-patch-changes\n\nRegards,\nPablo\n\n"},{"id":"548780","messageId":"DK556S085CN5.25WTVX3W1DSUZ@gmail.com","threadId":"66049","inReplyTo":"DK53I00U9FJS.2MUNWC5000IZ5@gmail.com","subject":"Re: [PATCH 1/1] Extract only the message body from git commit.","fromName":"Hardik Kumar","fromEmail":"hardikxk@gmail.com","sentAt":"2026-07-22T13:42:35Z","receivedAt":"2026-07-22T13:42:42Z","isPatch":true,"body":"> nit: I think this can be written more clearly. Let's use present tense\n> and state things affirmatively:\n\nSure, I will update this in a later commit.\n\n> Reading the code, this doesn't seem to do what the log says it does.\n> Testing it against what it did before this patch:\n> We can see that the previous output only shows the commit log, title\n> + body. There were no SHAs, tree, etc., the opposite of what this\n> patch's log claimed.\n\nI see, I was comparing this to the how git stores your commits in\n.git/objects. My assumption was the function would take an object\nfrom there and (wanting to extract just the body) was taking the\nentire object as is and not stripping out the subject.\n\n> What this patch actually does is drop the commit subject.\n\nYes, since I suppose all the other places in the file where\nthis method is being used don't require the subject line.\n\n> Either way, this patch does not address the '# fixme' correctly.\n>\n> Before continuing, I think we should try to understand what the '# fixme'\n> meant in the first place.\n\nMy assumption was that the function that I made changes to was solely\nresponsible for sending back only the message stripping out subject and\nmetadata related to the commit object.\n\nMoving forward I suppose the one suggestion would be changing the name\nof the variable `foundTitle` to `foundSubject` instead since that might\nresult in less ambuiguity in what the function is doing (and the fixme).\nAlthough I dont't think if that really makes any difference.\n\nBut yes the #fixme does seem very vague now. Not sure if this is worth\nit.\n\nRegards,\nHardik.\n"},{"id":"548797","messageId":"xmqqtspqn3v1.fsf@gitster.g","threadId":"66049","inReplyTo":"20260722083836.744338-2-hardikxk@gmail.com","subject":"Re: [PATCH 1/1] Extract only the message body from git commit.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-22T20:53:06Z","receivedAt":"2026-07-22T20:53:09Z","isPatch":true,"body":"\nhardikxk <hardikxk@gmail.com> writes:\n\n> Subject: Re: [PATCH 1/1] Extract only the message body from git commit.\n\nPlease see Documentation/SubmittingPatches[[describe-changes]].\n\n> The patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.\n\nLine-wrap overly long lines like this one.\n\n> Previously the function would return the entire data of the objects\n> including authors tree and SHAs. This patch fixes that to skip over all\n> that and just return the body of the log message.\n\nPlease see Documentation/SubmittingPatches[[meaningful-message]].\nThe observation on how the current code behaves should not be\ndescribed as \"Previously X did Y\".  Just say \"X does Y\" instead.\nThere are other rules on how to write proposed commit log messages\nexplained there.\n\n> Signed-off-by: hardikxk <hardikxk@gmail.com>\n\nPlease see Documentation/SubmittingPatches[[real-name]].\n\n> ---\n>  git-p4.py | 12 +++++++++---\n>  1 file changed, 9 insertions(+), 3 deletions(-)\n\nThanks.\n\n> diff --git a/git-p4.py b/git-p4.py\n> index c0ca7be..589efcd 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1003,12 +1003,18 @@ def branchExists(ref):\n>  def extractLogMessageFromGitCommit(commit):\n>      logMessage = \"\"\n>  \n> -    # fixme: title is first line of commit, not 1st paragraph.\n> +    foundNewLine = False\n>      foundTitle = False\n>      for log in read_pipe_lines([\"git\", \"cat-file\", \"commit\", commit]):\n> -        if not foundTitle:\n> +        if not foundNewLine:\n> +            # skip anything that is not the commit message\n>              if len(log) == 1:\n> -                foundTitle = True\n> +                foundNewLine = True\n> +            continue\n> +\n> +        # everything from here is the commit message\n> +        if not foundTitle:\n> +            foundTitle = True\n>              continue\n>  \n>          logMessage += log\n\n"},{"id":"548802","messageId":"DK5SF3BIERU1.U4Y4PNRU0ARJ@gmail.com","threadId":"66049","inReplyTo":"xmqqtspqn3v1.fsf@gitster.g","subject":"Re: [PATCH 1/1] Extract only the message body from git commit.","fromName":"Hardik Kumar","fromEmail":"hardikxk@gmail.com","sentAt":"2026-07-23T07:54:52Z","receivedAt":"2026-07-23T07:55:02Z","isPatch":true,"body":"Thanks for review. I will take care of the conventions moving forward.\nAlso if possible could you clarify the fixme (or remove it if it no\nlonger seems to be valid).\n"}]}