git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/4] contrib/subtree/t: Added tests for .gitsubtree support

From
Paul Campbell <pcampbell@kemitix.net>
Date
Feb 12, 2013, 23:23 UTC
Message-ID
<CALeLG_=v-XwTygQKOD2JDWmbD0oVV=R+HnXi3dBXtXykV0wXKQ@mail.gmail.com>
 55 add: ensure details are added to .gitsubtree
 56 push: check for a SHA1 update line
 57 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
 58 add: ensure stale .gitsubtree entry is replaced
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
 contrib/subtree/t/t7900-subtree.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
diff --git a/contrib/subtree/t/t7900-subtree.sh
b/contrib/subtree/t/t7900-subtree.sh
index bc2eeb0..5ae4584 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -505,4 +505,38 @@ test_expect_success 'verify one file change per commit' '
         ))
 '

+# return to mainline
+cd ../..
+
+# .gitsubtree
+# 55
+test_expect_success 'added repository appears in .gitsubtree' '
+        git subtree add --prefix=copy0 sub1 &&
+        grep "^copy0 \. sub1$" .gitsubtree
+'
+
+# 56
+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 -E "^   [0-9a-f]{7}\.\.[0-9a-f]{7}  [0-9a-f]{40} -> sub1$"
+'
+
+# 57
+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$"
+'
+
+# 58
+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.566.gaa39828
Message 1 of 1 in “contrib/subtree/t: Added tests for .gitsubtree support”
  1. 3/4 contrib/subtree/t: Added tests for .gitsubtree supportPaul Campbell, Feb 12, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.