edi_scm: allow stage/unstaging outside of top scm dir.
@fix https://github.com/Enlightenment/edi/issues/16
This commit is contained in:
parent
acf483f168
commit
39c821d41a
|
@ -505,6 +505,45 @@ _edi_scm_ui_file_changes_cb(void *data EINA_UNUSED, int type EINA_UNUSED,
|
|||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
char *
|
||||
_edi_scm_engine_root_dir_get(void)
|
||||
{
|
||||
Edi_Scm_Engine *engine;
|
||||
char *directory, *engine_root, *path, *tmp;
|
||||
|
||||
engine = edi_scm_engine_get();
|
||||
if (!engine)
|
||||
exit(2 << 1);
|
||||
|
||||
tmp = path = engine_root = NULL;
|
||||
|
||||
directory = strdup(engine->workdir);
|
||||
|
||||
while (directory)
|
||||
{
|
||||
path = edi_path_append(directory, engine->directory);
|
||||
if (ecore_file_exists(path) && ecore_file_is_dir(path))
|
||||
{
|
||||
engine_root = strdup(directory);
|
||||
break;
|
||||
}
|
||||
|
||||
tmp = ecore_file_dir_get(directory);
|
||||
free(directory);
|
||||
directory = tmp;
|
||||
free(path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if (path)
|
||||
free(path);
|
||||
|
||||
if (directory)
|
||||
free(directory);
|
||||
|
||||
return engine_root;
|
||||
}
|
||||
|
||||
char *
|
||||
_edi_scm_ui_workdir_get(void)
|
||||
{
|
||||
|
@ -667,6 +706,7 @@ edi_scm_ui_add(Evas_Object *parent)
|
|||
exit(1 << 1);
|
||||
|
||||
edi_scm = calloc(1, sizeof(Edi_Scm_Ui));
|
||||
engine->workdir = _edi_scm_engine_root_dir_get();
|
||||
edi_scm->workdir = engine->workdir;
|
||||
edi_scm->monitor = eio_monitor_add(edi_scm->workdir);
|
||||
edi_scm->parent = parent;
|
||||
|
|
Loading…
Reference in New Issue