Re: [PATCH] git-commit: add a prepare-commit-msg hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On the other hand, if you want to always cause an action before
running a git opeation locally, you do not have to have a hook.
You can just prepare such a message based on GNU ChangeLog and
then run git-commit with -F, both inside your wrapper.

I see two other possibilities:

1) Would you prefer allowing to run a command by setting commit.template to something starting with an exclamation mark, i.e. something like "!git diff --cached --name-status -r"?

2) The pre-commit could receive a file name on the command line. If it creates that file, it would be used as a template for the commit message. The default implementation of pre-commit could include, commented out, a reimplementation of prepare_log_message. I like this the least.

3) Consider that the patch, as I implemented it, does not act solely on local data, because the index could be modified by the pre-commit hook. This possibility is contemplated explicitly in builtin-commit.c:

        /*
         * Re-read the index as pre-commit hook could have updated it,
         * and write it out as a tree.
         */

Paolo
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux