git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: greened@obbligato.org
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/8] Better Error Handling for add
Date: Tue, 01 Jan 2013 16:33:53 -0600	[thread overview]
Message-ID: <87obh8fs8e.fsf@waller.obbligato.org> (raw)
In-Reply-To: <7v1ue4a8i0.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 01 Jan 2013 13:39:03 -0800")

Junio C Hamano <gitster@pobox.com> writes:

>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
>> index 7ceb413..b8a807a 100755
>> --- a/contrib/subtree/git-subtree.sh
>> +++ b/contrib/subtree/git-subtree.sh
>> @@ -509,8 +509,20 @@ cmd_add()
>>  	ensure_clean
>>  	
>>  	if [ $# -eq 1 ]; then
>> +	        ref=$(git check-ref-format --normalize "refs/heads/$1") ||
>> +                die "'$1' is not a valid refspec.  Are you missing a branch?"
>
> Is a user forbidden from passing a commit that is not at the tip of
> an existing branch?  In other words, is
>
> 	$ subtree add origin/next~4^2
>
> forbidden?

Good point.  It probably shouldn't be.  I think rev-parse should be
enough of a check.

>> +	        rev=$(git rev-parse --verify $1) ||
>> +                die "'$1' is not a valid refspec.  Are you missing a branch?"
>> +
>>  		"cmd_add_commit" "$@"
>
> If you want to make sure you give a comit to add_commit, you can
> probably say something like this:
>
> 	git rev-parse -q --verify "$1^{commit}" >/dev/null ||
>         die "'$1' does not refer to a commit"

What does $1^{commit} mean?  I think your suggestion is what I want but
I don't know what it means yet.  :)

                           -David

  reply	other threads:[~2013-01-01 22:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-01  3:57 git-subtree Patches to Apply David A. Greene
2013-01-01  3:57 ` [PATCH 1/8] Use %B for Split Subject/Body David A. Greene
2013-01-01  4:06   ` greened
2013-01-01  5:58     ` Junio C Hamano
2013-01-01 22:25       ` greened
2013-01-01  5:56   ` Junio C Hamano
2013-01-01 22:24     ` greened
     [not found]     ` <CAPYzjrTqmzuWoDg+zvLxwB7g6J4J2wbBqpL+UbHKRHcbjA4HrA@mail.gmail.com>
2013-01-07 15:00       ` 郑文辉(Techlive Zheng)
2013-01-07 15:18     ` 郑文辉(Techlive Zheng)
2013-01-07 16:53       ` Junio C Hamano
2013-01-01 21:25   ` Junio C Hamano
2013-01-01 22:29     ` greened
2013-01-02  0:30       ` Junio C Hamano
2013-01-08 10:40         ` greened
2013-01-01  3:57 ` [PATCH 2/8] Add --unannotate David A. Greene
2013-01-01 21:30   ` Junio C Hamano
2013-01-01 22:31     ` greened
2013-01-02  0:32       ` Junio C Hamano
2013-01-08 10:42         ` greened
2013-01-17 21:07       ` James Nylen
2013-01-22  8:44         ` greened
2013-01-22 16:04           ` Junio C Hamano
2013-01-01  3:57 ` [PATCH 3/8] Better Error Handling for add David A. Greene
2013-01-01 21:39   ` Junio C Hamano
2013-01-01 22:33     ` greened [this message]
2013-01-02  2:21       ` Junio C Hamano
2013-01-01  3:57 ` [PATCH 4/8] Fix Synopsis David A. Greene
2013-01-01 21:40   ` Junio C Hamano
2013-01-01 22:35     ` greened
2013-01-01  3:57 ` [PATCH 5/8] Honor DESTDIR David A. Greene
2013-01-01 21:42   ` Junio C Hamano
2013-01-01 22:36     ` greened
2013-01-01  3:57 ` [PATCH 6/8] Make the Manual Directory if Needed David A. Greene
2013-01-01 21:44   ` Junio C Hamano
2013-01-01 22:37     ` greened
2013-01-01  3:57 ` [PATCH 7/8] Ignore git-subtree David A. Greene
2013-01-01 21:44   ` Junio C Hamano
2013-01-01  3:57 ` [PATCH 8/8] Fix Documentation Typo David A. Greene

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=87obh8fs8e.fsf@waller.obbligato.org \
    --to=greened@obbligato.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).