git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>, git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] filter-branch: add example to move everything into a subdirectory
Date: Thu, 21 Jun 2007 18:05:30 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0706211805010.4059@racer.site> (raw)


This is based on Jeff King's example in

	20070621130137.GB4487@coredump.intra.peff.net

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-filter-branch.sh     |    8 ++++++++
 t/t7003-filter-branch.sh |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ffb31d6..297e09e 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -181,6 +181,14 @@
 #
 #	git-filter-branch ... new-H C..H --not D
 #	git-filter-branch ... new-H D..H --not C
+#
+# To move the whole tree into a subdirectory, or remove it from there:
+#
+# 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' directorymoved
 
 # Testsuite: TODO
 
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 0fabe49..f00c262 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -99,4 +99,12 @@ test_expect_success 'subdirectory filter result looks okay' '
 	! git show sub:subdir
 '
 
+test_expect_success 'use index-filter to move into a subdirectory' '
+	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" directorymoved &&
+	test -z "$(git diff HEAD directorymoved:newsubdir)"'
+
 test_done
-- 
1.5.2.2.2822.g027a6-dirty

             reply	other threads:[~2007-06-21 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-21 17:05 Johannes Schindelin [this message]
2007-06-23  6:22 ` [PATCH] filter-branch: add example to move everything into a subdirectory Junio C Hamano
2007-06-23 11:03   ` Johannes Schindelin

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=Pine.LNX.4.64.0706211805010.4059@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).