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

[merged] Support for selective pruning #646

Closed
wants to merge 4 commits into from

Conversation

cgwalters
Copy link
Member

No description provided.

@cgwalters cgwalters added the WIP label Jan 16, 2017
There are use cases for having a single repo with branches
with different lifecycles; a simple example of what I was
trying to do in CentOS Atomic Host work is have "stable"
and "devel" branches, were we want to prune devel, but
retain *all* of stable.

This patch is split into two parts - first we add a low level "delete all
objects not in this set" API, and change the current prune API
to use this.

Next, we move more logic into the "ostree prune" command. This paves the way for
demonstrating how more sophisticated algorithms/logic could be developed outside
of the ostree core.

Also, the --keep-younger-than logic already lived in the commandline, so it
makes sense to keep extending it there.

Closes: ostreedev#604
@cgwalters
Copy link
Member Author

Removing WIP, should be good to go.

@cgwalters cgwalters changed the title WIP: support for selective pruning Support for selective pruning Jan 18, 2017
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane overall.
Just a few minor issues.

@@ -371,12 +371,10 @@ global:
* NOTE NOTE NOTE
*/

/* Remove comment when first new symbol is added
LIBOSTREE_2016.XX {
LIBOSTREE_2016.15 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017.1 ?

goto out;
}
g_hash_table_insert (retain_branch_depth, g_strndup (bd, eq - bd),
GINT_TO_POINTER ((int)g_ascii_strtoll (eq + 1, NULL, 10)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is directly user-facing, we should probably validate that g_ascii_strtoll converted successfully. Otherwise, a typo can end up pruning the whole branch.

@cgwalters
Copy link
Member Author

OK, fixups ⬆️

@jlebon
Copy link
Member

jlebon commented Jan 19, 2017

Yum, delicious fixups!
@rh-atomic-bot r+ dbe1af9

@rh-atomic-bot
Copy link

⌛ Testing commit dbe1af9 with merge 5c94098...

@rh-atomic-bot
Copy link

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

@rh-atomic-bot rh-atomic-bot changed the title Support for selective pruning [merged] Support for selective pruning Jan 19, 2017
cgwalters added a commit to cgwalters/ostree that referenced this pull request Sep 1, 2017
In 5c94098 / ostreedev#646 we
added `--retain-branch-depth`; this adds a symmetric
`--only-branch` for the case where a repo owner just
wants to prune a specific branch.

The implementation here is pretty straightforward; we
just walk all refs and inject the equivalent of
`--retain-branch-depth=$ref=-1` if they're *not* in
`--only-branch`.

Closes: ostreedev#1115
cgwalters added a commit to cgwalters/ostree that referenced this pull request Sep 7, 2017
In 5c94098 / ostreedev#646 we
added `--retain-branch-depth`; this adds a symmetric
`--only-branch` for the case where a repo owner just
wants to prune a specific branch.

The implementation here is pretty straightforward; we
just walk all refs and inject the equivalent of
`--retain-branch-depth=$ref=-1` if they're *not* in
`--only-branch`.

Closes: ostreedev#1115
cgwalters added a commit to cgwalters/ostree that referenced this pull request Sep 12, 2017
In 5c94098 / ostreedev#646 we
added `--retain-branch-depth`; this adds a symmetric
`--only-branch` for the case where a repo owner just
wants to prune a specific branch.

The implementation here is pretty straightforward; we
just walk all refs and inject the equivalent of
`--retain-branch-depth=$ref=-1` if they're *not* in
`--only-branch`.

Closes: ostreedev#1115
rh-atomic-bot pushed a commit that referenced this pull request Sep 18, 2017
In 5c94098 / #646 we
added `--retain-branch-depth`; this adds a symmetric
`--only-branch` for the case where a repo owner just
wants to prune a specific branch.

The implementation here is pretty straightforward; we
just walk all refs and inject the equivalent of
`--retain-branch-depth=$ref=-1` if they're *not* in
`--only-branch`.

Closes: #1115

Closes: #1127
Approved by: jlebon
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