screens: scm. only show staged changes.

This commit is contained in:
Al Poole 2017-09-21 20:45:33 +01:00
parent 1c14989ccd
commit 376d4c5752
3 changed files with 19 additions and 11 deletions

View File

@ -300,9 +300,12 @@ _file_status_list_fill(Evas_Object *list)
{
EINA_LIST_FREE(e->statuses, status)
{
_file_status_item_add(status->path, status->change);
elm_genlist_item_append(list, itc, strdup(status->path), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
if (status->staged) staged = EINA_TRUE;
if (status->staged)
{
staged = EINA_TRUE;
_file_status_item_add(status->path, status->change);
elm_genlist_item_append(list, itc, strdup(status->path), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
eina_stringshare_del(status->fullpath);
eina_stringshare_del(status->path);
@ -452,13 +455,13 @@ edi_scm_screens_commit(Evas_Object *parent)
elm_box_pack_end(box, frame);
// End of Trick
text = edi_scm_diff();
text = edi_scm_diff(EINA_TRUE);
if (text[0] && text[1])
{
frame = elm_frame_add(popup);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(frame, _("Unstaged changes"));
elm_object_text_set(frame, _("Committed changes"));
evas_object_show(frame);
cbox = elm_box_add(popup);

View File

@ -317,14 +317,17 @@ _edi_scm_git_status_get(void)
}
static char *
_edi_scm_git_diff(void)
_edi_scm_git_diff(Eina_Bool cached)
{
char *output;
Eina_Strbuf *command;
command = eina_strbuf_new();
eina_strbuf_append(command, "git diff");
if (cached)
eina_strbuf_append(command, "git diff --cached");
else
eina_strbuf_append(command, "git diff");
output = _edi_scm_exec_response(eina_strbuf_string_get(command));
@ -608,11 +611,11 @@ edi_scm_remote_add(const char *remote_url)
}
EAPI char *
edi_scm_diff(void)
edi_scm_diff(Eina_Bool cached)
{
Edi_Scm_Engine *e = edi_scm_engine_get();
return e->diff();
return e->diff(cached);
}
EAPI void

View File

@ -38,7 +38,7 @@ typedef int (scm_fn_del)(const char *path);
typedef int (scm_fn_move)(const char *src, const char *dest);
typedef int (scm_fn_commit)(const char *message);
typedef int (scm_fn_status)(void);
typedef char *(scm_fn_diff)(void);
typedef char *(scm_fn_diff)(Eina_Bool);
typedef int (scm_fn_push)(void);
typedef int (scm_fn_pull)(void);
typedef int (scm_fn_stash)(void);
@ -188,9 +188,11 @@ Eina_Bool edi_scm_status_get(void);
/**
* Get diff of changes in repository.
*
* @param cached Whether the results are general or cached changes.
*
* @return diff output as a string.
*/
char *edi_scm_diff(void);
char *edi_scm_diff(Eina_Bool cached);
/**
* Move from src to dest.