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

Re: [PATCH/RFC] [git-subtree.sh] Use raw subject and body modifier "%B" instead of "%s%n%n%b" for commit

From
greened@obbligato.org <greened@obbligato.org>
Date
Aug 21, 2012, 01:52 UTC
Message-ID
<87628df1v4.fsf@waller.obbligato.org>
In-Reply-To
<1344561358-2953-1-git-send-email-techlivezheng@gmail.com>
Techlive Zheng <techlivezheng@gmail.com> writes:
Show 5 quoted lines
> I don't know if it is the right place to post this patch, I have sended
> an email to the original author apenwarr and have no response. According
> to <https://github.com/apenwarr/git-subtree/blob/master/THIS-REPO-IS-OBSOLETE>,
> this is the place, but <https://github.com/git/git/blob/master/contrib/README> says
> different, which is really confusing. Anyway, here I am.
This is the place.
> Recently, I imported a foreign git project as a sub directory into a
> main repo which I intend to maintain as primary.
Ok.
> Due to the project I imported has its own remote repo which hosted
> on the github, I expected after a 'git-subtree.sh split' the newly
> generated subtree branch would be exactly identical to the original
> branch. 
I would have thought so too.
Show 6 quoted lines
> Unfortunately, it is not. I have fixed the committer date and make
> everything looks the same with the original branch, but they just did
> not end up with same commit sha1 hash. Then, I used `git cat-file -p`
> to view the raw output of the both commits and found that the commit
> generate by git-subtree has a extra 'new-line' character appended at
> the end of the subject which causes the problem.
Hmm.
> I checked the source and found "%s%n%n%b" were used to generate the
> commit message, this works the fine when a commit has a subject as
> well as a body, but most of my commits only have a subject under
> which condition a extra 'new-line' character is appended.
Ah.  Yes, we should fix this.
> Instead, a raw subject and body message modifier '%B' should be used.
Ok.
Show 6 quoted lines
> Though I think this patch should be applied by default, but the mistake
> has been there for a long time, applying this patch may cause the patched
> git-subtree generate a different branch for those whose subtree branch
> has already been generated using the old git-subtree. Maybe this should
> be explained in the help or man page, and add a condition check or a
> compatible mode somehow.

The problem is in the split code? I'm not sure this is a big issue. I can run some experiments.

                      -Dave
Previous: greened@obbligato.org
Message 6 of 6 in “[git-subtree.sh] Use raw subject and body modifier "%B" instead of "%s%n%n%b" for commit”
  1. [git-subtree.sh] Use raw subject and body modifier "%B" instead of "%s%n%n%b" for commitTechlive Zheng, Aug 10, 2012
  2. subtree.sh: Use raw subject and body modifier "%B" instead of "%s%n%n%b"Techlive Zheng, Aug 10, 2012
  3. greened@obbligato.orgAug 21, 2012
  4. greened@obbligato.orgDec 31, 2012
  5. greened@obbligato.orgJan 1, 2013
  6. greened@obbligato.orgAug 21, 2012

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.