diff --git a/src/applications/differential/__tests__/data/empty.diff b/src/applications/differential/__tests__/data/empty.diff new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/empty.diff @@ -0,0 +1,3 @@ +diff --git a/empty b/empty +new file mode 100644 +index 0000000..e69de29 diff --git a/src/applications/differential/__tests__/data/empty.diff.one.expect b/src/applications/differential/__tests__/data/empty.diff.one.expect new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/empty.diff.one.expect @@ -0,0 +1,5 @@ +CTYPE 1 1 (unforced) +empty +empty +- +SHIELD (none) This is an empty file. diff --git a/src/applications/differential/__tests__/data/empty.diff.two.expect b/src/applications/differential/__tests__/data/empty.diff.two.expect new file mode 100644 --- /dev/null +++ b/src/applications/differential/__tests__/data/empty.diff.two.expect @@ -0,0 +1,5 @@ +CTYPE 1 1 (unforced) +empty +empty +- +SHIELD (none) This is an empty file. diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -850,9 +850,19 @@ // we'll never have it so we need to be prepared to not render a link. $type = 'none'; } - $shield = $renderer->renderShield( - pht('The contents of this file were not changed.'), - $type); + + $type_add = DifferentialChangeType::TYPE_ADD; + if ($this->changeset->getChangeType() == $type_add) { + // Although the generic message is sort of accurate in a technical + // sense, this more-tailored message is less confusing. + $shield = $renderer->renderShield( + pht('This is an empty file.'), + $type); + } else { + $shield = $renderer->renderShield( + pht('The contents of this file were not changed.'), + $type); + } } else if ($this->isWhitespaceOnly()) { $shield = $renderer->renderShield( pht('This file was changed only by adding or removing whitespace.'),