scm: add safety in code and in git branching

We assume origin is the name of our remote in some places so must
do so everywhere - otherwise we can overwrite the wrong remote
This commit is contained in:
Andy Williams 2017-06-06 18:11:45 -07:00
parent d208afac91
commit e69cdf44d1
2 changed files with 4 additions and 15 deletions

View File

@ -413,7 +413,7 @@ _edi_settings_project_name_cb(void *data EINA_UNUSED, Evas_Object *obj,
static Evas_Object *
_edi_settings_project_create(Evas_Object *parent)
{
Edi_Scm_Engine *engine;
Edi_Scm_Engine *engine = NULL;
Evas_Object *box, *frame, *hbox, *label, *entry_name, *entry_email;
Evas_Object *entry_remote;
Eina_Strbuf *text;
@ -491,7 +491,8 @@ _edi_settings_project_create(Evas_Object *parent)
evas_object_show(label);
entry_remote = elm_entry_add(hbox);
if (edi_scm_remote_enabled())
elm_object_disabled_set(entry_remote, !engine);
if (engine)
elm_object_text_set(entry_remote, engine->remote_url);
evas_object_size_hint_weight_set(entry_remote, 0.75, 0.0);

View File

@ -268,25 +268,13 @@ _edi_scm_git_remote_email_get(void)
static const char *
_edi_scm_git_remote_url_get(void)
{
char *remote;
Eina_Strbuf *command;
Edi_Scm_Engine *engine = _edi_scm_global_object;
if (!engine)
return NULL;
if (!engine->remote_url)
{
remote = _edi_scm_exec_response("git remote");
if (remote)
{
command = eina_strbuf_new();
eina_strbuf_append_printf(command, "git remote get-url %s", remote);
engine->remote_url = eina_stringshare_add(_edi_scm_exec_response(eina_strbuf_string_get(command)));
eina_strbuf_free(command);
free(remote);
}
}
engine->remote_url = eina_stringshare_add(_edi_scm_exec_response("git remote get-url origin"));
return engine->remote_url;
}