Skip to content

Commit

Permalink
fixup! bin/prune: Add --only-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Sep 12, 2017
1 parent f962e2c commit 8ec80eb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/ostree/ot-builtin-prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,19 @@ ostree_builtin_prune (int argc, char **argv, GCancellable *cancellable, GError *
for (char **iter = opt_only_branches; iter && *iter; iter++)
{
const char *ref = *iter;
g_autofree char *commit = NULL;
/* Ensure the specified branch exists */
if (!ostree_repo_resolve_rev (repo, ref, FALSE, &commit, error))
if (!ostree_repo_resolve_rev (repo, ref, FALSE, NULL, error))
return FALSE;
g_hash_table_add (only_branches_set, *iter);
if (g_hash_table_contains (retain_branch_depth, ref))
return glnx_throw (error, "--retain-branch-depth conflicts with --only-branch");
g_hash_table_add (only_branches_set, (char*)ref);
}

/* Iterate over all refs, add equivalent of --retain-branch-depth=$ref=-1
* if the ref isn't in --only-branch set.
*/
g_hash_table_iter_init (&hash_iter, all_refs);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
GLNX_HASH_TABLE_FOREACH (all_refs, const char *, ref)
{
const char *ref = key;
if (!g_hash_table_contains (only_branches_set, ref))
g_hash_table_insert (retain_branch_depth, g_strdup (ref), GINT_TO_POINTER ((int)-1));
}
Expand Down

0 comments on commit 8ec80eb

Please sign in to comment.