threads / patch / 10610

patchDon't require working tree for git-rm

Subject: [PATCH] Don't require working tree for git-rm

## tl;dr

3 messages between Nov 3, 2007 and Nov 3, 2007. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Mike Hommey· Nov 3, 2007, 10:08 UTC · lore

This allows to do git rm --cached -r directory, instead of git ls-files -z directory | git update-index --remove -z --stdin. This can be particularly useful for git-filter-branch users.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 git.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git.c +1 −1
diff --git a/git.c b/git.c
index 4e10581..01dcb6a 100644
--- a/git.c
+++ b/git.c
@@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "rev-list", cmd_rev_list, RUN_SETUP },
 		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
 		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
-		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
+		{ "rm", cmd_rm, RUN_SETUP },
 		{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
 		{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
 		{ "show-branch", cmd_show_branch, RUN_SETUP },
-- 
1.5.3.5
Johannes Schindelin· Nov 3, 2007, 11:56 UTC · re: Mike Hommey · lore

Re: [PATCH] Don't require working tree for git-rm

Hi,
On Sat, 3 Nov 2007, Mike Hommey wrote:
Show 19 quoted lines
> This allows to do git rm --cached -r directory, instead of
> git ls-files -z directory | git update-index --remove -z --stdin.
> This can be particularly useful for git-filter-branch users.
> 
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>  git.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git.c b/git.c
> index 4e10581..01dcb6a 100644
> --- a/git.c
> +++ b/git.c
> @@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
>  		{ "rev-list", cmd_rev_list, RUN_SETUP },
>  		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
>  		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
> -		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
> +		{ "rm", cmd_rm, RUN_SETUP },
Just removing this is wrong!
You have to test for a working tree if "--cached" was _not_ given.  

Ciao, Dscho

Mike Hommey· Nov 3, 2007, 12:11 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Don't require working tree for git-rm

On Sat, Nov 03, 2007 at 11:56:17AM +0000, Johannes Schindelin wrote:
Show 27 quoted lines
> Hi,
> 
> On Sat, 3 Nov 2007, Mike Hommey wrote:
> 
> > This allows to do git rm --cached -r directory, instead of
> > git ls-files -z directory | git update-index --remove -z --stdin.
> > This can be particularly useful for git-filter-branch users.
> > 
> > Signed-off-by: Mike Hommey <mh@glandium.org>
> > ---
> >  git.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/git.c b/git.c
> > index 4e10581..01dcb6a 100644
> > --- a/git.c
> > +++ b/git.c
> > @@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
> >  		{ "rev-list", cmd_rev_list, RUN_SETUP },
> >  		{ "rev-parse", cmd_rev_parse, RUN_SETUP },
> >  		{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
> > -		{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
> > +		{ "rm", cmd_rm, RUN_SETUP },
> 
> Just removing this is wrong!
> 
> You have to test for a working tree if "--cached" was _not_ given.  
See the other patch I sent a bit later.
Mike

← back to recent threads