From: Techlive Zheng <techlivezheng@gmail.com>
To: git@vger.kernel.org
Cc: apenwarr@gmail.com, greened@obbligato.org,
Techlive Zheng <techlivezheng@gmail.com>
Subject: [PATCH/RFC v2 8/8] contrib/subtree: Handle '--prefix' argument with a slash appended
Date: Mon, 14 Jan 2013 11:52:21 +0800 [thread overview]
Message-ID: <1358135541-10349-9-git-send-email-techlivezheng@gmail.com> (raw)
In-Reply-To: <1358135541-10349-1-git-send-email-techlivezheng@gmail.com>
'git subtree merge' will fail if the argument of '--prefix' has a slash
appended.
Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>
---
contrib/subtree/git-subtree.sh | 2 +-
contrib/subtree/t/t7900-subtree.sh | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index d529a76..40100e5 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -83,7 +83,7 @@ while [ $# -gt 0 ]; do
--annotate) annotate="$1"; shift ;;
--no-annotate) annotate= ;;
-b) branch="$1"; shift ;;
- -P) prefix="$1"; shift ;;
+ -P) prefix="${1%/}"; shift ;;
-m) message="$1"; shift ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 232ed89..297dac4 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -238,6 +238,25 @@ test_expect_success 'merge new subproj history into subdir/ with --squash and --
)
'
+test_expect_success 'merge new subproj history into subdir/ with a slash appended to the argument of --prefix' '
+ test_create_repo "$test_count" &&
+ test_create_repo "$test_count/subproj" &&
+ test_create_commit "$test_count" main1 &&
+ test_create_commit "$test_count/subproj" sub1 &&
+ (
+ cd "$test_count" &&
+ git fetch ./subproj master &&
+ git subtree add --prefix=subdir/ FETCH_HEAD
+ ) &&
+ test_create_commit "$test_count/subproj" sub2 &&
+ (
+ cd "$test_count" &&
+ git fetch ./subproj master &&
+ git subtree merge --prefix=subdir/ FETCH_HEAD &&
+ test_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
+ )
+'
+
#
# Tests for 'git subtree split'
#
--
1.8.1
prev parent reply other threads:[~2013-01-14 3:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 1:52 [PATCH/RFC 0/7] mutiple improvements Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 1/7] contrib/subtree: Add vim modeline Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 2/7] contrib/subtree: Ignore testing directory Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 3/7] contrib/subtree: Remove test number comments Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 4/7] contrib/subtree: Code cleaning and refactoring Techlive Zheng
2013-01-14 3:30 ` 郑文辉(Techlive Zheng)
2013-01-13 1:52 ` [PATCH/RFC 5/7] contrib/subtree: Make each test self-contained Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 6/7] contrib/subtree: Use %B for the split commit message Techlive Zheng
2013-01-13 1:52 ` [PATCH/RFC 7/7] contrib/subtree: Handle '--prefix' argument with a slash appended Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 0/8] contrib/subtree: Reroll to follow Git's whitespace policy Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 1/8] contrib/subtree: Fix whitespaces Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 2/8] contrib/subtree: Add vim modeline Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 3/8] contrib/subtree: Ignore testing directory Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 4/8] contrib/subtree: Remove test number comments Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 5/8] contrib/subtree: Code cleaning and refactoring Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 6/8] contrib/subtree: Make each test self-contained Techlive Zheng
2013-01-14 3:52 ` [PATCH/RFC v2 7/8] contrib/subtree: Use %B for the split commit message Techlive Zheng
2013-01-14 3:52 ` Techlive Zheng [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=1358135541-10349-9-git-send-email-techlivezheng@gmail.com \
--to=techlivezheng@gmail.com \
--cc=apenwarr@gmail.com \
--cc=git@vger.kernel.org \
--cc=greened@obbligato.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).