{"thread":{"id":"24372","subject":"Passing original commit sha1(s) to prepare-commit-msg hook","startedAt":"2010-07-12T10:49:28Z","lastAt":"2010-07-12T10:49:28Z","messageCount":1,"participants":["Michel Lespinasse"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"145360","messageId":"20100712104928.GA22305@google.com","threadId":"24372","inReplyTo":null,"subject":"Passing original commit sha1(s) to prepare-commit-msg hook","fromName":"Michel Lespinasse","fromEmail":"walken@google.com","sentAt":"2010-07-12T10:49:28Z","receivedAt":"2010-07-12T10:49:28Z","isPatch":false,"sender":{"key":"walken@google.com","avatar":null},"body":"Hi,\n\nI would like to use a prepare-commit-msg hook to automatically edit commit\ncomments when a rebase is done, using information from the original\ncommit. For example:\n\n- Adding a commit message line indicating that the commit is a rebase of\n  the original commit(s),\n- Adding comments based on information stored in git notes on the original\n  commit(s).\n\nCurrently (I'm using git 1.7.1) the old->new commit sha1 information is\npassed to the post-rewrite hook; however by then it is too late to do\nanything with commit messages. During \"git rebase\" the applypatch-msg hook\nis called with the original commit sha1 in\n.git/rebase-apply/original-commit, and during \"git rebase -i\" the\nprepare-commit-msg hook is called with current status of the rebase\navailable in .git/rebase-merge/done; however relying on this would seem\nvery fragile to me.\n\nWould there be support for the idea of making the original commit sha1\ninformation available to commit message hooks ? And if so, any advice how\nI should go about implementing this ? (I have little experience with git\ncodebase).\n\nThanks,\n\n-- \nMichel \"Walken\" Lespinasse\nA program is never fully debugged until the last user dies.\n"}]}