Re: [PATCH v6] [GSOC] trailer: add new trailer.<token>.cmd config option

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

 



Junio C Hamano <gitster@xxxxxxxxx> 于2021年4月3日周六 上午7:44写道:
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>
> > From: ZheNing Hu <adlternative@xxxxxxxxx>
> >
> > The `trailer.<token>.command` configuration variable
> > specifies a command (run via the shell, so it does not have
> > to be a single name of or path to the command, but can be a
> > shell script), and the first occurrence of substring $ARG is
> > replaced with the value given to the `interpret-trailer`
> > command for the token.  This has two downsides:
> > ...
> >
> >  Documentation/git-interpret-trailers.txt | 82 +++++++++++++++++---
> >  t/t7513-interpret-trailers.sh            | 95 +++++++++++++++++++++++-
> >  trailer.c                                | 38 +++++++---
> >  3 files changed, 193 insertions(+), 22 deletions(-)
>
> Merging this to anything that has zh/commit-trailer (which extends
> the tests in t7502) seems to break t7502.  Running the test with the
> "-i -v" option ends like so.
>
> expecting success of 7502.24 'commit --trailer with -c and command':
>         trailer_commit_base &&
>         cat >expected <<-\EOF &&
>         hello
>
>         Signed-off-by: C O Mitter <committer@xxxxxxxxxxx>
>         Signed-off-by: C1 E1
>         Helped-by: C2 E2
>         Mentored-by: C4 E4
>         Reported-by: A U Thor <author@xxxxxxxxxxx>
>         EOF
>         git -c trailer.report.key="Reported-by: " \
>                 -c trailer.report.ifexists="replace" \
>                 -c trailer.report.command="NAME=\"\$ARG\"; test -n \"\$NAME\" && \
>                 git log --author=\"\$NAME\" -1 --format=\"format:%aN <%aE>\" || true" \
>                 commit --trailer "report = author" --amend &&
>         git cat-file commit HEAD >commit.msg &&
>         sed -e "1,/^\$/d" commit.msg >actual &&
>         test_cmp expected actual
>
> [main 6b1e5e9] hello
>  Author: A U Thor <author@xxxxxxxxxxx>
>  1 file changed, 1 insertion(+)
> [main 97c7a39] hello
>  Author: A U Thor <author@xxxxxxxxxxx>
>  Date: Thu Apr 7 15:22:13 2005 -0700
>  1 file changed, 1 insertion(+)
> --- expected    2021-04-02 23:43:10.649082950 +0000
> +++ actual      2021-04-02 23:43:10.673085111 +0000
> @@ -4,4 +4,4 @@
>  Signed-off-by: C1 E1
>  Helped-by: C2 E2
>  Mentored-by: C4 E4
> -Reported-by: A U Thor <author@xxxxxxxxxxx>
> +Reported-by:
> not ok 24 - commit --trailer with -c and command
> #
> #               trailer_commit_base &&
> #               cat >expected <<-\EOF &&
> #               hello
> #
> #               Signed-off-by: C O Mitter <committer@xxxxxxxxxxx>
> #               Signed-off-by: C1 E1
> #               Helped-by: C2 E2
> #               Mentored-by: C4 E4
> #               Reported-by: A U Thor <author@xxxxxxxxxxx>
> #               EOF
> #               git -c trailer.report.key="Reported-by: " \
> #                       -c trailer.report.ifexists="replace" \
> #                       -c trailer.report.command="NAME=\"\$ARG\"; test -n \"\$NAME\" && \
> #                       git log --author=\"\$NAME\" -1 --format=\"format:%aN <%aE>\" || true" \
> #                       commit --trailer "report = author" --amend &&
> #               git cat-file commit HEAD >commit.msg &&
> #               sed -e "1,/^\$/d" commit.msg >actual &&
> #               test_cmp expected actual
> #

Little bug, Change it like this will work:

        } else if (conf->command) {
                strbuf_addstr(&cmd, conf->command);
-               strvec_push(&cp.args, cmd.buf);
                if (arg)
                        strbuf_replace(&cmd, TRAILER_ARG_STRING, arg);
+               strvec_push(&cp.args, cmd.buf);
        }

thanks.
--
ZheNing Hu




[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