scm_git: Allow us to unstage even if there is no remote url.

This allows us to use edi_scm fully even if the repo has no
remote url. Otherwise business as usual.
This commit is contained in:
Alastair Poole 2018-05-14 00:37:16 +01:00
parent 8b5fc090f8
commit 8fafc6c00a
1 changed files with 10 additions and 1 deletions

View File

@ -106,7 +106,16 @@ _edi_scm_git_file_unstage(const char *path)
int code;
Eina_Strbuf *command = eina_strbuf_new();
eina_strbuf_append_printf(command, "git reset HEAD %s", path);
eina_strbuf_append_printf(command, "git remote get-url origin");
code = _edi_scm_exec(eina_strbuf_string_get(command));
eina_strbuf_reset(command);
if (code == 0)
eina_strbuf_append_printf(command, "git reset HEAD %s", path);
else
eina_strbuf_append_printf(command, "git rm --cached %s", path);
code = _edi_scm_exec(eina_strbuf_string_get(command));