core: Add API (and standard concept for) content checksum
There are a few cases for knowing whether a commit has identical content to another commit. Some people want to do a "promotion workflow", where the content of a commit on a tesitng branch is then "promoted" to a production branch with `ostree commit --tree=ref`. Another use case I just hit in rpm-ostree deals with [jigdo](https://github.com/projectatomic/rpm-ostree/issues/1081) where we're importing RPMs on both the client and server, and will be using the content checksum, since the client/server cases inject different metadata into the commit object. Closes: https://github.com/ostreedev/ostree/issues/1315 Closes: #1449 Approved by: jlebon
This commit is contained in:
1 parent
5848de93a4
commit
0041a7a1ed
6 files changed
+63
-1
No files matched your search
+11
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((81 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((82 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -755,6 +755,16 @@ assert_file_has_content show-output "Third commit"
|
||||
assert_file_has_content show-output "commit $checksum"
|
||||
echo "ok show full output"
|
||||
|
||||
grep -E -e '^ContentChecksum' show-output > previous-content-checksum.txt
|
||||
cd $test_tmpdir/checkout-test2
|
||||
checksum=$($OSTREE commit ${COMMIT_ARGS} -b test4 -s "Another commit with different subject")
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE show test4 | grep -E -e '^ContentChecksum' > new-content-checksum.txt
|
||||
if ! diff -u previous-content-checksum.txt new-content-checksum.txt; then
|
||||
fatal "content checksum differs"
|
||||
fi
|
||||
echo "ok content checksum"
|
||||
|
||||
cd $test_tmpdir/checkout-test2
|
||||
checksum1=$($OSTREE commit ${COMMIT_ARGS} -b test5 -s "First commit")
|
||||
checksum2=$($OSTREE commit ${COMMIT_ARGS} -b test5 -s "Second commit")
|
||||
|
||||
Reference in new issue
Block a user