git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
	Christopher Tiwald <christiwald@gmail.com>,
	git@vger.kernel.org
Subject: Re: Filter-branch's "move tree to subdirectory" example fails with BSD sed?
Date: Mon, 16 Apr 2012 13:13:07 -0400	[thread overview]
Message-ID: <20120416171307.GA11221@sigill.intra.peff.net> (raw)
In-Reply-To: <7vr4vnwqwo.fsf@alter.siamese.dyndns.org>

On Mon, Apr 16, 2012 at 10:03:03AM -0700, Junio C Hamano wrote:

> >   git filter-branch --index-filter '
> >     git ls-files -sz |
> >     perl -0pe "s{\t}{\tnewsubdir/}" |
> >     git update-index --from-scratch -z --index-info
> >   ' HEAD
> 
> 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

Yeah, I think it does (at least it makes sense to me, and worked on a
simple test case). I think I might use "git read-tree --empty" instead
of "rm", as it is a little more obvious what is going on. But other than
that, it is much more readable.

It is a slight shame not to show an "ls-files | update-index" example,
because that is the most general form. But since this form is quite
often cut-and-paste by people, I think simple is better here. If we want
to show a more complex example, then we should add it separately.

-Peff

      reply	other threads:[~2012-04-16 17:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 16:00 Filter-branch's "move tree to subdirectory" example fails with BSD sed? Christopher Tiwald
2012-04-14 19:25 ` Johannes Sixt
2012-04-16 15:27   ` Jeff King
2012-04-16 16:02     ` [RFC/PATCH 1/2] update-index: add --clear option Jeff King
2012-04-16 21:48       ` Christopher Tiwald
2012-04-17 18:36         ` Christopher Tiwald
2012-04-16 16:03     ` [RFC/PATCH 2/2] docs/filter-branch: clean up newsubdir example Jeff King
2012-04-16 17:03     ` Filter-branch's "move tree to subdirectory" example fails with BSD sed? Junio C Hamano
2012-04-16 17:13       ` Jeff King [this message]

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=20120416171307.GA11221@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=christiwald@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.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 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 NNTP newsgroup(s).