summaryrefslogtreecommitdiff
path: root/templates/hooks--prepare-commit-msg.sample
AgeCommit message (Collapse)Author
2017-08-14hook: use correct logical variableKaartic Sivaraam
Sign-off added should be that of the "committer", not that of the "commit's author"; that is how the rest of Git adds sign-off using sequencer.c::append_signoff(). Use the correct logical variable that identifies the committer. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-07-12hook: add a simple first exampleKaartic Sivaraam
Add a simple example that replaces an outdated example that was removed. This ensures that there's at the least a simple example that illustrates what could be done using the hook just by enabling it. Also, update the documentation. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-07-12hook: add sign-off using "interpret-trailers"Kaartic Sivaraam
The sample hook to prepare the commit message before a commit allows users to opt-in to add the sign-off to the commit message. The sign-off is added at a place that isn't consistent with the "-s" option of "git commit". Further, it could go out of view in certain cases. Add the sign-off in a way similar to "-s" option of "git commit" using git's interpret-trailers command. It works well in all cases except when the user invokes "git commit" without any arguments. In that case manually add a new line after the first line to ensure it's consistent with the output of "-s" option. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-07-12hook: name the positional variablesKaartic Sivaraam
It's always nice to have named variables instead of positional variables as they communicate their purpose well. Appropriately name the positional variables of the hook to make it easier to see what's going on. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-07-12hook: cleanup scriptKaartic Sivaraam
Prepare the 'preare-commit-msg' sample script for upcoming changes. Preparation includes removal of an example that has outlived it's purpose. The example is the one that comments the "Conflicts:" part of a merge commit message. It isn't relevant anymore as it's done by default since 261f315b ("merge & sequencer: turn "Conflicts:" hint into a comment", 2014-08-28). Further update the relevant comments from the sample script and update the documentation. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20Modernize git calling conventions in hook templatesBen Walton
The hook templates were still using/referencing 'git-foo' instead of 'git foo.' This patch updates the sample hooks to use the modern conventions instead. Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20Make templates honour SHELL_PATH and PERL_PATHBen Walton
The hook script templates were hard coded to use /bin/sh and perl. This patch ensures that they use the same tools specified for the rest of the suite. The impetus for the change was noticing that, as shipped, some of the hooks used shell constructs that wouldn't work under Solaris' /bin/sh (eg: $(cmd...) substitutions). Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26Fix use of "perl -i" on WindowsAlex Riesen
The perldiag(1) has following to say about this: "Can't do inplace edit without backup" (F) You're on a system such as MS-DOS that gets confused if you try reading from a deleted (but still opened) file. You have to say -i.bak, or some such. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-25Ship sample hooks with .sample suffixJunio C Hamano
We used to mark hooks we ship as samples by making them unexecutable, but some filesystems cannot tell what is executable and what is not. This makes it much more explicit. The hooks are suffixed with .sample (but now are made executable), so enabling it is still one step operation (instead of "chmod +x $hook", you would do "mv $hook.sample $hook") but now they won't get accidentally enabled on systems without executable bit. Signed-off-by: Junio C Hamano <gitster@pobox.com>