Merge branch 'rs/add-dry-run-without-objects'

Stop "git add --dry-run" from creating new blob and tree objects.

* rs/add-dry-run-without-objects:
  add: don't write objects with --dry-run
This commit is contained in:
Junio C Hamano
2021-10-25 16:06:57 -07:00
2 changed files with 4 additions and 1 deletions

View File

@ -129,12 +129,15 @@ test_expect_success 'add -n -u should not add but just report' '
echo "remove '\''top'\''"
) >expect &&
before=$(git ls-files -s check top) &&
git count-objects -v >objects_before &&
echo changed >>check &&
rm -f top &&
git add -n -u >actual &&
after=$(git ls-files -s check top) &&
git count-objects -v >objects_after &&
test "$before" = "$after" &&
test_cmp objects_before objects_after &&
test_cmp expect actual
'