Re: Using filter-branch to move repo contents in subdirectory

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

 



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


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).

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
--
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]