[gitg/wip/ao2/git-dir-env] Honor GIT_DIR env
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/ao2/git-dir-env] Honor GIT_DIR env
- Date: Wed, 26 Dec 2018 10:58:59 +0000 (UTC)
commit 23b5e7a03518b173347e8f7b5a25dfd648f982d9
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..1d82ef33 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 = 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 {
+ // 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]