scm: make remote adding not overwrite previous remotes

Also set upstream tracking by default not fixing retrospectively
This commit is contained in:
Andy Williams 2017-06-06 19:23:40 -07:00
parent 38e971647c
commit 9cf9fa415c
2 changed files with 7 additions and 25 deletions

View File

@ -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);

View File

@ -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;
}