[PATCH 1/1] Extract only the message body from git commit.

hardikxk <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
The patch fixes the `extractLogMessageFromGitCommit` function to skip all the metada of the commit object and only return back the message body.

Previously the function would return the entire data of the objects
including authors tree and SHAs. This patch fixes that to skip over all
that and just return the body of the log message.

Signed-off-by: hardikxk <[email protected]>
---
 git-p4.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c0ca7be..589efcd 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1003,12 +1003,18 @@ def branchExists(ref):
 def extractLogMessageFromGitCommit(commit):
     logMessage = ""
 
-    # fixme: title is first line of commit, not 1st paragraph.
+    foundNewLine = False
     foundTitle = False
     for log in read_pipe_lines(["git", "cat-file", "commit", commit]):
-        if not foundTitle:
+        if not foundNewLine:
+            # skip anything that is not the commit message
             if len(log) == 1:
-                foundTitle = True
+                foundNewLine = True
+            continue
+
+        # everything from here is the commit message
+        if not foundTitle:
+            foundTitle = True
             continue
 
         logMessage += log
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.