GNOME Bugzilla – Bug 608101
Give CLI options higher priority than environment variables
Last modified: 2010-02-02 18:23:23 UTC
Currently, when specifying the directory, GIT_DIR overwrites the command line parameter --- rather unorthodox ...
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.
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)
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 on attachment 152868 [details] [review] Give CLI options higher priority than environment variables Oh yeah, you are rigth. Please commit
Attachment 152868 [details] pushed as 2a40075 - Give CLI options higher priority than environment variables