ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=9cf9fa415ca58bd50709d5cacd1462bcd63ea755

commit 9cf9fa415ca58bd50709d5cacd1462bcd63ea755
Author: Andy Williams <[email protected]>
Date:   Tue Jun 6 19:23:40 2017 -0700

    scm: make remote adding not overwrite previous remotes
    
    Also set upstream tracking by default not fixing retrospectively
---
 src/bin/screens/edi_settings.c |  5 +++--
 src/lib/edi_scm.c              | 27 ++++-----------------------
 2 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/bin/screens/edi_settings.c b/src/bin/screens/edi_settings.c
index f8a45f9..2516ad2 100644
--- a/src/bin/screens/edi_settings.c
+++ b/src/bin/screens/edi_settings.c
@@ -374,10 +374,11 @@ _edi_settings_project_remote_cb(void *data EINA_UNUSED, 
Evas_Object *obj,
    if (!url || strlen(url) == 0)
      return;
 
-   if (!edi_scm_enabled())
+   if (!edi_scm_enabled() || edi_scm_remote_enabled())
      return;
 
    edi_scm_remote_add(elm_object_text_get(entry));
+   elm_object_disabled_set(entry, EINA_TRUE);
 }
 
 static void
@@ -504,7 +505,7 @@ _edi_settings_project_create(Evas_Object *parent)
 
    entry_remote = elm_entry_add(hbox);
    elm_object_text_set(entry_remote, engine->remote_url);
-
+   elm_object_disabled_set(entry_remote, edi_scm_remote_enabled());
    evas_object_size_hint_weight_set(entry_remote, 0.75, 0.0);
    evas_object_size_hint_align_set(entry_remote, EVAS_HINT_FILL, 
EVAS_HINT_FILL);
    elm_box_pack_end(hbox, entry_remote);
diff --git a/src/lib/edi_scm.c b/src/lib/edi_scm.c
index e5ffd7e..254d5ce 100644
--- a/src/lib/edi_scm.c
+++ b/src/lib/edi_scm.c
@@ -152,22 +152,7 @@ _edi_scm_git_commit(const char *message)
 static int
 _edi_scm_git_push(void)
 {
-   int code;
-   Eina_Strbuf *command = eina_strbuf_new();
-
-   eina_strbuf_append(command, "git push");
-
-   code = _edi_scm_exec(eina_strbuf_string_get(command));
-   if (code != 0)
-     {
-        eina_strbuf_reset(command);
-        eina_strbuf_append(command, "git push --set-upstream origin master");
-        code = _edi_scm_exec(eina_strbuf_string_get(command));
-     }
-
-   eina_strbuf_free(command);
-
-   return code;
+   return _edi_scm_exec("git push");
 }
 
 static int
@@ -206,18 +191,14 @@ _edi_scm_git_remote_add(const char *remote_url)
    int code;
    Eina_Strbuf *command = eina_strbuf_new();
 
-   eina_strbuf_append(command, "git remote rm origin");
-
-   code = _edi_scm_exec(eina_strbuf_string_get(command));
-
-   eina_strbuf_reset(command);
-
    eina_strbuf_append_printf(command, "git remote add origin %s", remote_url);
 
    code = _edi_scm_exec(eina_strbuf_string_get(command));
-
    eina_strbuf_free(command);
 
+   if (code == 0)
+     code = _edi_scm_exec("git push --set-upstream origin master");
+
    return code;
 }
 

-- 


Reply via email to