public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Thomas Gummerer <t.gummerer@gmail•com>,
	bturner@atlassian•com, pedrorijo91@gmail•com,
	git@vger•kernel.org
Subject: Re: [PATCH 4/4] ls-remote: add support for showing symrefs
Date: Sun, 17 Jan 2016 14:14:15 -0800	[thread overview]
Message-ID: <xmqqwpr7etvs.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160117151510.GC15519@sigill.intra.peff.net> (Jeff King's message of "Sun, 17 Jan 2016 10:15:10 -0500")

Jeff King <peff@peff•net> writes:

> We could also do it as:
>
>   ref: refs/heads/master     HEAD
>
> which matches the symref format itself. I guess that doesn't really
> matter here, but somehow it seems more aesthetically pleasing to me.

Yes, I think this should be the way to go.

> The output would look a lot nicer for humans if we right-padded the
> symref destination to match the 40-hex that is on all the other lines
> (so all of the refnames line up).  But that makes machine-parsing a lot
> harder. We could do something clever with isatty(1), but I don't think
> it's worth the effort.

And the target can be longer than 40-hex.  Don't play games with
padding.

>> +test_expect_success 'ls-remote with symrefs and refs combined' '
>> +	cat >expect <<-EOF &&
>> +	symref: refs/heads/master	HEAD
>> +	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/heads/master
>> +	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/remotes/origin/HEAD
>> +	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/remotes/origin/master
>> +	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/tags/mark
>> +	EOF
>
> I expected there to be a:
>
>   1bd44cb9d13204b0fe1958db0082f5028a16eb3a	HEAD
>
> line.

Yes, there should be, as I would imagine the most natural
interpretation of "--symrefs" by end users would be "show me ALSO
the symref information.", not "show me ONLY the symref information"
(if it were the latter we woudln't be seeing refs/tags/mark in the
above output).

I also suspect that this part of the patch is wrong (or at least
misleading):

@@ -98,6 +101,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	if (!dest && !quiet)
 		fprintf(stderr, "From %s\n", *remote->url);
 	for ( ; ref; ref = ref->next) {
+		if (symrefs && ref->symref)
+			printf("symref: %s	%s\n", ref->symref, ref->name);
+		if (symrefs && !flags)
+			continue;
 		if (!check_ref_type(ref, flags))
 			continue;
 		if (!tail_match(pattern, ref->name))

It looks wrong that the usual filtering with check_ref_type() and
tail_match() are bypassed for symbolic refs.  Even though the server
side currently feeds reflog information for only "HEAD", the code
should be prepared to do the sane thing in a future in which that
server-side limitation is corrected, and allow the user to ask

    ls-remote $there --symref refs/remotes/origin/HEAD

to learn the information on one specific ref, without having to see
the primary branch of $there repository, for example.

Thanks.

  parent reply	other threads:[~2016-01-17 22:18 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17 11:03 [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 11:03 ` [PATCH 1/4] ls-remote: document --quiet option Thomas Gummerer
2016-01-17 14:47   ` Jeff King
2016-01-17 17:13     ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 2/4] ls-remote: fix synopsis Thomas Gummerer
2016-01-17 11:04 ` [PATCH 3/4] ls-remote: use parse-options api Thomas Gummerer
2016-01-17 14:44   ` Jeff King
2016-01-17 17:27     ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] builtin/ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-17 11:16   ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] ls-remote: " Thomas Gummerer
2016-01-17 15:15   ` Jeff King
2016-01-17 17:38     ` Thomas Gummerer
2016-01-17 22:14     ` Junio C Hamano [this message]
2016-01-17 11:14 ` [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 15:16 ` Jeff King
2016-01-17 17:39   ` Thomas Gummerer
2016-01-17 22:15   ` Junio C Hamano
2016-01-18 16:57 ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 19:31     ` Jeff King
2016-01-18 20:01       ` Junio C Hamano
2016-01-18 21:39         ` Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 19:33     ` Jeff King
2016-01-18 16:57   ` [PATCH v2 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-18 19:52     ` Jeff King
2016-01-18 19:53       ` Jeff King
2016-01-18 22:09         ` Thomas Gummerer
2016-01-18 22:09       ` Thomas Gummerer
2016-01-18 22:20         ` Jeff King
2016-01-18 22:35           ` Thomas Gummerer
2016-01-18 20:09     ` Junio C Hamano
2016-01-18 21:48       ` Thomas Gummerer
2016-01-18 19:53   ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Jeff King
2016-01-18 23:20   ` [PATCH v3 0/5] ls-remote: introduce symref argument Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-19 18:14     ` [PATCH v3 0/5] ls-remote: introduce symref argument Junio C Hamano

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=xmqqwpr7etvs.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=bturner@atlassian$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pedrorijo91@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=t.gummerer@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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