[gitg/wip/ao2/git-dir-env] Honor GIT_DIR env



commit cd3246a90680ca5f1e215863154dd98267a91618
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Wed Dec 26 11:44:15 2018 +0100

    Honor GIT_DIR env

 gitg/gitg-application.vala | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 38d331b9..4374a136 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -189,7 +189,17 @@ public class Application : Gtk.Application
                var tmpcmd = app_command_line;
                app_command_line = cmd;
 
-               if (argv.length > 1)
+               unowned string git_dir_env = cmd.getenv("GIT_DIR");
+               if (git_dir_env != null)
+               {
+                       var git_dir_path = File.new_for_path(git_dir_env);
+                       if (git_dir_path.query_exists ())
+                       {
+                               File[] files = new File[] { git_dir_path };
+                               open_command_line(files, activity, command_lines);
+                       }
+               }
+               else if (argv.length > 1)
                {
                        File[] files = new File[argv.length - 1];
                        files.length = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]