git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Generate shorter patch names

From
Karl Hasselström <kha@treskal.com>
Date
Nov 7, 2006, 06:59 UTC
Message-ID
<20061107065925.10728.85759.stgit@localhost>
In-Reply-To
<20061107065710.10728.85618.stgit@localhost>
From: Karl Hasselström <kha@treskal.com>

Not all commits are blessed with a really short first-line summary in their commit messages. This means that we shouldn't blindly take the entire first line of the comment, since that sometimes results in truly spectacular patch names.

I chose 30 characters as a reasonable value, considering that we don't yet have any tab-completion on patch names. There's probably not much point in making it configurable.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 stgit/commands/common.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 88b1b94..0e1bb44 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -286,10 +286,10 @@ def name_email_date(address):
 
 def make_patch_name(msg):
     """Return a string to be used as a patch name. This is generated
-    from the top line of the string passed as argument.
-    """
+    from the first 30 characters of the top line of the string passed
+    as argument."""
     if not msg:
         return None
 
-    subject_line = msg.lstrip().split('\n', 1)[0].lower()
+    subject_line = msg[:30].lstrip().split('\n', 1)[0].lower()
Previous: Karl HasselströmNext: Karl Hasselström
Message 2 of 3 in “Generate saner automatic patch names”
  1. 0/2 Generate saner automatic patch namesKarl Hasselström, Nov 7, 2006
  2. 1/2 Generate shorter patch namesKarl Hasselström, Nov 7, 2006
  3. 2/2 Generate unique patch namesKarl Hasselström, Nov 7, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.