Re: Filter-branch's "move tree to subdirectory" example fails with BSD sed?

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

 



Jeff King <peff@xxxxxxxx> writes:

> I wish we could also get rid of the temporary index. It exists solely
> for the side effect of removing the existing entries (otherwise, you get
> both "foo" and "newsubdir/foo" in the resulting history). It would be
> nice if there was some flag to update-index to say "before you do
> anything, clear the existing index" (or I guess, "don't bother reading
> the existing index"). And then result could look like:
>
>   git filter-branch --index-filter '
>     git ls-files -sz |
>     perl -0pe "s{\t}{\tnewsubdir/}" |
>     git update-index --from-scratch -z --index-info
>   ' HEAD
>
> which is IMHO much easier to read and understand.

Wouldn't "git read-tree --prefix=newsubdir/" suffice without the pipeline?
I.e.

        git filter-branch --index-filter '
		rm -f "$GIT_INDEX_FILE"
                git read-tree --prefix=newsubdir/ "$GIT_COMMIT"
	' HEAD

--
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]