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



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

    Honor GIT_DIR env

 gitg/gitg-application.vala | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 38d331b9..966e8f76 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -189,7 +189,13 @@ 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)
+               {
+                       File[] files = new File[] {File.new_for_path(git_dir_env)};
+                       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]