[gitg] Honor GIT_DIR env



commit 7de63523e31e706028098e4a05f470f39fb9268c
Author: Antonio Ospite <ao2 ao2 it>
Date:   Wed Dec 26 11:44:15 2018 +0100

    Honor GIT_DIR env

 gitg/gitg-application.vala | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 38d331b9..834c352d 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -446,11 +446,18 @@ public class Application : Gtk.Application
                }
                else
                {
-                       // Otherwise open repository from current dir
-                       string? wd = app_command_line.get_cwd();
-
-                       open(new File[] { File.new_for_path(wd) }, activity);
-                       present_window(activity, command_lines);
+                       unowned string git_dir_env = app_command_line.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 {
+                               // Otherwise open repository from current dir
+                               string? wd = app_command_line.get_cwd();
+
+                               open(new File[] { File.new_for_path(wd) }, activity);
+                               present_window(activity, command_lines);
+                       }
                }
        }
 


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