After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706762 - main: Code cleanup by passing OstreeRepo * directly to builtins
main: Code cleanup by passing OstreeRepo * directly to builtins
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-08-25 19:12 UTC by Colin Walters
Modified: 2013-08-25 19:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
main: Code cleanup by passing OstreeRepo * directly to builtins (30.08 KB, patch)
2013-08-25 19:12 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2013-08-25 19:12:43 UTC
It turns out every builtin (with one special exception) that takes a
repo argument did the same thing; let's just centralize it.  The
special exception was "ostree init --repo=foo" where foo is expected
to *not* actually be a repo.  In that case, simply skip the
ostree_repo_check() invocation.
Comment 1 Colin Walters 2013-08-25 19:12:44 UTC
Created attachment 253069 [details] [review]
main: Code cleanup by passing OstreeRepo * directly to builtins
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-08-25 19:23:29 UTC
Review of attachment 253069 [details] [review]:

Not sure I like how you shuffle file paths through a "repo" object for the init builtin, but OK.

::: src/ostree/ot-builtin-init.c
@@ +55,3 @@
     goto out;
 
+  repo_path = g_object_ref (ostree_repo_get_path (repo));

Are you sure this g_object_ref is correct? Why not just remove the gs_unref_object from above to prevent the extra work?
Comment 3 Colin Walters 2013-08-25 19:27:03 UTC
(In reply to comment #2)
> Review of attachment 253069 [details] [review]:
> 
> Not sure I like how you shuffle file paths through a "repo" object for the init
> builtin, but OK.

Yeah...the alternative would be special casing init at a higher level, basically pulling it into main.c.

> ::: src/ostree/ot-builtin-init.c
> @@ +55,3 @@
>      goto out;
> 
> +  repo_path = g_object_ref (ostree_repo_get_path (repo));
> 
> Are you sure this g_object_ref is correct? 

Yep, the repo is transfer none.

> Why not just remove the gs_unref_object from above to prevent the extra work?

Mmm...ok.
Comment 4 Colin Walters 2013-08-25 19:31:05 UTC
Attachment 253069 [details] pushed as edfa76f - main: Code cleanup by passing OstreeRepo * directly to builtins