-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checkout: Provide useful error with checkout -H and incompat mode #779
Conversation
Previously we'd assert and dump core if one used `checkout -H` without `-U` on a bare-user repo, because we'd hit the bare-user symlink case. Rework the code to handle this, and add tests. I hit this when I was going to suggest to someone to use `-H` to ensure they were getting hardlinks.
src/libostree/ostree-repo-checkout.c
Outdated
(current_repo->mode == OSTREE_REPO_MODE_BARE | ||
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_NONE) || | ||
(repo_is_usermode && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER); | ||
/* NOTE: bare-user symlinks are not stored as symlinks */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a e.g. (see comment in write_object())
here? It's not intuitive offhand why we can't hardlink symlinks in bare-user mode. It took me some digging through git logs to find 47c612e and the associated comment in write_object()
.
src/libostree/ostree-repo-checkout.c
Outdated
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_NONE) || | ||
(repo_is_usermode && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER); | ||
/* NOTE: bare-user symlinks are not stored as symlinks */ | ||
gboolean is_bare_symlink = (repo_is_usermode && is_symlink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be renamed is_bare_user_symlink
?
src/libostree/ostree-repo-checkout.c
Outdated
* assertion is intended to ensure that for regular files at least, we | ||
* succeeded at hardlinking above. | ||
*/ | ||
if (!is_symlink) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the intent here be better expressed as:
if (options->no_copy_fallback)
g_assert (is_bare_user_symlink);
?
Fixup for comments ⬆️ |
☀️ Test successful - status-atomicjenkins |
Previously we'd assert and dump core if one used
checkout -H
without-U
on a bare-user repo, because we'd hit the bare-user symlink case.Rework the code to handle this, and add tests. I hit this when I was going to
suggest to someone to use
-H
to ensure they were getting hardlinks.