All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Greg Hurrell <greg@hurrell.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] gitweb: use HEAD as primary sort key in git_get_heads_list()
Date: Wed, 09 Jun 2021 09:15:00 +0900	[thread overview]
Message-ID: <xmqqpmwvnbaz.fsf@gitster.g> (raw)
In-Reply-To: <20210608211440.37985-1-greg@hurrell.net> (Greg Hurrell's message of "Tue, 8 Jun 2021 23:14:40 +0200")

Greg Hurrell <greg@hurrell.net> writes:

> Prior to this commit, the "heads" section on a gitweb summary page would
> list the heads in `-committerdate` order (ie. the most recently-modified
> ones at the top), tie-breaking equal-dated refs using the implicit
> `refname` sort fallback.

Please lose "Prior to this commit"; when we talk about the state of
the code, we talk about what we have _without_ the proposed change,
so "Currently", etc. are noisewords.

And then we go on to explain why the current behaviour presented in
the first paragraph is undesirable, and how the proposal wants to
change the world to a better place.  That is missing here in the
proposed log message.

And then we give an order to the codebase to "become like so" in
imperative mood, perhaps turn this paragraph

> This commit adds another `--sort` parameter to the `git for-each-ref`
> invocation in `git_get_heads_list()`, ensuring that the `HEAD` ref
> always ends up getting sorted to the top, seeing as it is typically the
> "primary" line of development in some sense.

into:

    In addition to sorting with committerdate (most recent first),
    first show the primary branch that is pointed at with HEAD, by
    adding another `--sort` parameter ... 

> This seems to be a useful change, because I can't see anywhere else in
> the gitweb UI where we actually indicate to the user what the "default"
> branch is (ie. what they'll checkout if they run `git clone`).

The justification is a bit too weak to convince readers that using
%(HEAD) as the primary sort key to list the branch first in the list
view is *the* best way to solve the "it is unclear which one is the
defaul branch" problem, though.  An obvious alternative would be to
show '*' next to such a branch just like "git branch --list" does,
without changing the sort order at all, for example.

I am not sure if using it as the primary key is a good idea, though.
Wasn't your motivating example about tiebreaking between 'main' and
'master' that always point at the same commit?

> +		($limit ? '--count='.($limit+1) : ()),
> +		'--sort=-committerdate', '--sort=-HEAD',

Comparing %(HEAD), which is either ' ' or '*', for each ref?  It is
beyond "cute".  Nicely done.



  parent reply	other threads:[~2021-06-09  0:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06  8:51 [RFC PATCH] gitweb: use HEAD as primary sort key in git_get_heads_list() Greg Hurrell
2021-06-06  8:57 ` Greg Hurrell
2021-06-08  8:34   ` Jeff King
2021-06-08  9:02     ` Greg Hurrell
2021-06-08 21:14       ` Greg Hurrell
2021-06-08 22:07         ` Jeff King
2021-06-09  0:15         ` Junio C Hamano [this message]
2021-06-09  7:38           ` Greg Hurrell
2021-06-09  7:47             ` Junio C Hamano
2021-06-09 19:28               ` [PATCH v2] gitweb: use HEAD as secondary " Greg Hurrell

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=xmqqpmwvnbaz.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=greg@hurrell.net \
    /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.