Created
May 7, 2013 02:10
-
-
Save vi/5529807 to your computer and use it in GitHub Desktop.
--graft-parent option for `subtree split` contrib script (based on v1.8.3-rc1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From a0256e3220f90ab74d53680bff87067a8f544ec5 Mon Sep 17 00:00:00 2001 | |
From: Vitaly _Vi Shukela <vi0oss@gmail.com> | |
Date: Tue, 7 May 2013 05:07:08 +0300 | |
Subject: [PATCH] contrib/subtree: Implement --graft-parent option | |
--- | |
contrib/subtree/git-subtree.sh | 9 +++++++++ | |
1 file changed, 9 insertions(+) | |
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh | |
index 8a23f58..0cc0f38 100755 | |
--- a/contrib/subtree/git-subtree.sh | |
+++ b/contrib/subtree/git-subtree.sh | |
@@ -23,6 +23,7 @@ m,message= use the given message as the commit message for the merge commit | |
options for 'split' | |
annotate= add a prefix to commit message of new commits | |
b,branch= create a new branch from the split subtree | |
+graft-parent= graft parent (for 'split') | |
ignore-joins ignore prior --rejoin commits | |
onto= try connecting new tree to an existing one | |
rejoin merge the new branch back into HEAD | |
@@ -46,6 +47,7 @@ ignore_joins= | |
annotate= | |
squash= | |
message= | |
+graft_parent= | |
debug() | |
{ | |
@@ -93,6 +95,7 @@ while [ $# -gt 0 ]; do | |
--no-ignore-joins) ignore_joins= ;; | |
--squash) squash=1 ;; | |
--no-squash) squash= ;; | |
+ --graft-parent) graft_parent="$1"; shift ;; | |
--) break ;; | |
*) die "Unexpected option: $opt" ;; | |
esac | |
@@ -602,6 +605,12 @@ cmd_split() | |
createcount=$(($createcount + 1)) | |
debug " parents: $parents" | |
newparents=$(cache_get $parents) | |
+ if [ -n "$graft_parent" ]; then | |
+ if [ -z "$newparents" ]; then | |
+ say "Grafting $graft_parent" | |
+ newparents="$graft_parent" | |
+ fi | |
+ fi | |
debug " newparents: $newparents" | |
tree=$(subtree_for_commit $rev "$dir") | |
-- | |
1.7.11.6.1.gada05e2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment