git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Jon Smirl <jonsmirl@gmail.com>
Cc: git@vger.kernel.org, Catalin Marinas <catalin.marinas@gmail.com>
Subject: [StGit PATCH] Add some tests of refreshing removed files
Date: Mon, 04 Aug 2008 15:41:48 +0200	[thread overview]
Message-ID: <20080804134050.19457.96613.stgit@yoghurt> (raw)
In-Reply-To: <9e4733910807311902nd3a02bep68c8a26a7e6303cd@mail.gmail.com>

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

These four tests all pass on Catalin's current master. Do they fail
for you, or did I miss something in your problem description?

 t/t2702-refresh-rm.sh |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100755 t/t2702-refresh-rm.sh


diff --git a/t/t2702-refresh-rm.sh b/t/t2702-refresh-rm.sh
new file mode 100755
index 0000000..896ebf3
--- /dev/null
+++ b/t/t2702-refresh-rm.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+test_description='"stg refresh" with removed files'
+
+. ./test-lib.sh
+
+# Ignore our own temp files.
+cat >> .git/info/exclude <<EOF
+expected*.txt
+files*.txt
+status*.txt
+EOF
+
+reset () {
+    stg pop -a > /dev/null
+    git reset --hard > /dev/null
+}
+
+test_expect_success 'Initialize StGit stack' '
+    stg init &&
+    echo x > x.txt &&
+    echo y > y.txt &&
+    git add x.txt y.txt &&
+    git commit -m "Add some files"
+'
+
+cat > expected0.txt <<EOF
+D y.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'git-rm a file' '
+    stg new -m p0 &&
+    git rm y.txt &&
+    stg status > status0.txt &&
+    test_cmp expected0.txt status0.txt &&
+    stg refresh &&
+    stg status > status1.txt &&
+    test_cmp expected1.txt status1.txt &&
+    stg files | sort > files.txt &&
+    test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+M x.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'git-rm a file together with other changes' '
+    stg new -m p1 &&
+    echo x2 >> x.txt &&
+    git rm y.txt &&
+    stg status > status0.txt &&
+    test_cmp expected0.txt status0.txt &&
+    stg refresh &&
+    stg status > status1.txt &&
+    test_cmp expected1.txt status1.txt &&
+    stg files | sort > files.txt &&
+    test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'rm a file' '
+    stg new -m p2 &&
+    rm y.txt &&
+    stg status > status0.txt &&
+    test_cmp expected0.txt status0.txt &&
+    stg refresh &&
+    stg status > status1.txt &&
+    test_cmp expected1.txt status1.txt &&
+    stg files | sort > files.txt &&
+    test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+M x.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'rm a file together with other changes' '
+    stg new -m p3 &&
+    echo x2 >> x.txt &&
+    rm y.txt &&
+    stg status > status0.txt &&
+    test_cmp expected0.txt status0.txt &&
+    stg refresh &&
+    stg status > status1.txt &&
+    test_cmp expected1.txt status1.txt &&
+    stg files | sort > files.txt &&
+    test_cmp expected0.txt files.txt
+'
+
+test_done

  reply	other threads:[~2008-08-04 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01  2:02 stgit and rm a file Jon Smirl
2008-08-04 13:41 ` Karl Hasselström [this message]
2008-08-04 14:07   ` [StGit PATCH] Add some tests of refreshing removed files Jon Smirl
2008-08-04 14:08     ` Jon Smirl
2008-08-04 14:43     ` Karl Hasselström

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=20080804134050.19457.96613.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@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).