core: diff: Correctly handle files changing type

This commit is contained in:
Colin Walters 2011-11-16 23:09:32 -05:00
parent e759c1cce5
commit 4a26be1bef
2 changed files with 14 additions and 2 deletions

View File

@ -2072,7 +2072,10 @@ diff_dirs (GFile *a,
child_b_type = g_file_info_get_file_type (child_b_info); child_b_type = g_file_info_get_file_type (child_b_info);
if (child_a_type != child_b_type) if (child_a_type != child_b_type)
{ {
g_ptr_array_add (modified, g_object_ref (child_a)); OstreeRepoDiffItem *diff_item = diff_item_new (child_a, child_a_info,
child_b, child_b_info, NULL, NULL);
g_ptr_array_add (modified, diff_item);
} }
else else
{ {

View File

@ -19,7 +19,7 @@
set -e set -e
echo "1..14" echo "1..15"
. libtest.sh . libtest.sh
@ -110,6 +110,15 @@ cd ${test_tmpdir}
assert_file_has_content diff-test2-2 'A */oh-look-a-file$' assert_file_has_content diff-test2-2 'A */oh-look-a-file$'
echo "ok diff cwd" echo "ok diff cwd"
cd ${test_tmpdir}/checkout-test2-4
rm four
mkdir four
touch four/other
$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
cd ${test_tmpdir}
assert_file_has_content diff-test2-2 'M */four$'
echo "ok diff file changing type"
cd ${test_tmpdir}/checkout-test2-4 cd ${test_tmpdir}/checkout-test2-4
echo afile > oh-look-a-file echo afile > oh-look-a-file
cat > ${test_tmpdir}/ostree-commit-metadata <<EOF cat > ${test_tmpdir}/ostree-commit-metadata <<EOF