- // is it a roojs origin?
- var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
- var uri = new Soup.URI(r);
- if (uri.get_host() != "git.roojs.com") { // we can only push to this url. -- unless we have forced it to be managed.
- return FileUtils.test(this.gitdir + "/.gitlive-managed" , FileTest.EXISTS);
+ this.config_cache = new Gee.HashMap<string,string>();
+ // managed =
+ if (this.get_config("managed") == "") {
+ this.set_config("managed", this.host == "git.roojs.com" ? "1" : "0");
+ }
+ if (this.get_config("autocommit") == "") {
+ this.set_config("autocommit", this.host == "git.roojs.com" ? "1" : "0");
+ }
+ if (this.get_config("autopush") == "") {
+ this.set_config("autopush", this.host == "git.roojs.com" ? "1" : "0");
+ }
+
+ }
+
+
+
+ public string get_config(string key) {
+
+ if (this.config_cache.has_key(key)) {
+ //GLib.debug("get_config %s = '%s'", key, this.config_cache.get(key));
+ return this.config_cache.get(key);
+ }
+ try {
+ var ret = this.git({ "config" , "gitlive." + key }).strip();
+ this.config_cache.set(key, ret);
+ //GLib.debug("get_config %s = '%s'", key, ret);
+ return ret;
+ } catch (Error e) {
+ this.config_cache.set(key, "");
+ //GLib.debug("get_config (fail) %s = '%s'", key, "");
+ return ""; // happens when there is nothing set...