git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald Nordgren <haraldnordgren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Git List" <git@vger.kernel.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v12 4/4] ls-remote: create '--sort' option
Date: Mon, 9 Apr 2018 02:09:15 +0200	[thread overview]
Message-ID: <CAHwyqnWe=KmmdGJJ_DnCK+D_FoC0sAQG_8=_p+4+Yxmr8s8sPA@mail.gmail.com> (raw)
In-Reply-To: <xmqq7eph9wds.fsf@gitster-ct.c.googlers.com>

On Mon, Apr 9, 2018 at 12:16 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> I can connect "because it deals only with remotes" and "access to
> the object may fail", but I wonder if we can clarify the former a
> bit better to make it easier to understand for those who are not yet
> familiar with Git.
>
>     Keys like `committerdate` that require access to the object will
>     not work [***HOW??? Do we get a segfault or something???***] for
>     refs whose objects have not yet been fetched from the remote.
>
> I added "for refs whose objects have not yet been fetched", whose
> explicit-ness made "will not work" to be an OK expression, but
> without it I would have suggested to rephrase it to "may not work".
>
> This is a tangent but I suspect that the description of --sort in
> git-for-each-ref documentation is wrong on the use of multiple
> options, or I am misreading parse_opt_ref_sorting(), which I think
> appends later keys to the end of the list, and compare_refs() which
> I think yields results when an earlier key in the last decides two
> are not equal and ignores the later keys.  The commit that added the
> description was c0f6dc9b ("git-for-each-ref.txt: minor
> improvements", 2008-06-05), and I think even back then the code in
> builtin-for-each-ref.c appended later keys at the end, and it seems
> nobody complained, so it is possible I am not reading the code right
> before fully adjusting to timezone change ;-)

Updated the docs.

>
> It is not too big a deal, but I find that liberal sprinkling of
> UNLEAK() is somewhat unsightly.  From the code we leave with this
> change, it is clear what we'd need to do when we make the code fully
> leak-proof (i.e. we'd have a several lines to free resources held by
> these two variables here, and then UNLEAK() that appear earlier in
> the function will become a "goto cleanup;" after setting appropriate
> value to "status"), so let's not worry about it.

Removed the "extra" unleak annotations within the if-return blocks,
but kept them at the end.

> Please do *NOT* step outside the pair of single quotes that protects
> the body of the test scriptlet and execute commands like "git
> rev-parse".  These execute in order to prepare the command line
> argument strings BEFORE test_expect_success can run (or the test
> framework decides if the test will be skipped via GIT_TEST_SKIP).
>
> Instead do it like so:
>
>         cat >expect <<-EOF &&
>         $(git rev-parse mark)   refs/tags/mark
>         $(git rev-parse mark1.1)        refs/tags/mark1.1
>         $(git rev-parse mark1.2)        refs/tags/mark1.2
>         $(git rev-parse mark1.10)       refs/tags/mark1.10
>         EOF
>
> I.e. the end token for << that is not quoted allows $var and $(cmd)
> to be substituted.
>
> Same comment applies throughout the remainder of this file.

Ah, thanks! I was looking for some way to allow the values to expand
within the proper test context.

So turns out '<<-\EOF' vs '<<-EOF' makes all the difference :)

> Other than that, this patch was a very pleasant read.  Thanks.

Thank you!

  reply	other threads:[~2018-04-09  0:09 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02  0:52 [PATCH] ls-remote: create option to sort by versions Harald Nordgren
2018-04-02  6:37 ` Ævar Arnfjörð Bjarmason
2018-04-02 16:26   ` Harald Nordgren
2018-04-02 17:32     ` Ævar Arnfjörð Bjarmason
2018-04-02 17:42       ` Harald Nordgren
2018-04-02 17:46     ` Jeff King
2018-04-02 18:32   ` Junio C Hamano
2018-04-02 20:03     ` Harald Nordgren
2018-04-02 22:11       ` [PATCH v5] ls-remote: create '--sort' option Harald Nordgren
2018-04-02 22:53         ` Eric Sunshine
2018-04-02 22:54           ` Eric Sunshine
2018-04-03  0:48       ` [PATCH v6] " Harald Nordgren
2018-04-02 21:05 ` [PATCH v4] " Harald Nordgren
2018-04-04 17:11 ` [PATCH v7] " Harald Nordgren
2018-04-04 17:18   ` Harald Nordgren
2018-04-04 17:47     ` Harald Nordgren
2018-04-04 18:56     ` Jeff King
2018-04-04 18:55   ` Jeff King
2018-04-04 23:01 ` [PATCH v8] " Harald Nordgren
2018-04-04 23:11   ` Harald Nordgren
2018-04-06 18:58     ` Jeff King
2018-04-06 18:58       ` [PATCH 1/3] ref-filter: use "struct object_id" consistently Jeff King
2018-04-06 18:59       ` [PATCH 2/3] ref-filter: make ref_array_item allocation more consistent Jeff King
2018-04-06 18:59       ` [PATCH 3/3] ref-filter: factor ref_array pushing into its own function Jeff King
2018-04-06 19:27         ` Derrick Stolee
2018-04-07 15:22           ` Harald Nordgren
2018-04-08 23:18         ` Junio C Hamano
2018-04-09  3:57           ` Jeff King
2018-04-04 23:32 ` [PATCH v9] ls-remote: create '--sort' option Harald Nordgren
2018-04-05  0:04 ` [PATCH v10] " Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08  1:06   ` Eric Sunshine
2018-04-08 12:27     ` Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08  1:48   ` Eric Sunshine
2018-04-08 12:28 ` [PATCH v12 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08 22:16   ` Junio C Hamano
2018-04-09  0:09     ` Harald Nordgren [this message]
2018-04-09  0:48       ` Junio C Hamano
2018-04-09  2:31     ` Eric Sunshine
2018-04-08 23:58 ` [PATCH v13 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-09  0:56   ` Junio C Hamano
2018-04-09  1:45     ` Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-11 17:57   ` Harald Nordgren
2018-04-11 18:07     ` Stefan Beller
2018-04-11 18:30       ` Todd Zullinger
2018-04-11 18:56       ` Eric Sunshine
2018-04-11 23:25         ` Junio C Hamano
2018-04-09  1:42 ` [PATCH v14 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-05-12  8:45   ` René Scharfe
2018-05-12  9:55     ` Jeff King

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='CAHwyqnWe=KmmdGJJ_DnCK+D_FoC0sAQG_8=_p+4+Yxmr8s8sPA@mail.gmail.com' \
    --to=haraldnordgren@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).