From: "Jean-François Burdet" <jfburdet@revelate.com>
To: git@vger.kernel.org
Subject: Problem using git-filter-branch to move tree when repository name contains space
Date: Fri, 01 Apr 2011 16:30:26 +0200 [thread overview]
Message-ID: <4D95E182.6030903@revelate.com> (raw)
Hi,
I want to move my repository (wich is contained in a directory whose
name's containing a space) root tree to a subdirectory.
I followed what's documented in
http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html ,
using the last example :
git filter-branch --index-filter \
'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
But, look at the following two scenario:
Scenario 1 : Repository have no space in it, everything works fine :
jfburdet@nagios:~$ mkdir gittest
jfburdet@nagios:~$ cd gittest/
jfburdet@nagios:~/gittest$ git init
Initialized empty Git repository in /home/jfburdet/gittest/.git/
jfburdet@nagios:~/gittest$ touch a_file
jfburdet@nagios:~/gittest$ git add .
jfburdet@nagios:~/gittest$ git commit -m "A commit"
[master (root-commit) e6261d5] A commit
Committer: jfburdet <jfburdet@(none)>
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a_file
jfburdet@nagios:~/gittest$ git filter-branch --index-filter \
> 'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
> GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
> git update-index --index-info &&
> mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Rewrite e6261d591357f39e1b4f95c0dfeb7a133e211161 (1/1)
Ref 'refs/heads/master' was rewritten
Scenario 2 : Repository have space in its directory name, making the
command fails
jfburdet@nagios:~$ mkdir "git test"
jfburdet@nagios:~$ cd "git test"
jfburdet@nagios:~/git test$
jfburdet@nagios:~/git test$ git init
Initialized empty Git repository in /home/jfburdet/git test/.git/
jfburdet@nagios:~/git test$ touch a_file
jfburdet@nagios:~/git test$ git add .
jfburdet@nagios:~/git test$ git commit -m "A commit"
[master (root-commit) 3658e30] A commit
Committer: jfburdet <jfburdet@(none)>
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a_file
jfburdet@nagios:~/git test$ git filter-branch --index-filter \
> 'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
> GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
> git update-index --index-info &&
> mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Rewrite 3658e305df3ace21d39bf57dd4e0e5627818dfcc (1/1)mv: target
`test/.git-rewrite/t/../index' is not a directory
index filter failed: git ls-files -s | sed "s- \"*-&newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE
jfburdet@nagios:~/git test$
I tried to tweak the sed expression with no success. Can someone help me
with that ?
Please note that I can't simply rename the directory before firing up
"git filter-branch" because I'm in a process of merging repositories and
their name are mandatory.
Cheers,
Jean-François,
next reply other threads:[~2011-04-01 14:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 14:30 Jean-François Burdet [this message]
2011-04-01 14:41 ` Problem using git-filter-branch to move tree when repository name contains space Jeff King
2011-04-01 14:46 ` [PATCH] docs: fix filter-branch subdir example for exotic repo names Jeff King
2011-04-01 21:49 ` Problem using git-filter-branch to move tree when repository name contains space Jean-François Burdet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D95E182.6030903@revelate.com \
--to=jfburdet@revelate.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.