git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	git@vger.kernel.org, tfransosi@gmail.com,
	"Jonathan Niedier" <jrnieder@gmail.com>,
	Matthieu.Moy@grenoble-inp.fr
Subject: Re: [PATCH] get_sha1: support relative path ":path" syntax
Date: Mon, 15 Nov 2010 09:29:42 -0800	[thread overview]
Message-ID: <7v4obimr5l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <AANLkTi=aVyOiRkE-+y8DDwcBQK36bVFrAX5PFw3TjCey@mail.gmail.com> (Sverre Rabbelier's message of "Mon\, 15 Nov 2010 15\:56\:20 +0100")

Sverre Rabbelier <srabbelier@gmail.com> writes:

> 2010/11/15 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
>> +               die("Relative path syntax is not supported in this command.\n"
>> +                   "Please report to git@vger.kernel.org.");
>
> Might it save us a lot of debugging hassle later if we report what
> "this command" is? E.g., if the user is using some internal tool that
> happens to dispatch to a command that doesn't support this, it could
> help us to know what command is being used?

In the absence of programming errors, should all git command support
<tree>:./<path> syntax to name an object, or are there cases where the
relative does not make any sense?

What I am trying to get at is that if this is diagnosing a user error, or
if this is showing that the mechanism to implement the relative path is
unnecessarily hard for the programmers to misuse.

For example, if "git show HEAD:./Makefile" in a bare repository is a user
error, it is not "not supported in this command" but "not supported in
this situation (more specifically, in a bare repository)", so the first
line is wrong, and more importantly, if that is a user error, there is
nothing to report to the list.

If on the other hand, a command that ought to allow use of relative path
didn't set up necessary startup_info, this is diagnosing a programming
error.  But if that is the case, shouldn't we be able to do much better to
avoid such mistakes in the first place than triggering a BUG() here when
the user happens to try using this particular feature?  In other words,
even when this "feature" isn't used in a particular invocation of a
command, a command that is capable of supporting the feature should always
be setting up startup_info, perhaps by the time its cmd_foo() is called,
no?  Shouldn't we be putting a BUG() somewhere higher and more visible in
the callchain to help catching such bugs?

  reply	other threads:[~2010-11-15 17:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 14:08 [PATCH 0/3] Support relative path in <blah>:path syntax Nguyễn Thái Ngọc Duy
2010-11-11 14:08 ` [PATCH 1/3] setup: save prefix (original cwd relative to toplevel) in startup_info Nguyễn Thái Ngọc Duy
2010-11-11 14:08 ` [PATCH 2/3] Make prefix_path() return char* without const Nguyễn Thái Ngọc Duy
2010-11-11 14:08 ` [PATCH 3/3] get_sha1: support relative path ":path" syntax Nguyễn Thái Ngọc Duy
2010-11-14 20:22   ` Thiago Farina
2010-11-15  3:56     ` [PATCH] " Nguyễn Thái Ngọc Duy
2010-11-15 14:56       ` Sverre Rabbelier
2010-11-15 17:29         ` Junio C Hamano [this message]
2010-11-15 18:59           ` Junio C Hamano
2010-11-28  3:37           ` Nguyễn Thái Ngọc Duy
2010-11-17 17:54 ` [PATCH 0/3] Support relative path in <blah>:path syntax Junio C Hamano
2010-11-18  1:47   ` Nguyen Thai Ngoc Duy

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=7v4obimr5l.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=srabbelier@gmail.com \
    --cc=tfransosi@gmail.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).