Skip to content

Commit

Permalink
edi_scm: allow stage/unstaging outside of top scm dir.
Browse files Browse the repository at this point in the history
@fix #16
  • Loading branch information
haxworx committed Dec 27, 2017
1 parent acf483f commit 39c821d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/bin/edi_scm_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 39c821d

Please sign in to comment.