Re: checkout/update boiler plate for --filter-index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcel Cary schrieb:
> I'm trying to do a historical find-and-replace on my code:
> 
> git grep -F foo > files
> git filter-branch --index-filter "
>   cat `pwd`/files | xargs git checkout  --
>   cat `pwd`/files | xargs sed -i 's/foo/bar/g; '
>   cat `pwd`/files | xargs git update-index --
> " ancestor..HEAD
> 
> When I instead use --tree-filter and skip the checkout/update-index, it
> works how I want (but it takes a while...).  But when I use
> --index-filter, the resulting history shows the "foo" to "bar" change
> happening *after* new code is added, rather than originally adding "bar".
> 
> How can I checkout just a few files and update them to take advantage of
> the speed of index operations?

You cannot do that with the index filter because you need actual blob
contents to operate on, but the index filter doesn't give you an
opportunity to do that. The tree filter is the right filter to use. But
you neither need 'git checkout' nor 'git update-index' in the filter -
filter-branch calls them for you. (Oh, and get rid of that useless use of
cat.)

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux