if ($type == ArcanistDiffChangeType::TYPE_COPY_HERE ||
$type == ArcanistDiffChangeType::TYPE_MOVE_HERE ||
- $type == ArcanistDiffChangeType::TYPE_COPY_AWAY) {
+ $type == ArcanistDiffChangeType::TYPE_COPY_AWAY ||
+ $type == ArcanistDiffChangeType::TYPE_CHANGE) {
if ($old_mode !== $new_mode) {
$result[] = "old mode {$old_mode}".PHP_EOL;
$result[] = "new mode {$new_mode}".PHP_EOL;
//
// ...i.e., there is no associated diff.
- $change->setNeedsSyntheticGitHunks(true);
- if ($move_source) {
- $move_source->setNeedsSyntheticGitHunks(true);
+ // This allows us to distinguish between property changes only
+ // and actual moves. For property changes only, we can't currently
+ // build a synthetic diff correctly, so just skip it.
+ // TODO: Build synthetic diffs for property changes, too.
+ if ($change->getType() != ArcanistDiffChangeType::TYPE_CHANGE) {
+ $change->setNeedsSyntheticGitHunks(true);
+ if ($move_source) {
+ $move_source->setNeedsSyntheticGitHunks(true);
+ }
}
return;
}
}
switch ($commit) {
+ case '1830a13adf764b55743f7edc6066451898d8ffa4':
+ // "Mark koan2 as +x and edit it."
+
+ $this->assertEqual(1, count($changes));
+
+ $c = $changes['koan2'];
+ $this->assertEqual(
+ ArcanistDiffChangeType::TYPE_CHANGE,
+ $c->getType());
+
+ $this->assertEqual(
+ '100644',
+ idx($c->getOldProperties(), 'unix:filemode'));
+
+ $this->assertEqual(
+ '100755',
+ idx($c->getNewProperties(), 'unix:filemode'));
+ break;
+ case '8ecc728bcc9b482a9a91527ea471b04fc1a025cf':
+ // "Move 'text' to 'executable' and mark it +x."
+
+ $this->assertEqual(2, count($changes));
+
+ $c = $changes['executable'];
+ $this->assertEqual(
+ ArcanistDiffChangeType::TYPE_MOVE_HERE,
+ $c->getType());
+
+ $this->assertEqual(
+ '100644',
+ idx($c->getOldProperties(), 'unix:filemode'));
+
+ $this->assertEqual(
+ '100755',
+ idx($c->getNewProperties(), 'unix:filemode'));
+ break;
+ case '39c8e7dd3914edff087a6214f0cd996ad08e5b3d':
+ // "Mark koan as +x."
+ // Primarily a test against a recusive synthetic hunk construction bug.
+ $this->assertEqual(1, count($changes));
+
+ $c = $changes['koan'];
+ $this->assertEqual(
+ ArcanistDiffChangeType::TYPE_CHANGE,
+ $c->getType());
+
+ $this->assertEqual(
+ '100644',
+ idx($c->getOldProperties(), 'unix:filemode'));
+
+ $this->assertEqual(
+ '100755',
+ idx($c->getNewProperties(), 'unix:filemode'));
+ break;
case 'c573c25d1a767d270fed504cd993e78aba936338':
// "Copy a koan over text, editing the original koan."
// Git doesn't really do anything meaningful with this.