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

prune: Skip calculating potential freed space in the dry run #5813

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

barthalion
Copy link
Member

No description provided.

n_objects_pruned, formatted_freed_size);
if (!opt_prune_dry_run)
{
formatted_freed_size = g_format_size_full (objsize_total, 0);
Copy link
Member

Choose a reason for hiding this comment

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

The declaration of the formatted_freed_size variable should be moved to this if block now.

But, what's the reasoning for not printing this on dry runs? Does it always return zero or a bogus value on dry runs?

The commit message could have some of that reasoning.

Copy link
Member Author

Choose a reason for hiding this comment

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

The data will be null/zero because it will no longer traverse all objects.

Comment on lines +802 to +812
if (!dry_run)
{
g_info ("Pruning unreachable objects");
g_timer_start (timer);

if (!prune_unreachable_loose_objects (repo, &data, cancellable, error))
return FALSE;
if (!prune_unreachable_loose_objects (repo, &data, cancellable, error))
return FALSE;

g_timer_stop (timer);
g_info ("Elapsed time: %.1f sec", g_timer_elapsed (timer, NULL));
g_timer_stop (timer);
g_info ("Elapsed time: %.1f sec", g_timer_elapsed (timer, NULL));
}
Copy link
Member

Choose a reason for hiding this comment

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

Well this is not just "calculating", right? This is actually pruning stuff on a dry run, seems like an actual problem here.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not actually pruning. Somewhere down the stackcode there's data.dont_prune defined that causes this function to stat/statx each object to calculate potential space-saving.

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.

None yet

2 participants