# [PATCH] Documentation/git-filter-branch: Remove Useless Use of Plumbing

3 messages from 2008-07-22 to 2008-07-23. Participants: Petr Baudis, Junio C Hamano.
Thread: https://gitlist.dev/t/14604

## Petr Baudis, 2008-07-22 22:24

Subject: [PATCH] Documentation/git-filter-branch: Remove Useless Use of Plumbing
Message-ID: <20080722222418.15372.62190.stgit@localhost>
URL: https://gitlist.dev/e/20080722222418.15372.62190.stgit%40localhost

```
The example to remove file using index-filter uses git update-index
 --remove where git rm --cached works as well.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Documentation/git-filter-branch.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index a3edc00..7ba9dab 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -191,7 +191,7 @@ Thus you may instead want to use `rm -f filename` as the script.
 A significantly faster version:
 
 --------------------------------------------------------------------------
-git filter-branch --index-filter 'git update-index --remove filename' HEAD
+git filter-branch --index-filter 'git rm --cached filename' HEAD
 --------------------------------------------------------------------------
 
 Now, you will get the rewritten history saved in HEAD.

```

## Junio C Hamano, 2008-07-23 00:05

Subject: Re: [PATCH] Documentation/git-filter-branch: Remove Useless Use of Plumbing
Message-ID: <7vd4l5jwi4.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd4l5jwi4.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080722222418.15372.62190.stgit@localhost>

```
Petr Baudis <pasky@suse.cz> writes:

> The example to remove file using index-filter uses git update-index
>  --remove where git rm --cached works as well.

I am not sure "works as well" is a good enough justification to choose a
Porcelain command over a plumbing command in this particular context.
After all, filter-branch is a scripting enviornment, isn't it?

There also is another subtle difference.  "git rm" takes pathspecs while
"update-index" takes paths.

So after running one of these commands:

	$ git rm --cached 'Makefil?'
	$ git update-index --force-remove 'Makefil?'

output from:

	$ git diff --cached --stat

would be different.

```

## Petr Baudis, 2008-07-23 22:02

Subject: Re: [PATCH] Documentation/git-filter-branch: Remove Useless Use of Plumbing
Message-ID: <20080723220230.GP32184@machine.or.cz>
URL: https://gitlist.dev/e/20080723220230.GP32184%40machine.or.cz
In-Reply-To: <7vd4l5jwi4.fsf@gitster.siamese.dyndns.org>

```
On Tue, Jul 22, 2008 at 05:05:07PM -0700, Junio C Hamano wrote:
> Petr Baudis <pasky@suse.cz> writes:
> 
> > The example to remove file using index-filter uses git update-index
> >  --remove where git rm --cached works as well.
> 
> I am not sure "works as well" is a good enough justification to choose a
> Porcelain command over a plumbing command in this particular context.
> After all, filter-branch is a scripting enviornment, isn't it?

But one of the few that are regularly used even by "mere users", who
would be probably put off unnecessarily by using this mysterious command.
(We might also say that I'm testing Dscho's suggestions, though this
patch was of course provoked by a "huh" of a user I was helping.)

> There also is another subtle difference.  "git rm" takes pathspecs while
> "update-index" takes paths.
> 
> So after running one of these commands:
> 
> 	$ git rm --cached 'Makefil?'
> 	$ git update-index --force-remove 'Makefil?'
> 
> output from:
> 
> 	$ git diff --cached --stat
> 
> would be different.

I don't think this is relevant for the example in question. Users are as
likely to be bit by or take advantage of this as by regular git rm
usage.

-- 
				Petr "Pasky" Baudis
As in certain cults it is possible to kill a process if you know
its true name.  -- Ken Thompson and Dennis M. Ritchie

```
