lib/repo: Import metadata via hardlink even for distinct repo modes

Our previous logic for import-via-hardlink only tried if the repo modes match,
but we *can* hardlink metadata between e.g. `archive` and `bare-user` repos, and
that's quite useful thing to do. Our documentation encourages converting to/from
those repo modes locally for build systems.

Closes: #922
Approved by: alexlarsson
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-06-13 12:02:12 +00:00
1 parent 695771667c
commit b614c65eab
2 files changed
+29 -5

No files matched your search

+11 -2
View File
@@ -254,9 +254,18 @@ echo "ok diff file changing type"
cd ${test_tmpdir}
mkdir repo2
ostree_repo_init repo2 --mode=bare-user
# Use a different mode to test hardlinking metadata only
if grep -q 'mode=archive' repo/config || is_bare_user_only_repo repo; then
opposite_mode=bare-user
else
opposite_mode=archive
fi
ostree_repo_init repo2 --mode=$opposite_mode
${CMD_PREFIX} ostree --repo=repo2 pull-local repo
echo "ok pull-local"
test2_commitid=$(${CMD_PREFIX} ostree --repo=repo rev-parse test2)
test2_commit_relpath=/objects/${test2_commitid:0:2}/${test2_commitid:2}.commit
assert_files_hardlinked repo/${test2_commit_relpath} repo2/${test2_commit_relpath}
echo "ok pull-local (hardlinking metadata)"
cd ${test_tmpdir}
${CMD_PREFIX} ostree --repo=repo2 checkout ${CHECKOUT_U_ARG} test2 test2-checkout-from-local-clone