git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rev-list: use hdr_termination instead of a always using a newline

From
Jacob Keller <jacob.keller@gmail.com>
Date
Oct 20, 2016, 20:05 UTC
Message-ID
<CA+P7+xp1GevYkrSfDo2OtEve3RCXokawEf6c=5gF0daZOUF00Q@mail.gmail.com>
In-Reply-To
<xmqq4m46hmvq.fsf@gitster.mtv.corp.google.com>
On Thu, Oct 20, 2016 at 11:54 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> The main part of the patch looks good.  For "passing NUL to sed",
> I'd probably work it around like so:
>
Yep. I wasn't sure on the test as it was, because of the portability concern.
Show 40 quoted lines
>  t/t6000-rev-list-misc.sh | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
> index e8c6979baf..737026c34f 100755
> --- a/t/t6000-rev-list-misc.sh
> +++ b/t/t6000-rev-list-misc.sh
> @@ -4,12 +4,6 @@ test_description='miscellaneous rev-list tests'
>
>  . ./test-lib.sh
>
> -test_ends_with_nul() {
> -       printf "\0" >nul
> -       sed '$!d' "$@" >contents
> -       test_cmp_bin nul contents
> -}
> -
>  test_expect_success setup '
>         echo content1 >wanted_file &&
>         echo content2 >unwanted_file &&
> @@ -107,8 +101,17 @@ test_expect_success '--bisect and --first-parent can not be combined' '
>  '
>
>  test_expect_success '--header shows a NUL after each commit' '
> -       git rev-list --header --max-count=1 HEAD | sed \$!d >actual &&
> -       test_ends_with_nul actual
> +       # We know there is no Q in the true payload; names and
> +       # addresses of the authors and the committers do not have
> +       # any, and object names or header names do not, either.
> +       git rev-list --header --max-count=2 HEAD |
> +       nul_to_q |
> +       grep "^Q" >actual &&
> +       cat >expect <<-EOF &&
> +       Q$(git rev-parse HEAD~1)
> +       Q
> +       EOF
> +       test_cmp expect actual
>  '
>
>  test_done
I will squash this in and re-send.

Thanks, Jake

Previous: Junio C Hamano
Message 4 of 4 in “rev-list: use hdr_termination instead of a always using a newline”
  1. rev-list: use hdr_termination instead of a always using a newlineJacob Keller, Oct 20, 2016
  2. Dennis KaarsemakerOct 20, 2016
  3. Junio C HamanoOct 20, 2016
  4. Jacob KellerOct 20, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.