From: Michael Rappazzo <rappazzo@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, mhagger@alum.mit.edu, peff@peff.net,
dturner@twopensource.com, pclouds@gmail.com,
sunshine@sunshineco.com, Michael Rappazzo <rappazzo@gmail.com>
Subject: [PATCH 5/5] ff-refs: Add tests
Date: Tue, 10 Nov 2015 21:11:25 -0500 [thread overview]
Message-ID: <1447207885-10911-6-git-send-email-rappazzo@gmail.com> (raw)
In-Reply-To: <1447207885-10911-1-git-send-email-rappazzo@gmail.com>
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
---
t/t7900-ff-refs.sh | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 164 insertions(+)
create mode 100755 t/t7900-ff-refs.sh
diff --git a/t/t7900-ff-refs.sh b/t/t7900-ff-refs.sh
new file mode 100755
index 0000000..3cfbcb8
--- /dev/null
+++ b/t/t7900-ff-refs.sh
@@ -0,0 +1,164 @@
+#!/bin/sh
+
+# SKIPPED
+
+test_description='test ff-refs'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit init &&
+ for i in $(test_seq 1 9)
+ do
+ echo "data" >file_$i &&
+ git add file_$i &&
+ git commit -m"Commit $i" &&
+ git branch br_$i
+ done
+'
+
+test_expect_success 'UP-TO-DATE for equal branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git ff-refs >actual &&
+ grep "UP-TO-DATE" actual
+ )
+'
+
+test_expect_success 'UP-TO-DATE for ahead local branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git ff-refs >actual &&
+ echo "data" >file_new &&
+ git add file_new &&
+ git commit -m"Commit new" &&
+ grep "UP-TO-DATE" actual
+ )
+'
+
+test_expect_success 'REMOTE-MISSING by local config change' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git config --replace branch.master.merge refs/heads/nothing &&
+ git ff-refs >actual &&
+ grep "REMOTE-MISSING" actual
+ )
+'
+
+test_expect_success 'NON-FAST-FORWARD for diverged branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ echo "data" >file_new &&
+ git add file_new &&
+ git commit -m"Commit new" &&
+ git ff-refs >actual &&
+ grep "NON-FAST-FORWARD" actual
+ )
+'
+
+test_expect_success 'UPDATED for fast-forwardable branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git ff-refs >actual &&
+ grep "UPDATED" actual
+ )
+'
+
+test_expect_success 'WOULD-UPDATE for dry-run on fast-forwardable branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git ff-refs --dry-run >actual &&
+ grep "WOULD-UPDATE" actual
+ )
+'
+
+test_expect_success 'SKIPPED for skip-worktrees on fast-forwardable branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git ff-refs --skip-worktrees >actual &&
+ grep "SKIPPED" actual
+ )
+'
+
+test_expect_success 'WOULD-SKIP for dry-run, skip-worktrees on fast-forwardable branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git ff-refs --dry-run --skip-worktrees >actual &&
+ grep "WOULD-SKIP" actual
+ )
+'
+
+test_expect_success 'UPDATE for fast-forwardable, not checked-out branch' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git checkout -b other origin/br_3 &&
+ git ff-refs >actual &&
+ grep "master" actual | grep "UPDATED"
+ )
+'
+
+test_expect_success 'UPDATE for fast-forwardable, not checked-out branch using --skip-worktrees' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git checkout -b other origin/br_3 &&
+ git ff-refs --skip-worktrees >actual &&
+ grep "master" actual | grep "UPDATED"
+ )
+'
+
+test_expect_success 'UPDATE multiple' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git checkout -b other origin/br_5 &&
+ git reset --hard origin/br_3 &&
+ git ff-refs >actual &&
+ grep "master" actual | grep "UPDATED" &&
+ grep "other" actual | grep "UPDATED"
+ )
+'
+
+test_expect_success 'UPDATE one, skip worktree on another' '
+ test_when_finished "rm -rf local" &&
+ git clone . local &&
+ (
+ cd local &&
+ git reset --hard origin/br_3 &&
+ git checkout -b other origin/br_5 &&
+ git reset --hard origin/br_3 &&
+ git ff-refs --skip-worktrees >actual &&
+ grep "master" actual | grep "UPDATED" &&
+ grep "other" actual | grep "SKIPPED"
+ )
+'
+
+test_done
--
2.6.2
next prev parent reply other threads:[~2015-11-11 2:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 2:11 [PATCH 0/5] ff-refs: builtin command to fast-forward local refs Michael Rappazzo
2015-11-11 2:11 ` [PATCH 1/5] ff-refs: builtin cmd to check and fast forward local refs to their upstream Michael Rappazzo
2015-11-11 2:11 ` [PATCH 2/5] ff-refs: update each updatable ref Michael Rappazzo
2015-11-11 2:11 ` [PATCH 3/5] ff-refs: add --dry-run and --skip-worktree options Michael Rappazzo
2015-11-11 2:11 ` [PATCH 4/5] ff-refs: Add documentation Michael Rappazzo
2015-11-11 2:11 ` Michael Rappazzo [this message]
2015-11-11 10:41 ` [PATCH 0/5] ff-refs: builtin command to fast-forward local refs Michael J Gruber
2015-11-11 12:32 ` Mike Rappazzo
[not found] ` <CANoM8SWxMeDjwy-GwVc+En8D7N8LyzzsBKtX_MbiS4Z49DjD7g@mail.gmail.com>
2015-11-17 15:28 ` Michael J Gruber
2015-11-17 15:36 ` Mike Rappazzo
2015-11-18 9:56 ` Johannes Schindelin
2015-11-24 22:39 ` Jeff King
2015-12-01 0:24 ` Junio C Hamano
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=1447207885-10911-6-git-send-email-rappazzo@gmail.com \
--to=rappazzo@gmail.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.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).