public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] Avoid the need of "--" when wildcard pathspec is used
Date: Tue, 30 Jun 2015 11:10:40 -0700	[thread overview]
Message-ID: <xmqqk2ulcbj3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1435668007-31231-1-git-send-email-pclouds@gmail.com> ("Nguyễn	Thái Ngọc Duy"'s message of "Tue, 30 Jun 2015 19:40:07 +0700")

Nguyễn Thái Ngọc Duy  <pclouds@gmail•com> writes:

> When "--" is lacking from the command line and a command can take both
> revs and paths, the idea is if an argument can be seen as both an
> extended SHA-1 and a path, then "--" is required or git refuses to
> continue. It's currently implemented as:
> ...

Hmph, how does this relate to 28fcc0b7 (pathspec: avoid the need of
"--" when wildcard is used, 2015-05-02)?  A follow-up?  "Oops, I did
it wrong"?  something else?

> diff --git a/setup.c b/setup.c
> index 82c0cc2..f7cb93b 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -143,6 +143,8 @@ int check_filename(const char *prefix, const char *arg)
>  		name = arg + 2;
>  	} else if (!no_wildcard(arg))
>  		return 1;
> +	else if (!no_wildcard(arg))
> +		return 1;

Puzzling.  You already checked if arg has an wildcard and returned
with 1 if there is none.  The added check looks like a no-op to me.

> diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh
> index b99d519..e5ceba3 100755
> --- a/t/t2019-checkout-ambiguous-ref.sh
> +++ b/t/t2019-checkout-ambiguous-ref.sh
> @@ -56,4 +56,30 @@ test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
>  	test_i18ngrep ! "^HEAD is now at" stderr
>  '
>  
> +test_expect_success 'wildcard ambiguation' '
> +	git init ambi &&
> +	(
> +		cd ambi &&
> +		echo a >a.c &&
> +		git add a.c &&
> +		echo b >a.c &&
> +		git checkout "*.c" &&
> +		echo a >expect &&
> +		test_cmp expect a.c
> +	)
> +'
> +
> +test_expect_success 'wildcard ambiguation (2)' '
> +	git init ambi2 &&
> +	(
> +		cd ambi2 &&
> +		echo a >"*.c" &&
> +		git add . &&
> +		test_must_fail git show :"*.c" &&
> +		git show :"*.c" -- >actual &&
> +		echo a >expect &&
> +		test_cmp expect actual
> +	)
> +'
> +
>  test_done

  reply	other threads:[~2015-06-30 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 12:40 [PATCH] Avoid the need of "--" when wildcard pathspec is used Nguyễn Thái Ngọc Duy
2015-06-30 18:10 ` Junio C Hamano [this message]
2015-06-30 23:07   ` Duy Nguyen
2015-07-01 11:08 ` [PATCH v2] Add tests for wildcard "path vs ref" disambiguation Nguyễn Thái Ngọc Duy
2015-07-01 16:31   ` 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

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

  git send-email \
    --in-reply-to=xmqqk2ulcbj3.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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