From: Paul Campbell <pcampbell@kemitix.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Adam Tkac <atkac@redhat.com>,
"David A. Greene" <greened@obbligato.org>,
"Jesper L. Nielsen" <lyager@gmail.com>,
Michael Schubert <mschub@elegosoft.com>,
Techlive Zheng <techlivezheng@gmail.com>
Subject: Re: [PATCH 2/3] contrib/subtree/t: Added tests for .gitsubtree support
Date: Sun, 17 Feb 2013 15:26:30 +0000 [thread overview]
Message-ID: <CALeLG_n-WocsMTvRZHm6v-+wrCNVvCh6O2baVDALSE3JB8ibng@mail.gmail.com> (raw)
In-Reply-To: <20130217113723.GA9882@elie.Belkin>
On Sun, Feb 17, 2013 at 11:37 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Paul Campbell wrote:
>
>> Is there was a better way to verify that the push operation succeeds
>> then grepping for a SHA1?
>
> IIRC then when a push fails, it will exit with nonzero status (so the
> usual &&-chaining would propagate the error).
>
> Alternatively, one can fetch, ls-remote, or enter the target repo and
> use history inspection tools to check that the result is as expected.
>
> Hope that helps,
> Jonathan
Thanks Jonathan.
Here's the updated version of the tests:
contrib/subtree/t/t7900-subtree.sh | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/contrib/subtree/t/t7900-subtree.sh
b/contrib/subtree/t/t7900-subtree.sh
index 80d3399..e7bb911 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -465,4 +465,37 @@ 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") &&
+ git ls-tree refs/heads/sub1 >output &&
+ ! grep "new_file$" output &&
+ git subtree push --prefix=copy0 &&
+ git ls-tree refs/heads/sub1 >output &&
+ grep "new_file$" output
+'
+
+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") &&
+ 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 &&
+ grep "^copy3 . sub1$" .gitsubtree
+'
+
test_done
--
1.8.1.3.605.g02339dd
--
Paul [W] Campbell
next prev parent reply other threads:[~2013-02-17 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2013-02-18 0:35 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALeLG_n-WocsMTvRZHm6v-+wrCNVvCh6O2baVDALSE3JB8ibng@mail.gmail.com \
--to=pcampbell@kemitix.net \
--cc=atkac@redhat.com \
--cc=git@vger.kernel.org \
--cc=greened@obbligato.org \
--cc=jrnieder@gmail.com \
--cc=lyager@gmail.com \
--cc=mschub@elegosoft.com \
--cc=techlivezheng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).