summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 448e71e)
raw | patch | inline | side by side (parent: 448e71e)
author | Pelle Wessman <pelle@kodfabrik.se> | |
Thu, 20 May 2010 20:40:09 +0000 (22:40 +0200) | ||
committer | Pelle Wessman <pelle@kodfabrik.se> | |
Thu, 20 May 2010 20:40:09 +0000 (22:40 +0200) |
A folder in a repository that wasn't initially imported as a subtree could no longer be splitted into an entirely new subtree with no parent.
A fix and a new test to fix that regression is added here.
A fix and a new test to fix that regression is added here.
git-subtree.sh | patch | blob | history | |
test.sh | patch | blob | history |
diff --git a/git-subtree.sh b/git-subtree.sh
index b7c350107e6edc8032eba76d5d74e56628bffd82..a86cfd8b9f8fd9a50e577f0612fea7a7a2b90213 100755 (executable)
--- a/git-subtree.sh
+++ b/git-subtree.sh
if [ -n "$main" -a -n "$sub" ]; then
debug " Prior: $main -> $sub"
cache_set $main $sub
+ cache_set $sub $sub
try_remove_previous "$main"
try_remove_previous "$sub"
fi
# ugly. is there no better way to tell if this is a subtree
# vs. a mainline commit? Does it matter?
if [ -z $tree ]; then
- cache_set $rev $rev
+ if [ -n "$newparents" ]; then
+ cache_set $rev $rev
+ fi
continue
fi
index 8c1f1ea6bdfe6934dfc0e67112dc6a97f82065bc..45237c337492a4deefe918662967faf4add2e9f8 100755 (executable)
--- a/test.sh
+++ b/test.sh
# but it wasn't, because it's cache was not set to itself)
check_equal "$(git log --pretty=format:%P -1 mainsub4)" "$(git rev-parse sub3)"
+mkdir subdir2
+create subdir2/main-sub5
+git commit -m "main-sub5"
+git subtree split --prefix subdir2 --branch mainsub5
+
+# also test that we still can split out an entirely new subtree
+# if the parent of the first commit in the tree isn't empty,
+# then the new subtree has accidently been attached to something
+check_equal "$(git log --pretty=format:%P -1 mainsub5)" ""
# make sure no patch changes more than one file. The original set of commits