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 608101 - Give CLI options higher priority than environment variables
Give CLI options higher priority than environment variables
Status: RESOLVED FIXED
Product: giggle
Classification: Other
Component: UI: General
0.4.x
Other All
: Normal minor
: ---
Assigned To: giggle-maint
Depends on:
Blocks:
 
 
Reported: 2010-01-25 23:13 UTC by Florian Müllner
Modified: 2010-02-02 18:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Give CLI options higher priority than environment variables (2.26 KB, patch)
2010-01-25 23:13 UTC, Florian Müllner
needs-work Details | Review
Give CLI options higher priority than environment variables (2.17 KB, patch)
2010-02-02 18:03 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2010-01-25 23:13:00 UTC
Currently, when specifying the directory, GIT_DIR overwrites the
command line parameter --- rather unorthodox ...
Comment 1 Florian Müllner 2010-01-25 23:13:06 UTC
Created attachment 152271 [details] [review]
Give CLI options higher priority than environment variables

Change the evaluation order for the directory parameter from
environment -> cli -> default to the much more established
cli -> environment -> default.

While at it, use G_OPTION_REMAINING instead of argv for the
directory parameter.
Comment 2 Javier Jardón (IRC: jjardon) 2010-02-02 17:21:09 UTC
Review of attachment 152271 [details] [review]:

Patch looks good, Could you fix the commented issues?

::: src/giggle-main.c
@@ +66,2 @@
 	gdk_threads_enter ();
+	context = g_option_context_new (NULL);

Why do you remove the [DIRECTORY] entry here?

@@ +113,3 @@
+	    - the value of GIT_DIR, or
+	    - the first remaining arg, or
+	/* Set dir to:

I'd prefer the GTK+ style for this:

dir = g_strdup (g_getenv ("GIT_DIR"));
if (dir == NULL)
Comment 3 Florian Müllner 2010-02-02 18:03:11 UTC
Created attachment 152868 [details] [review]
Give CLI options higher priority than environment variables

(In reply to comment #2)
> Review of attachment 152271 [details] [review]:
> ::: src/giggle-main.c
> @@ +66,2 @@
>      gdk_threads_enter ();
> +    context = g_option_context_new (NULL);
> 
> Why do you remove the [DIRECTORY] entry here?

When using G_OPTION_REMAINING, it makes more sense in my opinion to use the
arg_description field in the GOptionEntry to set this - still, if you disagree
I have no strong objections to moving the string back here.


> @@ +113,3 @@
> I'd prefer the GTK+ style for this:
> 
> dir = g_strdup (g_getenv ("GIT_DIR"));
> if (dir == NULL)

Done.
Comment 4 Javier Jardón (IRC: jjardon) 2010-02-02 18:19:50 UTC
Comment on attachment 152868 [details] [review]
Give CLI options higher priority than environment variables

Oh yeah, you are rigth.

Please commit
Comment 5 Florian Müllner 2010-02-02 18:23:20 UTC
Attachment 152868 [details] pushed as 2a40075 - Give CLI options higher priority than environment variables