git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Techlive Zheng <techlivezheng@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: apenwarr@gmail.com, greened@obbligato.org,
	Techlive Zheng <techlivezheng@gmail.com>
Subject: [PATCH/RFC] [git-subtree.sh] Use raw subject and body modifier "%B" instead of "%s%n%n%b" for commit
Date: Fri, 10 Aug 2012 09:15:57 +0800	[thread overview]
Message-ID: <1344561358-2953-1-git-send-email-techlivezheng@gmail.com> (raw)

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.

Recently, I imported a foreign git project as a sub directory into a
main repo which I intend to maintain as primary.

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. 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.

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.

Instead, a raw subject and body message modifier '%B' should be used.

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.

Techlive Zheng (1):
  subtree.sh: Use raw subject and body modifier "%B" instead of "%s%n%n%b"

 contrib/subtree/git-subtree.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.11.4

             reply	other threads:[~2012-08-10  1:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10  1:15 Techlive Zheng [this message]
2012-08-10  1:15 ` [PATCH] subtree.sh: Use raw subject and body modifier "%B" instead of "%s%n%n%b" Techlive Zheng
2012-08-21  1:56   ` greened
2012-12-31 22:57     ` greened
2013-01-01  3:59       ` greened
2012-08-21  1:52 ` [PATCH/RFC] [git-subtree.sh] Use raw subject and body modifier "%B" instead of "%s%n%n%b" for commit greened

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344561358-2953-1-git-send-email-techlivezheng@gmail.com \
    --to=techlivezheng@gmail.com \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=greened@obbligato.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).