git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Keeping <john@keeping.me.uk>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH 1/2] reset: handle submodule with trailing slash
Date: Tue, 10 Sep 2013 20:46:52 +0100	[thread overview]
Message-ID: <20130910194652.GP2582@serenity.lan> (raw)
In-Reply-To: <522F7509.1050100@web.de>

On Tue, Sep 10, 2013 at 09:37:45PM +0200, Jens Lehmann wrote:
> Am 10.09.2013 21:13, schrieb John Keeping:
> > When using tab-completion, a directory path will often end with a
> > trailing slash which currently confuses "git rm" when dealing with
> 
> I think you meant to say "git reset" in the line above. Apart from
> that I'm all for it.

Yeah, you're right - I obviously got confused between the two patches :-(.
I'll wait for more feedback before submitting a re-roll.

> > submodules.  Now that we have parse_pathspec we can easily handle this
> > by simply adding the PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag.
> > 
> > Signed-off-by: John Keeping <john@keeping.me.uk>
> > ---
> >  builtin/reset.c            | 5 +++++
> >  t/t7400-submodule-basic.sh | 6 ++++--
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/builtin/reset.c b/builtin/reset.c
> > index 5e4c551..9efac0f 100644
> > --- a/builtin/reset.c
> > +++ b/builtin/reset.c
> > @@ -220,8 +220,13 @@ static void parse_args(struct pathspec *pathspec,
> >  		}
> >  	}
> >  	*rev_ret = rev;
> > +
> > +	if (read_cache() < 0)
> > +		die(_("index file corrupt"));
> > +
> >  	parse_pathspec(pathspec, 0,
> >  		       PATHSPEC_PREFER_FULL |
> > +		       PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP |
> >  		       (patch_mode ? PATHSPEC_PREFIX_ORIGIN : 0),
> >  		       prefix, argv);
> >  }
> > diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> > index 4192fe0..c268d3c 100755
> > --- a/t/t7400-submodule-basic.sh
> > +++ b/t/t7400-submodule-basic.sh
> > @@ -481,7 +481,7 @@ test_expect_success 'do not add files from a submodule' '
> >  
> >  '
> >  
> > -test_expect_success 'gracefully add submodule with a trailing slash' '
> > +test_expect_success 'gracefully add/reset submodule with a trailing slash' '
> >  
> >  	git reset --hard &&
> >  	git commit -m "commit subproject" init &&
> > @@ -495,7 +495,9 @@ test_expect_success 'gracefully add submodule with a trailing slash' '
> >  	git add init/ &&
> >  	test_must_fail git diff --exit-code --cached init &&
> >  	test $commit = $(git ls-files --stage |
> > -		sed -n "s/^160000 \([^ ]*\).*/\1/p")
> > +		sed -n "s/^160000 \([^ ]*\).*/\1/p") &&
> > +	git reset init/ &&
> > +	git diff --exit-code --cached init
> >  
> >  '
> >  
> > 

  reply	other threads:[~2013-09-10 19:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 19:13 [PATCH 0/2] reset: handle submodule with trailing slash John Keeping
2013-09-10 19:13 ` [PATCH 1/2] " John Keeping
2013-09-10 19:37   ` Jens Lehmann
2013-09-10 19:46     ` John Keeping [this message]
2013-09-11  6:05   ` Johannes Sixt
2013-09-11  8:20     ` John Keeping
2013-09-11 10:54       ` Duy Nguyen
2013-09-11 11:08         ` John Keeping
2013-09-11 11:20           ` Duy Nguyen
2013-09-11 17:08         ` Junio C Hamano
2013-09-11 17:27           ` John Keeping
2013-09-11 18:14             ` Junio C Hamano
2013-09-11 18:22               ` John Keeping
2013-09-11 18:45                 ` Junio C Hamano
2013-09-10 19:13 ` [PATCH 2/2] rm: re-use parse_pathspec's trailing-slash removal John Keeping
2013-09-11  7:48   ` Duy Nguyen
2013-09-11  8:24     ` John Keeping
2013-09-12 19:24 ` [PATCH v2 0/4] submodule trailing slash improvements John Keeping
2013-09-12 19:24 ` [PATCH v2 1/4] pathspec: use is_dir_sep() to check for trailing slashes John Keeping
2013-09-12 20:17   ` Johannes Sixt
2013-09-12 19:24 ` [PATCH v2 2/4] pathspec: strip multiple trailing slashes from submodules John Keeping
2013-09-12 19:48   ` Junio C Hamano
2013-09-12 20:21     ` John Keeping
2013-09-13  1:28       ` Duy Nguyen
2013-09-13  8:48         ` John Keeping
2013-09-12 19:25 ` [PATCH v2 3/4] rm: re-use parse_pathspec's trailing-slash removal John Keeping
2013-09-12 19:25 ` [PATCH v2 4/4] reset: handle submodule with trailing slash John Keeping

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=20130910194652.GP2582@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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).