Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

cgwalters
Copy link
Member

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.

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.
(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 */
Copy link
Member

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().

&& 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);
Copy link
Member

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 ?

* assertion is intended to ensure that for regular files at least, we
* succeeded at hardlinking above.
*/
if (!is_symlink)
Copy link
Member

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);

?

@cgwalters
Copy link
Member Author

Fixup for comments ⬆️

@jlebon
Copy link
Member

jlebon commented Apr 12, 2017

@rh-atomic-bot r+ 054fd76

@rh-atomic-bot
Copy link

⌛ Testing commit 054fd76 with merge d3385a3...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing d3385a3 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants