From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: git@vger.kernel.org
Cc: "Roger C. Soares" <rogersoares@intelinet.com.br>,
Dave Watson <dwatson@mimvista.com>,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [EGIT PATCH 2/2] Resort entries in "normal" order before looking for conflicts
Date: Sun, 10 Feb 2008 21:13:49 +0100 [thread overview]
Message-ID: <200802102113.50578.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <200802060150.37222.robin.rosenberg@dewire.com>
>From 39d5e19cd2e16f476501fda71d6551e51225ed2d Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Sun, 10 Feb 2008 20:03:06 +0100
Subject: [PATCH] Extend IndexDiffTest with more tests
In order to fix a bug where everything is marked as modified, or in some cases
not modified the unit tests. The fixes here continue to work, but I want to
emphasize the tests. Comments?
---
.../tst/org/spearce/jgit/lib/IndexDiffTest.java | 67 ++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
One more to come (that fails).
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/IndexDiffTest.java
b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/IndexDiffTest.java
index 629c06c..4692fa2 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/IndexDiffTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/IndexDiffTest.java
@@ -93,4 +93,71 @@ public class IndexDiffTest extends RepositoryTestCase {
assertEquals(0, diff.getMissing().size());
}
+ public void testUnchangedSimple() throws IOException {
+ GitIndex index = new GitIndex(db);
+
+ index.add(trash, writeTrashFile("a.b", "a.b"));
+ index.add(trash, writeTrashFile("a.c", "a.c"));
+ index.add(trash, writeTrashFile("a=c", "a=c"));
+ index.add(trash, writeTrashFile("a=d", "a=d"));
+
+ Tree tree = new Tree(db);
+ // got the hash id'd from the data using echo -n a.b|git hash-object -t blob --stdin
+ tree.addFile("a.b").setId(new ObjectId("f6f28df96c2b40c951164286e08be7c38ec74851"));
+ tree.addFile("a.c").setId(new ObjectId("6bc0e647512d2a0bef4f26111e484dc87df7f5ca"));
+ tree.addFile("a=c").setId(new ObjectId("06022365ddbd7fb126761319633bf73517770714"));
+ tree.addFile("a=d").setId(new ObjectId("fa6414df3da87840700e9eeb7fc261dd77ccd5c2"));
+
+ tree.setId(new ObjectWriter(db).writeTree(tree));
+
+ IndexDiff diff = new IndexDiff(tree, index);
+ diff.diff();
+ assertEquals(0, diff.getChanged().size());
+ assertEquals(0, diff.getAdded().size());
+ assertEquals(0, diff.getRemoved().size());
+ assertEquals(0, diff.getMissing().size());
+ assertEquals(0, diff.getModified().size());
+ }
+
+ /**
+ * This test has both files and directories that involve
+ * the tricky ordering used by Git.
+ *
+ * @throws IOException
+ */
+ public void testUnchangedComplex() throws IOException {
+ GitIndex index = new GitIndex(db);
+
+ index.add(trash, writeTrashFile("a.b", "a.b"));
+ index.add(trash, writeTrashFile("a.c", "a.c"));
+ index.add(trash, writeTrashFile("a/b.b/b", "a/b.b/b"));
+ index.add(trash, writeTrashFile("a/b", "a/b"));
+ index.add(trash, writeTrashFile("a/c", "a/c"));
+ index.add(trash, writeTrashFile("a=c", "a=c"));
+ index.add(trash, writeTrashFile("a=d", "a=d"));
+
+ Tree tree = new Tree(db);
+ // got the hash id'd from the data using echo -n a.b|git hash-object -t blob --stdin
+ tree.addFile("a.b").setId(new ObjectId("f6f28df96c2b40c951164286e08be7c38ec74851"));
+ tree.addFile("a.c").setId(new ObjectId("6bc0e647512d2a0bef4f26111e484dc87df7f5ca"));
+ tree.addFile("a/b.b/b").setId(new ObjectId("8d840bd4e2f3a48ff417c8e927d94996849933fd"));
+ tree.addFile("a/b").setId(new ObjectId("db89c972fc57862eae378f45b74aca228037d415"));
+ tree.addFile("a/c").setId(new ObjectId("52ad142a008aeb39694bafff8e8f1be75ed7f007"));
+ tree.addFile("a=c").setId(new ObjectId("06022365ddbd7fb126761319633bf73517770714"));
+ tree.addFile("a=d").setId(new ObjectId("fa6414df3da87840700e9eeb7fc261dd77ccd5c2"));
+
+ Tree tree3 = (Tree) tree.findTreeMember("a/b.b");
+ tree3.setId(new ObjectWriter(db).writeTree(tree3));
+ Tree tree2 = (Tree) tree.findTreeMember("a");
+ tree2.setId(new ObjectWriter(db).writeTree(tree2));
+ tree.setId(new ObjectWriter(db).writeTree(tree));
+
+ IndexDiff diff = new IndexDiff(tree, index);
+ diff.diff();
+ assertEquals(0, diff.getChanged().size());
+ assertEquals(0, diff.getAdded().size());
+ assertEquals(0, diff.getRemoved().size());
+ assertEquals(0, diff.getMissing().size());
+ assertEquals(0, diff.getModified().size());
+ }
}
--
1.5.4.rc4.25.g81cc
next prev parent reply other threads:[~2008-02-10 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 23:46 [EGIT Patches] Sort order from hell fixes Robin Rosenberg
2008-02-05 23:46 ` [EGIT PATCH 1/2] Fix git sort order compare bug Robin Rosenberg
2008-02-05 23:46 ` [EGIT PATCH 2/2] Resort entries in "normal" order before looking for conflicts Robin Rosenberg
2008-02-06 0:50 ` Robin Rosenberg
2008-02-10 20:13 ` Robin Rosenberg [this message]
2008-02-10 20:18 ` Robin Rosenberg
2008-02-10 21:11 ` David Watson
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=200802102113.50578.robin.rosenberg.lists@dewire.com \
--to=robin.rosenberg.lists@dewire.com \
--cc=dwatson@mimvista.com \
--cc=git@vger.kernel.org \
--cc=rogersoares@intelinet.com.br \
--cc=spearce@spearce.org \
/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).