Skip to content

Commit a67c256

Browse files
committed
subtree: add git subtree map command
Adds an entry to the subtree cache so that subsequent split runs can skip any commits that turn out to be problematic. Signed-off-by: Tom Clarkson <[email protected]>
1 parent c892ee9 commit a67c256

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ git subtree merge --prefix=<prefix> <commit>
1515
git subtree pull --prefix=<prefix> <repository> <ref>
1616
git subtree push --prefix=<prefix> <repository> <ref>
1717
git subtree split --prefix=<prefix> <commit>
18+
git subtree map --prefix=<prefix> <mainline> <subtree>
1819
--
1920
h,help show the help
2021
q quiet
@@ -161,7 +162,7 @@ command="$1"
161162
shift
162163

163164
case "$command" in
164-
add|merge|pull)
165+
add|merge|pull|map)
165166
default=
166167
;;
167168
split|push)
@@ -192,7 +193,8 @@ dir="$(dirname "$prefix/.")"
192193

193194
if test "$command" != "pull" &&
194195
test "$command" != "add" &&
195-
test "$command" != "push"
196+
test "$command" != "push" &&
197+
test "$command" != "map"
196198
then
197199
revs=$(git rev-parse $default --revs-only "$@") || exit $?
198200
dirs=$(git rev-parse --no-revs --no-flags "$@") || exit $?
@@ -795,6 +797,21 @@ cmd_add_commit () {
795797
say "Added dir '$dir'"
796798
}
797799

800+
cmd_map () {
801+
oldrev="$1"
802+
newrev="$2"
803+
804+
if test -z "$oldrev"
805+
then
806+
die "You must provide a revision to map"
807+
fi
808+
809+
cache_setup || exit $?
810+
cache_set "$oldrev" "$newrev"
811+
812+
say "Mapped $oldrev => $newrev"
813+
}
814+
798815
cmd_split () {
799816
debug "Splitting $dir..."
800817
cache_setup || exit $?

0 commit comments

Comments
 (0)