Skip to content

stg import omits first line if it contains a colon  #321

@fmaurer-rh

Description

@fmaurer-rh

The man page stg-import(1) contains two hints for how a file should look like to be imported:

The patch can either be a normal file with the description at the top, or it can have standard mail format.

The patch description must be separated from the diff with a "---" line.

Therefore, I assume a file looking like this would be valid (and it was before the rewrite, i.e., in version 1.x):

test: this is a demo patch

long explanation would be here

---

diff --git a/file.c b/file.c 
index abc123..def456 100644
--- a/file.c 
+++ b/file.c 
@@ -15,6 +15,8 @@
[...]

However, in the new version (tested with stgit 2.2.3, git 2.40.0), a patch like the one above is not imported correctly. The first line of the description is skipped and the second line gets to be the title of the resulting patch. The import works fine if the first line does not contain the colon. The issue is that many project, including, e.g., the Linux kernel, use colons in almost every commit message to describe the affected subsystem.

I traced this back to StupidContext.mailinfo() (which is called from import_file). This calls git mailinfo to split the file into the patch description and the diff. git-mailinfo seems to treat the first lines as email headers and removes them from the patch description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions