From: Thomas Rast <trast@student.ethz.ch>
To: <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>, Adam Mercer <ramercer@gmail.com>
Subject: [PATCH] filter-branch tests/docs: avoid \t in sed regexes
Date: Thu, 29 Jul 2010 15:24:30 +0200 [thread overview]
Message-ID: <0bb511ca2d155ea7e37850a78375da1803032d6c.1280409717.git.trast@student.ethz.ch> (raw)
In-Reply-To: <AANLkTin5sv8NQ_8NZkQpW9HG4zYZDZHNF80EWK8Km4Mr@mail.gmail.com>
Using \t to represent a tab character is not portable beyond GNU sed
(see e.g. GNU sed's info pages). Use printf to generate the tab
instead.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Adam Mercer wrote:
> > What OS is this?
> This was on Mac OS X 10.6. Where sed is BSD sed.
That's very funny however, since it means that nobody should ever have
had a successful test run on OS X with the preinstalled tools. What
gives?
Documentation/git-filter-branch.txt | 3 ++-
t/t7003-filter-branch.sh | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index 020028c..7e3ff8e 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -357,8 +357,9 @@ git filter-branch ... D..H --not C
To move the whole tree into a subdirectory, or remove it from there:
---------------------------------------------------------------
+export TAB="$(printf '\t')"
git filter-branch --index-filter \
- 'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
+ 'git ls-files -s | sed "s-$TAB\"*-&newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 0da13a8..e90da6d 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -140,10 +140,11 @@ test_expect_success 'more setup' '
git merge branch
'
+export TAB="$(printf '\t')"
test_expect_success 'use index-filter to move into a subdirectory' '
git branch directorymoved &&
git filter-branch -f --index-filter \
- "git ls-files -s | sed \"s-\\t-&newsubdir/-\" |
+ "git ls-files -s | sed \"s-$TAB-&newsubdir/-\" |
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
--
1.7.2.1.342.g676a4
next prev parent reply other threads:[~2010-07-29 13:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-29 12:37 Using filter-branch to move repo contents in subdirectory Adam Mercer
2010-07-29 13:08 ` Thomas Rast
2010-07-29 13:15 ` Adam Mercer
2010-07-29 13:24 ` Thomas Rast [this message]
2010-07-29 14:47 ` [PATCH] filter-branch tests/docs: avoid \t in sed regexes Tomas Carnecky
2010-07-29 14:52 ` Thomas Rast
2010-07-29 15:02 ` Tomas Carnecky
2010-07-29 15:10 ` [PATCH] t7005: fix subdirectory-filter test Thomas Rast
2010-07-29 15:12 ` Thomas Rast
2010-08-09 19:36 ` Using filter-branch to move repo contents in subdirectory Adam Mercer
2010-08-11 15:01 ` Adam Mercer
2010-08-11 19:32 ` Jeff King
2010-08-11 19:59 ` Adam Mercer
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=0bb511ca2d155ea7e37850a78375da1803032d6c.1280409717.git.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ramercer@gmail.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.
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).