From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Michael J Gruber <git@drmicha.warpmail.net>
Subject: Re: [PATCH] t3703, t4208: add test cases for magic pathspec
Date: Mon, 9 May 2011 19:33:45 +0700 [thread overview]
Message-ID: <BANLkTikONPUVvAEw+fSDva8RUp-YSm-Nxw@mail.gmail.com> (raw)
In-Reply-To: <7v7ha1t6o9.fsf@alter.siamese.dyndns.org>
2011/5/9 Junio C Hamano <gitster@pobox.com>:
>> +test_expect_failure 'colon alone magic can only used alone' '
>> + test_must_fail git add -n sub/foo : &&
>> + test_must_fail git add -n : sub/foo
>> +'
>
> I don't care too much about this case (it is a user error), but if you
> promise you will turn this expect-failure to expect-success in a follow-up
> patch, why not ;-)?
failed tests are (annoying enough) to be fixed, right? :)
>> +cat >expected <<EOF
>> +add 'anothersub/foo'
>> +add 'expected'
>> +add 'sub/actual'
>> +add 'sub/foo'
>> +EOF
>> +
>> +test_expect_success 'add :' '
>> + (cd sub && git add -n : >actual) &&
>> + test_cmp expected sub/actual
>> +'
>
> Shouldn't
>
> $ git anycmd :
>
> be equivalent to
>
> $ (cd $(git rev-parse --show-cdup)/. && git anycmd)
>
> for any command? I doubt this test is expecting the right outcome.
> Shouldn't it result in "Nothing specified, nothing added."?
It's gray area. Yes I'd rather see that behavior, but then a lot of
code needs to be audited. Perhaps we should delay introducing ":"
until get_pathspec() learns to modify argc. IOW die() for now when
users write ":".
>> +test_expect_success 'add :/non-existent' '
>> + (cd sub && test_must_fail git add -n :/non-existent)
>> +'
>
> Just being curious. What should the error message say? Can we make it to
> say "fatal: pathspec 'non-ex' from root did not match any files"?
My opinion is in the next test. It should show exactly what users type
in, ie. "pathspec ':/non-existent' did not match any files". "'non-ex'
from root" is nice when there's only one magic. If users specify a few
more in one pathspec, the text may become too verbose.
>> +test_expect_failure 'show pathspecs exactly what are typed in' '
>> + test_cmp expected error
>> +'
>
> Will this break under gettext-poison?
Never really known what that poison is. Will grep ":/non-existent" instead.
>> +test_expect_failure 'git log :/ ambiguous with [ref]:/path' '
>> + test_must_fail git log :/ 2>error &&
>> + grep ambiguous error
>> +'
>> +test_expect_failure 'git log :' '
>> + git log :
>> +'
>
> These two should expect exactly the same error, I think. ':', ':/' or
> anything magic will not satisify verify_filename(), and needs a
> double-dash before it.
Yes. Error from the latter "fatal: Path '' does not exist (neither on
disk nor in the index)." makes me wonder, why does log accept a sha1
syntax that may resolve to non-commit object?
> We could improve the disambiguation heuristics so that when we do not have
> a '--' on the command line:
>
> - make sure all the earlier ones are refs and they cannot be a path on
> the filesystem (otherwise we need a disambiguator "--").
>
> - the first non-ref argument and everything that follows must be either a
> ':' magic, a string with globbing character, or a path on the
> filesystem, and none of them can be a ref.
>
> Do you want to take a stab at it?
A bit busy these days. If you're interested, go ahead.
--
Duy
next prev parent reply other threads:[~2011-05-09 12:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-07 10:35 [PATCH] t3703: add test cases for pathspec magic Nguyễn Thái Ngọc Duy
2011-05-07 18:56 ` Junio C Hamano
2011-05-08 9:59 ` Nguyen Thai Ngoc Duy
2011-05-08 11:08 ` [PATCH] t3703, t4208: add test cases for magic pathspec Nguyễn Thái Ngọc Duy
2011-05-08 17:59 ` Junio C Hamano
2011-05-09 12:33 ` Nguyen Thai Ngoc Duy [this message]
2011-05-09 16:18 ` Junio C Hamano
2011-05-09 22:06 ` Junio C Hamano
2011-05-10 5:51 ` [PATCH 0/9] magic pathspec updates Junio C Hamano
2011-05-10 5:51 ` [PATCH 1/9] grep: use get_pathspec() correctly Junio C Hamano
2011-05-10 5:51 ` [PATCH 2/9] get_pathspec(): an empty ':' pathspec should stand alone Junio C Hamano
2011-05-10 5:51 ` [PATCH 3/9] count_pathspec(): return number of elements in pathspec Junio C Hamano
2011-05-10 13:29 ` Nguyen Thai Ngoc Duy
2011-05-10 5:51 ` [PATCH 4/9] add ":" is a pathspec that is too wide Junio C Hamano
2011-05-10 5:51 ` [PATCH 5/9] git rm ":" is like specifying nothing Junio C Hamano
2011-05-10 5:51 ` [PATCH 6/9] clean " Junio C Hamano
2011-05-10 15:14 ` Thiago Farina
2011-05-10 5:51 ` [PATCH 7/9] mv ":" ":" is like moving nothing from nowhere to nowhere Junio C Hamano
2011-05-10 13:30 ` Nguyen Thai Ngoc Duy
2011-05-10 5:51 ` [PATCH 8/9] checkout ":" is not giving any pathspec Junio C Hamano
2011-05-10 5:51 ` [PATCH 9/9] t3703, t4208: add test cases for magic pathspec Junio C Hamano
2011-05-12 8:21 ` [PATCH jc/magic-pathspec] t3703: Skip tests using directory name ":" on Windows Johannes Sixt
2011-05-29 18:29 ` [PATCH 9/9] t3703, t4208: add test cases for magic pathspec Ævar Arnfjörð Bjarmason
2011-05-29 20:31 ` Junio C Hamano
2011-05-29 20:36 ` Ævar Arnfjörð Bjarmason
2011-05-10 13:47 ` [PATCH 0/9] magic pathspec updates Nguyen Thai Ngoc Duy
2011-05-10 17:07 ` Junio C Hamano
2011-05-11 12:11 ` 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=BANLkTikONPUVvAEw+fSDva8RUp-YSm-Nxw@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.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 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).