All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christopher Tiwald <christiwald@gmail.com>
To: git@vger.kernel.org
Subject: Filter-branch's "move tree to subdirectory" example fails with BSD sed?
Date: Sat, 14 Apr 2012 12:00:28 -0400	[thread overview]
Message-ID: <20120414160028.GD1012@gmail.com> (raw)

The "Move tree to subdirectory" example in the 'git filter-branch'
manpage fails on Mac OSX 10.7.3, but succeeds on Ubuntu 10.04. I'm
using git version 1.7.0.4, which happened to be the version installed
on the Ubuntu VM I had laying around. I think it's a difference between
'sed' on the two systems.

The 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

Demonstrating the problem is with sed:
git init "test"
cd "test"
mkdir -p subdirA/subdirB
echo content > subdirA/subdirB/file
git add .
git commit -m "initial commit"
git ls-files -s | sed "s-\t\"*-&newsubdir/-"

On Mac 10.7.3 the final command outputs:
100644 d95f3ad14dee633a758d2e331151e950dd13e4ed 0	subdirA/subdirB/file

On Ubuntu 10.04:
100644 d95f3ad14dee633a758d2e331151e950dd13e4ed 0	newsubdir/subdirA/subdirB/file

I can solve my immediate problem using Ubuntu, but is there a way we
could rewrite the example to work on both systems? I'm afraid differences
between BSD and GNU 'sed' are a bit beyond me.

--
Christopher Tiwald

             reply	other threads:[~2012-04-14 16:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 16:00 Christopher Tiwald [this message]
2012-04-14 19:25 ` Filter-branch's "move tree to subdirectory" example fails with BSD sed? 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

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=20120414160028.GD1012@gmail.com \
    --to=christiwald@gmail.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.