git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Jean-François Burdet" <jfburdet@revelate.com>
Cc: git@vger.kernel.org
Subject: Re: Problem using git-filter-branch to move tree when repository name contains space
Date: Fri, 1 Apr 2011 10:41:07 -0400	[thread overview]
Message-ID: <20110401144107.GA3103@sigill.intra.peff.net> (raw)
In-Reply-To: <4D95E182.6030903@revelate.com>

On Fri, Apr 01, 2011 at 04:30:26PM +0200, Jean-François Burdet wrote:

> 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 :
> 
> [...]
>
> 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

The problem is that GIT_INDEX_FILE is an absolute path that contains the
repo name. So it needs to be quoted in the mv command. This should work:

  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

-Peff

  reply	other threads:[~2011-04-01 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 14:30 Problem using git-filter-branch to move tree when repository name contains space Jean-François Burdet
2011-04-01 14:41 ` Jeff King [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110401144107.GA3103@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jfburdet@revelate.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).