git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 0/2] Slightly prettier reflog message from checkout
Date: Sat, 15 Jun 2013 18:24:44 -0700	[thread overview]
Message-ID: <7vmwqqkftv.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1371317906-3991-1-git-send-email-artagnon@gmail.com

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> [1/2] is important.  [2/2] is a minor prettification, that wouldn't
> have been possible without [1/2].
>
> Thanks.
>
> Ramkumar Ramachandra (2):
>   sha1_name: stop hard-coding 40-character hex checks
>   checkout: do not write full sha1 to reflog
>
>  builtin/checkout.c | 2 +-
>  sha1_name.c        | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)

I view the two codepaths touched by these patches the other way
around.

An abbreviated unique SHA-1 you have today may not be unique
tomorrow.  There is no reason to deliberately lose information
(e.g. by using "Then, instead of the absolute minimum, let's record
a bit more bytes" heuristics) when we record. The reflog recording
code in checkout writes full 40-characters on purpose and there is
no reason not to do so (i.e. the codepath that is the topic of 2/2).

That is a more important design decision between the two codepaths.

Once we accept that design principle of not losing information when
we do not have to, it naturally follows that the writing side should
write full 40-hex, and also the reading side (i.e. the codepath that
is the topic of 1/2) should make sure that it reads 40-hex and
nothing else.  This also reduces the risk of a funny branch name
that consists only of [0-9a-f] getting mistaken as an object name,
but that is not the primary point.

So I am fairly strongly negative on both changes.

  parent reply	other threads:[~2013-06-16  1:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-15 17:38 [PATCH 0/2] Slightly prettier reflog message from checkout Ramkumar Ramachandra
2013-06-15 17:38 ` [PATCH 1/2] sha1_name: stop hard-coding 40-character hex checks Ramkumar Ramachandra
2013-06-16 13:28   ` Phil Hord
2013-06-18  7:03     ` Ramkumar Ramachandra
2013-06-18 14:27       ` Junio C Hamano
2013-06-15 17:38 ` [PATCH 2/2] checkout: do not write full sha1 to reflog Ramkumar Ramachandra
2013-06-15 17:42 ` [PATCH 0/2] Slightly prettier reflog message from checkout Ramkumar Ramachandra
2013-06-16  1:24 ` Junio C Hamano [this message]
2013-06-16  9:21   ` Ramkumar Ramachandra
2013-06-17  2:59     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vmwqqkftv.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).