Re: Using filter-branch to move repo contents in subdirectory
On Thu, Jul 29, 2010 at 14:08, Thomas Rast <trast@student.ethz.ch> wrote:
Show 10 quoted lines
> Adam Mercer wrote:
>> $ git filter-branch --index-filter \
>> 'git ls-files -s | sed "s-\t\"*-&sftlib/-" |
>> GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
>> git update-index --index-info &&
>> mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
>> Rewrite 223651f2ebd5d5d9341bcfc9e7cb6caaa3f4d171 (56/65)Ignoring path
>> 00bootsftlib/
>
> What OS is this?
This was on Mac OS X 10.6. Where sed is BSD sed.
Show 13 quoted lines
> You seem to have a 'sed' version where \t does not
> match the horizontal tab character, or a shell that replaces the '\t'
> inside a double-quoted string with simply 't'.
>
> As a short-term fix, you can try to replace it with $(printf '\t')
> which should always give a tab character. You need to quote the '
> though, so that's
>
> $ git filter-branch --index-filter \
> 'git ls-files -s | sed "s-$(printf '\''\t'\'')\"*-&sftlib/-" |
> GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
> git update-index --index-info &&
> mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Thanks, that did the trick!
Show 9 quoted lines
> As for the actual issue: 'man 1p sed' on my system claims
>
> * The escape sequence '\n' shall match a <newline> embedded in the pat-
> tern space. A literal <newline> shall not be used in the BRE of a con-
> text address or in the substitute function.
>
> but does not mention \t at all, so I guess either that manpage is
> wrong or GNU sed is not POSIX compliant even with --posix (where it
> still treats \t as a tab).
Also using the original command, but specifying GNU sed also does the trick.
Cheers
Adam