All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/4] hook: add a simple first example
Date: Mon, 10 Jul 2017 13:02:06 -0700	[thread overview]
Message-ID: <xmqqbmos5add.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170710141744.8541-4-kaarticsivaraam91196@gmail.com> (Kaartic Sivaraam's message of "Mon, 10 Jul 2017 19:47:44 +0530")

Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:

>  I made an attempt to make the second example work with amending 
>  with the aim of making it suitable for usage out of the box. It
>  seems that it's not easy to make it work as the status of a file
>  cannot be determined correctly when the index while amending
>  introduces changes to a file that has a change in the commit being
>  amended.
>
>  Is there any way in which the second example could be made to work with
>  amending without much effort? I'm asking this assuming something might
>  have happened, since the script was added, that could ease the task.

Sorry, but I do not understand what you are asking here.

Ahh, do you mean if we can avoid doing one half of the 1/4 (i.e. the
part that removes the commented out 'diff --name-status') and instead
make it a useful example (while still removing the thing that
comments out the "conflicts:")?

After going back and checking 1/4, I realize that I misread the patch.
you did keep the commented out 'diff --name-status' thing, so it still
has three---it just lost one half of the original "first" example.  So
please disregard my earlier "do we still have three, not two?"



>  Documentation/githooks.txt                 | 3 +++
>  templates/hooks--prepare-commit-msg.sample | 5 ++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
> index fdc01aa25..59f38efba 100644
> --- a/Documentation/githooks.txt
> +++ b/Documentation/githooks.txt
> @@ -121,6 +121,9 @@ it is not suppressed by the `--no-verify` option.  A non-zero exit
>  means a failure of the hook and aborts the commit.  It should not
>  be used as replacement for pre-commit hook.
>  
> +The sample `prepare-commit-msg` hook that comes with Git removes the
> +help message found in the commented portion of the commit template.
> +
>  commit-msg
>  ~~~~~~~~~~
>  
> diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample
> index a15d6d634..a84c3e5a8 100755
> --- a/templates/hooks--prepare-commit-msg.sample
> +++ b/templates/hooks--prepare-commit-msg.sample
> @@ -9,7 +9,8 @@
>  #
>  # To enable this hook, rename this file to "prepare-commit-msg".
>  
> -# This hook includes three examples.
> +# This hook includes three examples.  The first one removes the
> +# "# Please enter the commit message..." help message.
>  #
>  # The second includes the output of "git diff --name-status -r"
>  # into the message, just before the "git status" output.  It is
> @@ -23,6 +24,8 @@ COMMIT_MSG_FILE=$1
>  COMMIT_SOURCE=$2
>  SHA1=$3
>  
> +@PERL_PATH@ -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
> +
>  # case "$COMMIT_SOURCE,$SHA1" in
>  #  ,|template,)
>  #    @PERL_PATH@ -i.bak -pe '

  reply	other threads:[~2017-07-10 20:02 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 15:43 [PATCH] hooks: add signature to the top of the commit message Kaartic Sivaraam
2017-06-30 16:44 ` Junio C Hamano
2017-07-01 14:15   ` Kaartic Sivaraam
2017-07-01 16:16     ` "git intepret-trailers" vs. "sed script" to add the signature Kaartic Sivaraam
2017-07-01 17:32       ` [PATCH/RFC] hooks: add signature using "interpret-trailers" Kaartic Sivaraam
2017-07-03 16:58       ` "git intepret-trailers" vs. "sed script" to add the signature Junio C Hamano
2017-07-04 19:16         ` Kaartic Sivaraam
2017-07-05  1:48           ` Junio C Hamano
2017-07-05 17:00           ` [PATCH] hooks: add signature using "interpret-trailers" Kaartic Sivaraam
2017-07-05 17:35             ` Kaartic Sivaraam
2017-07-05 19:37               ` Junio C Hamano
2017-07-05 20:14               ` Ramsay Jones
2017-07-06 14:30                 ` Kaartic Sivaraam
2017-07-01 17:36     ` [PATCH] hooks: add signature to the top of the commit message Junio C Hamano
2017-07-01 18:40       ` Philip Oakley
2017-07-01 20:28         ` Junio C Hamano
2017-07-01 21:00           ` Philip Oakley
2017-07-01 18:52       ` Kaartic Sivaraam
2017-07-01 20:31         ` Junio C Hamano
2017-07-02 11:19           ` Kaartic Sivaraam
2017-07-02 11:27             ` [PATCH/RFC] hooks: replace irrelevant hook sample Kaartic Sivaraam
2017-07-05 16:51               ` [PATCH] " Kaartic Sivaraam
2017-07-05 19:50                 ` Junio C Hamano
2017-07-07 11:53                   ` Kaartic Sivaraam
2017-07-07 15:05                     ` Junio C Hamano
2017-07-07 15:24                       ` Kaartic Sivaraam
2017-07-07 16:07                         ` [PATCH 1/2] " Kaartic Sivaraam
2017-07-07 16:07                           ` [PATCH 2/2] hooks: add signature using "interpret-trailers" Kaartic Sivaraam
2017-07-07 18:27                           ` [PATCH 1/2] hooks: replace irrelevant hook sample Junio C Hamano
2017-07-10 14:17                             ` [PATCH 1/4] hook: cleanup script Kaartic Sivaraam
2017-07-10 14:17                               ` [PATCH 2/4] hook: name the positional variables Kaartic Sivaraam
2017-07-10 19:51                                 ` Junio C Hamano
2017-07-10 14:17                               ` [PATCH 3/4] hook: add signature using "interpret-trailers" Kaartic Sivaraam
2017-07-10 15:13                                 ` Ramsay Jones
2017-07-10 19:53                                   ` Junio C Hamano
2017-07-11 14:11                                     ` [PATCH 1/4] hook: cleanup script Kaartic Sivaraam
2017-07-11 14:11                                       ` [PATCH 2/4] hook: name the positional variables Kaartic Sivaraam
2017-07-11 14:11                                       ` [PATCH 3/4] hook: add sign-off using "interpret-trailers" Kaartic Sivaraam
2017-08-14  8:46                                         ` [PATCH] hook: use correct logical variable Kaartic Sivaraam
2017-08-14 17:54                                           ` Stefan Beller
2017-08-14 18:19                                           ` Junio C Hamano
2017-08-15  9:31                                             ` Kaartic Sivaraam
2017-08-15 17:28                                               ` Junio C Hamano
2017-08-17  2:47                                                 ` Kaartic Sivaraam
2017-08-17  2:50                                                   ` [PATCH v2/RFC] " Kaartic Sivaraam
2017-08-15  9:32                                             ` [PATCH] " Kaartic Sivaraam
2017-07-11 14:11                                       ` [PATCH 4/4] hook: add a simple first example Kaartic Sivaraam
2017-07-11 14:30                                         ` Kaartic Sivaraam
2017-07-11 13:10                                   ` [PATCH 3/4] hook: add signature using "interpret-trailers" Kaartic Sivaraam
2017-07-11 13:18                                   ` Kaartic Sivaraam
2017-07-10 14:17                               ` [PATCH 4/4] hook: add a simple first example Kaartic Sivaraam
2017-07-10 20:02                                 ` Junio C Hamano [this message]
2017-07-11 13:29                                   ` Kaartic Sivaraam
2017-07-11 16:03                                     ` Junio C Hamano
2017-07-11 18:04                                       ` Kaartic Sivaraam
2017-07-11 18:06                                       ` Kaartic Sivaraam
2017-07-10 19:50                               ` [PATCH 1/4] hook: cleanup script Junio C Hamano
2017-07-02 11:29             ` [PATCH] hooks: add script to HOOKS that allows adding notes from commit message Kaartic Sivaraam

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=xmqqbmos5add.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kaarticsivaraam91196@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.