git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: Passing original commit sha1(s) to prepare-commit-msg hook
Date: Mon, 12 Jul 2010 03:49:28 -0700	[thread overview]
Message-ID: <20100712104928.GA22305@google.com> (raw)

Hi,

I would like to use a prepare-commit-msg hook to automatically edit commit
comments when a rebase is done, using information from the original
commit. For example:

- Adding a commit message line indicating that the commit is a rebase of
  the original commit(s),
- Adding comments based on information stored in git notes on the original
  commit(s).

Currently (I'm using git 1.7.1) the old->new commit sha1 information is
passed to the post-rewrite hook; however by then it is too late to do
anything with commit messages. During "git rebase" the applypatch-msg hook
is called with the original commit sha1 in
.git/rebase-apply/original-commit, and during "git rebase -i" the
prepare-commit-msg hook is called with current status of the rebase
available in .git/rebase-merge/done; however relying on this would seem
very fragile to me.

Would there be support for the idea of making the original commit sha1
information available to commit message hooks ? And if so, any advice how
I should go about implementing this ? (I have little experience with git
codebase).

Thanks,

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

                 reply	other threads:[~2010-07-12 10:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100712104928.GA22305@google.com \
    --to=walken@google.com \
    --cc=git@vger.kernel.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).