git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] contrib/subtree/t: Added tests for .gitsubtree support
@ 2013-02-15 22:50 Paul Campbell
  2013-02-15 22:56 ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Campbell @ 2013-02-15 22:50 UTC (permalink / raw)
  To: git
  Cc: Adam Tkac, David A. Greene, Jesper L. Nielsen, Michael Schubert,
	Techlive Zheng

add: ensure details are added to .gitsubtree
push: check for a SHA1 update line
pull: add a file on one subtree, push it to a branch, then pull into
    another subtree containing the same branch and confirm the files match
add: ensure stale .gitsubtree entry is replaced

Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
 contrib/subtree/t/t7900-subtree.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/contrib/subtree/t/t7900-subtree.sh
b/contrib/subtree/t/t7900-subtree.sh
index 80d3399..4437dc6 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -465,4 +465,34 @@ test_expect_success 'verify one file change per commit' '
         ))
 '

+# return to mainline
+cd ../..
+
+# .gitsubtree
+test_expect_success 'added repository appears in .gitsubtree' '
+        git subtree add --prefix=copy0 sub1 &&
+        grep "^copy0 \. sub1$" .gitsubtree
+'
+
+test_expect_success 'change in subtree is pushed okay' '
+        cd copy0 && create new_file && git commit -m"Added new_file" &&
+        cd .. && git subtree push --prefix=copy0 2>&1 | \
+                grep
"^\s\{3\}[0-9a-f]\{7\}\.\.[0-9a-f]\{7\}\s\s[0-9a-f]\{40\}\s->\ssub1$"
+'
+
+test_expect_success 'pull into subtree okay' '
+        git subtree add --prefix=copy1 sub1 &&
+        git subtree add --prefix=copy2 sub1 &&
+        cd copy1 && create new_file_in_copy1 && git commit -m"Added
new_file_in_copy1" &&
+        cd .. && git subtree push --prefix=copy1 &&
+        git subtree pull --prefix=copy2 | grep "^ create mode 100644
copy2/new_file_in_copy1$"
+'
+
+test_expect_success 'replace outdated entry in .gitsubtree' '
+        echo "copy3 . sub2" >> .gitsubtree &&
+        git subtree add --prefix=copy3 sub1 &&
+        (grep "^copy3 . sub2$" .gitsubtree && die || true) &&
+        grep "^copy3 . sub1$" .gitsubtree
+'
+
 test_done
-- 
1.8.1.3.605.g02339dd

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-18  0:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-15 22:50 [PATCH 2/3] contrib/subtree/t: Added tests for .gitsubtree support Paul Campbell
2013-02-15 22:56 ` Jonathan Nieder
2013-02-15 23:16   ` Paul Campbell
2013-02-17 11:37     ` Jonathan Nieder
2013-02-17 15:26       ` Paul Campbell
2013-02-18  0:35         ` Jonathan Nieder

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).