diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php index dbb9daf0..a6837483 100644 --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -146,6 +146,154 @@ final class ArcanistBundleTestCase extends ArcanistTestCase { } switch ($commit) { + case 'c573c25d1a767d270fed504cd993e78aba936338': + // "Copy a koan over text, editing the original koan." + // Git doesn't really do anything meaningful with this. + + $this->assertEqual(2, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_CHANGE, + $c->getType()); + + $c = $changes['text']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_CHANGE, + $c->getType()); + + break; + case 'd26628e588cf7d16368845b121c6ac6c781e81d0': + // "Copy a koan, modifying both the source and destination." + + $this->assertEqual(2, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_COPY_AWAY, + $c->getType()); + + $c = $changes['koan2']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_COPY_HERE, + $c->getType()); + + break; + case 'b0c9663ecda5f666f62dad245a3a7549aac5e636': + // "Remove a koan copy." + + $this->assertEqual(1, count($changes)); + + $c = $changes['koan2']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_DELETE, + $c->getType()); + + break; + case 'b6ecdb3b4801f3028d88ba49940a558360847dbf': + // "Copy a koan and edit the destination." + // Git does not detect this as a copy without --find-copies-harder. + + $this->assertEqual(1, count($changes)); + + $c = $changes['koan2']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_ADD, + $c->getType()); + + break; + case '30d23787e1ecd254c884afbe37afa612f61e3904': + // "Move and edit a koan." + + $this->assertEqual(2, count($changes)); + + $c = $changes['koan2']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MOVE_AWAY, + $c->getType()); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MOVE_HERE, + $c->getType()); + + break; + case 'c0ba9bfe3695f95c3f558bc5797eeba421d32483': + // "Remove two koans." + + $this->assertEqual(2, count($changes)); + + $c = $changes['koan3']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_DELETE, + $c->getType()); + + $c = $changes['koan4']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_DELETE, + $c->getType()); + + break; + case '2658fd01d5355abe5d4c7ead3a0e7b4b3449fe77': + // "Multicopy a koan." + + $this->assertEqual(3, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MULTICOPY, + $c->getType()); + + $c = $changes['koan3']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_COPY_HERE, + $c->getType()); + + $c = $changes['koan4']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MOVE_HERE, + $c->getType()); + + break; + case '1c5fe4e2243bb19d6b3bf15896177b13768e6eb6': + // "Copy a koan." + // Git does not detect this as a copy without --find-copies-harder. + + $this->assertEqual(1, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_ADD, + $c->getType()); + + break; + case '6d9eb65a2c2b56dee64d72f59554c1cca748dd34': + // "Move a koan." + + $this->assertEqual(2, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MOVE_AWAY, + $c->getType()); + + $c = $changes['koan2']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_MOVE_HERE, + $c->getType()); + + break; + case '141452e2a775ee86409e8779dd2eda767b4fe8ab': + // "Add a koan." + + $this->assertEqual(1, count($changes)); + + $c = $changes['koan']; + $this->assertEqual( + ArcanistDiffChangeType::TYPE_ADD, + $c->getType()); + + break; case '5dec8bf28557f078d1987c4e8cfb53d08310f522': // "Copy an image, and replace the original." // `image_2.png` is copied to `image.png` and then replaced. diff --git a/src/parser/__tests__/bundle.git.tgz b/src/parser/__tests__/bundle.git.tgz index 99178e93..9ad428c6 100644 Binary files a/src/parser/__tests__/bundle.git.tgz and b/src/parser/__tests__/bundle.git.tgz differ diff --git a/src/parser/__tests__/patches/141452e2a775ee86409e8779dd2eda767b4fe8ab.gitpatch b/src/parser/__tests__/patches/141452e2a775ee86409e8779dd2eda767b4fe8ab.gitpatch new file mode 100644 index 00000000..ca108c1f --- /dev/null +++ b/src/parser/__tests__/patches/141452e2a775ee86409e8779dd2eda767b4fe8ab.gitpatch @@ -0,0 +1,18 @@ +diff --git a/koan b/koan +new file mode 100644 +--- /dev/null ++++ b/koan +@@ -0,0 +1,12 @@ ++A monk asked Joshu, ++"Has a dog Buddha nature?" ++Joshu replied, "Mu". ++ ++The quick brown ++fox jumped over ++the lazy dog. ++ ++Git only detects changes ++as moves if both files ++are mostly similar. So ++you need a lot of text. + diff --git a/src/parser/__tests__/patches/1c5fe4e2243bb19d6b3bf15896177b13768e6eb6.gitpatch b/src/parser/__tests__/patches/1c5fe4e2243bb19d6b3bf15896177b13768e6eb6.gitpatch new file mode 100644 index 00000000..ca108c1f --- /dev/null +++ b/src/parser/__tests__/patches/1c5fe4e2243bb19d6b3bf15896177b13768e6eb6.gitpatch @@ -0,0 +1,18 @@ +diff --git a/koan b/koan +new file mode 100644 +--- /dev/null ++++ b/koan +@@ -0,0 +1,12 @@ ++A monk asked Joshu, ++"Has a dog Buddha nature?" ++Joshu replied, "Mu". ++ ++The quick brown ++fox jumped over ++the lazy dog. ++ ++Git only detects changes ++as moves if both files ++are mostly similar. So ++you need a lot of text. + diff --git a/src/parser/__tests__/patches/2658fd01d5355abe5d4c7ead3a0e7b4b3449fe77.gitpatch b/src/parser/__tests__/patches/2658fd01d5355abe5d4c7ead3a0e7b4b3449fe77.gitpatch new file mode 100644 index 00000000..b8295313 --- /dev/null +++ b/src/parser/__tests__/patches/2658fd01d5355abe5d4c7ead3a0e7b4b3449fe77.gitpatch @@ -0,0 +1,7 @@ +diff --git a/koan b/koan3 +rename from koan +rename to koan3 +diff --git a/koan b/koan4 +rename from koan +rename to koan4 + diff --git a/src/parser/__tests__/patches/30d23787e1ecd254c884afbe37afa612f61e3904.gitpatch b/src/parser/__tests__/patches/30d23787e1ecd254c884afbe37afa612f61e3904.gitpatch new file mode 100644 index 00000000..34a4e542 --- /dev/null +++ b/src/parser/__tests__/patches/30d23787e1ecd254c884afbe37afa612f61e3904.gitpatch @@ -0,0 +1,14 @@ +diff --git a/koan2 b/koan +rename from koan2 +rename to koan +--- a/koan2 ++++ b/koan +@@ -1,6 +1,6 @@ + A monk asked Joshu, + "Has a dog Buddha nature?" +-Joshu replied, "Mu". ++Joshu replied, "No". + + The quick brown + fox jumped over + diff --git a/src/parser/__tests__/patches/6d9eb65a2c2b56dee64d72f59554c1cca748dd34.gitpatch b/src/parser/__tests__/patches/6d9eb65a2c2b56dee64d72f59554c1cca748dd34.gitpatch new file mode 100644 index 00000000..a9519245 --- /dev/null +++ b/src/parser/__tests__/patches/6d9eb65a2c2b56dee64d72f59554c1cca748dd34.gitpatch @@ -0,0 +1,4 @@ +diff --git a/koan b/koan2 +rename from koan +rename to koan2 + diff --git a/src/parser/__tests__/patches/b0c9663ecda5f666f62dad245a3a7549aac5e636.gitpatch b/src/parser/__tests__/patches/b0c9663ecda5f666f62dad245a3a7549aac5e636.gitpatch new file mode 100644 index 00000000..db11d5df --- /dev/null +++ b/src/parser/__tests__/patches/b0c9663ecda5f666f62dad245a3a7549aac5e636.gitpatch @@ -0,0 +1,18 @@ +diff --git a/koan2 b/koan2 +deleted file mode 100644 +--- a/koan2 ++++ /dev/null +@@ -1,12 +0,0 @@ +-A monk asked Joshu, +-"Has a dog Buddha nature?" +-Joshu replied, "Yes". +- +-The quick brown +-fox jumped over +-the lazy dog. +- +-Git only detects changes +-as moves if both files +-are mostly similar. So +-you need a lot of text. + diff --git a/src/parser/__tests__/patches/b6ecdb3b4801f3028d88ba49940a558360847dbf.gitpatch b/src/parser/__tests__/patches/b6ecdb3b4801f3028d88ba49940a558360847dbf.gitpatch new file mode 100644 index 00000000..5c758913 --- /dev/null +++ b/src/parser/__tests__/patches/b6ecdb3b4801f3028d88ba49940a558360847dbf.gitpatch @@ -0,0 +1,18 @@ +diff --git a/koan2 b/koan2 +new file mode 100644 +--- /dev/null ++++ b/koan2 +@@ -0,0 +1,12 @@ ++A monk asked Joshu, ++"Has a dog Buddha nature?" ++Joshu replied, "Yes". ++ ++The quick brown ++fox jumped over ++the lazy dog. ++ ++Git only detects changes ++as moves if both files ++are mostly similar. So ++you need a lot of text. + diff --git a/src/parser/__tests__/patches/c0ba9bfe3695f95c3f558bc5797eeba421d32483.gitpatch b/src/parser/__tests__/patches/c0ba9bfe3695f95c3f558bc5797eeba421d32483.gitpatch new file mode 100644 index 00000000..e189ef08 --- /dev/null +++ b/src/parser/__tests__/patches/c0ba9bfe3695f95c3f558bc5797eeba421d32483.gitpatch @@ -0,0 +1,35 @@ +diff --git a/koan3 b/koan3 +deleted file mode 100644 +--- a/koan3 ++++ /dev/null +@@ -1,12 +0,0 @@ +-A monk asked Joshu, +-"Has a dog Buddha nature?" +-Joshu replied, "Mu". +- +-The quick brown +-fox jumped over +-the lazy dog. +- +-Git only detects changes +-as moves if both files +-are mostly similar. So +-you need a lot of text. +diff --git a/koan4 b/koan4 +deleted file mode 100644 +--- a/koan4 ++++ /dev/null +@@ -1,12 +0,0 @@ +-A monk asked Joshu, +-"Has a dog Buddha nature?" +-Joshu replied, "Mu". +- +-The quick brown +-fox jumped over +-the lazy dog. +- +-Git only detects changes +-as moves if both files +-are mostly similar. So +-you need a lot of text. + diff --git a/src/parser/__tests__/patches/c573c25d1a767d270fed504cd993e78aba936338.gitpatch b/src/parser/__tests__/patches/c573c25d1a767d270fed504cd993e78aba936338.gitpatch new file mode 100644 index 00000000..e517edda --- /dev/null +++ b/src/parser/__tests__/patches/c573c25d1a767d270fed504cd993e78aba936338.gitpatch @@ -0,0 +1,31 @@ +diff --git a/koan b/koan +--- a/koan ++++ b/koan +@@ -1,6 +1,6 @@ + A monk asked Joshu, + "Has a dog Buddha nature?" +-Joshu replied, "What?". ++Joshu replied, "Hmm?". + + The quick brown + fox jumped over +diff --git a/text b/text +--- a/text ++++ b/text +@@ -1,3 +1,12 @@ +-quack quack +-I am a duck +-quack quack ++A monk asked Joshu, ++"Has a dog Buddha nature?" ++Joshu replied, "What?". ++ ++The quick brown ++fox jumped over ++the lazy dog. ++ ++Git only detects changes ++as moves if both files ++are mostly similar. So ++you need a lot of text. + diff --git a/src/parser/__tests__/patches/d26628e588cf7d16368845b121c6ac6c781e81d0.gitpatch b/src/parser/__tests__/patches/d26628e588cf7d16368845b121c6ac6c781e81d0.gitpatch new file mode 100644 index 00000000..7adb8b18 --- /dev/null +++ b/src/parser/__tests__/patches/d26628e588cf7d16368845b121c6ac6c781e81d0.gitpatch @@ -0,0 +1,25 @@ +diff --git a/koan b/koan +--- a/koan ++++ b/koan +@@ -1,6 +1,6 @@ + A monk asked Joshu, + "Has a dog Buddha nature?" +-Joshu replied, "No". ++Joshu replied, "What?". + + The quick brown + fox jumped over +diff --git a/koan b/koan2 +copy from koan +copy to koan2 +--- a/koan ++++ b/koan2 +@@ -1,6 +1,6 @@ + A monk asked Joshu, + "Has a dog Buddha nature?" +-Joshu replied, "No". ++Joshu replied, "Unask the question!". + + The quick brown + fox jumped over +