All of lore.kernel.org
 help / color / mirror / Atom feed
From: greened@obbligato.org
To: Junio C Hamano <gitster@pobox.com>
Cc: Drew Crawford <drew@drewcrawfordapps.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git subtree error (just how do you expect me to merge 0 trees?)
Date: Mon, 31 Dec 2012 22:04:41 -0600	[thread overview]
Message-ID: <87d2xpwnty.fsf@waller.obbligato.org> (raw)
In-Reply-To: <7v7gnxd24h.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Mon, 31 Dec 2012 19:16:14 -0800")

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

>> With one positional option, git-subtree add simply assumes
>> it's a refspec.  Is there an easy way to check whether a string is a
>> proper refspec?  Even better would be a way to check if a string is a
>> path to a git repository.
>
> Do you literally mean "a path to a repository" in the above, or do
> you mean "a remote that is like what is accepted by 'git fetch'"?

It's the latter as git-subtree calls git-fetch to do the work of
getting revisions.

> On the other hand, if you mean the command takes a remote and an
> optional list of refspecs just like "git fetch" does, then I am not
> sure it is a good design in the first place to allow "refspecs
> only", if only to keep the interface similar to "git fetch" (you
> cannot omit remote and give refspecs, as you cannot interpret
> refspecs without knowing in the context of which remote they are to
> be interpreted).

If just a refspec is given, git-subtree does a rev-parse in the current
directory and that seems to work fine.  It's what I as a user would
expect to happen.

> I would imagine you could disambiguate and default to "origin" or
> something when you guessed that remote was omitted if you really
> wanted to, with a syntacitical heuristics, such as "a refspec will
> never have two colons in it", "a URL tends to begin with a short
> alphabet word, a colon and double-slash", etc.

Hmm...I haven't added code to verify the repository/remote argument if
given.  I suppose a rev-parse --verify would suffice?

                        -David

  reply	other threads:[~2013-01-01  4:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 23:04 git subtree error (just how do you expect me to merge 0 trees?) Drew Crawford
2013-01-01  1:44 ` greened
2013-01-01  2:09 ` greened
2013-01-01  3:16   ` Junio C Hamano
2013-01-01  4:04     ` greened [this message]
2013-01-01  5:54       ` Junio C Hamano
2013-01-01  2:39 ` greened

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=87d2xpwnty.fsf@waller.obbligato.org \
    --to=greened@obbligato.org \
    --cc=drew@drewcrawfordapps.com \
    --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.
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.