git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: scott douglass <scott0douglass@gmail.com>
To: git@vger.kernel.org
Subject: Fwd: Discovering the new parents in commit hooks
Date: Fri, 5 Jul 2019 23:01:59 +0100	[thread overview]
Message-ID: <CAOqHT5K_JZDZ1agEL4ceVdYY=4YYO715v+j_bNbJWOoV=KNqQQ@mail.gmail.com> (raw)
In-Reply-To: <CAOqHT5KUFOY9g-PDDq=PaXdqS41ZGYGMAUuBkU-UrPiSumqhTQ@mail.gmail.com>

Hi,

I’d like to be able to discover the new parents-to-be SHA-1s during
the hooks that run before a commit*.  Essentially I’d like be able to
distinguish the ‘git commit’ case from ‘git commit —amend’. Is there
already a way to do this that I have overlooked? (I’ve read ‘man
githooks’ and searched the wiki and various other places.)

If not, I would propose that perhaps the hooks could be passed a
GIT_PARENTS (or perhaps GIT_NEW_PARENTS) environment variable which in
the ‘not amend’ case would contain the SHA-1 for HEAD and MERGE_HEAD
(if appropriate) and in the ‘—amend' case would contain HEAD^@ (all of
the parents of HEAD).

[*] Specifically, it seems a useful thing to be able to find out in
these hooks:  applypatch-msg, pre-applypatch, commit-msg,
prepare-commit-msg, commit-msg

Thanks.

       reply	other threads:[~2019-07-05 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOqHT5KUFOY9g-PDDq=PaXdqS41ZGYGMAUuBkU-UrPiSumqhTQ@mail.gmail.com>
2019-07-05 22:01 ` scott douglass [this message]
2019-07-08 20:09   ` Fwd: Discovering the new parents in commit hooks brian m. carlson

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAOqHT5K_JZDZ1agEL4ceVdYY=4YYO715v+j_bNbJWOoV=KNqQQ@mail.gmail.com' \
    --to=scott0douglass@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).