This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository edi.
View the commit online.
commit 51d20c1f14fc218263f7f109146e19d1f529243f
Author: Alastair Poole <[email protected]>
AuthorDate: Thu Apr 16 13:01:07 2026 +0100
edi_scm_ui: split our fields up. Much tidier.
---
src/bin/edi_scm_ui.c | 194 +++++++++++++++++++++++++++++++++++++--------------
1 file changed, 143 insertions(+), 51 deletions(-)
diff --git a/src/bin/edi_scm_ui.c b/src/bin/edi_scm_ui.c
index 6ec7873..39b62bc 100644
--- a/src/bin/edi_scm_ui.c
+++ b/src/bin/edi_scm_ui.c
@@ -38,9 +38,12 @@ typedef struct _Edi_Scm_Show_Data {
typedef struct _Edi_Scm_Log_Item {
char *hash;
- char *text;
- char *message_filter_text;
- char *author_filter_text;
+ char *author_name;
+ char *author_email;
+ char *date;
+ char *title;
+ char *body;
+ char *display_text;
} Edi_Scm_Log_Item;
typedef struct _Edi_Scm_Log_View_Data {
@@ -688,12 +691,103 @@ _edi_scm_ui_log_item_free(Edi_Scm_Log_Item *item)
if (!item) return;
free(item->hash);
- free(item->text);
- free(item->message_filter_text);
- free(item->author_filter_text);
+ free(item->author_name);
+ free(item->author_email);
+ free(item->date);
+ free(item->title);
+ free(item->body);
+ free(item->display_text);
free(item);
}
+static char *
+_edi_scm_ui_log_strip_copy(const char *src)
+{
+ size_t start = 0, end;
+
+ if (!src) return strdup("");
+
+ end = strlen(src);
+ while (start < end && isspace((unsigned char) src[start]))
+ start++;
+ while (end > start && isspace((unsigned char) src[end - 1]))
+ end--;
+
+ return strndup(src + start, end - start);
+}
+
+static void
+_edi_scm_ui_log_author_parse(Edi_Scm_Log_Item *item, const char *author_line)
+{
+ const char *lt, *gt;
+ char *name;
+
+ free(item->author_name);
+ free(item->author_email);
+ item->author_name = NULL;
+ item->author_email = NULL;
+
+ if (!author_line) return;
+
+ lt = strrchr(author_line, '<');
+ gt = lt ? strchr(lt, '>') : NULL;
+
+ if (lt && gt && lt > author_line)
+ {
+ name = strndup(author_line, lt - author_line);
+ item->author_name = _edi_scm_ui_log_strip_copy(name);
+ item->author_email = strndup(lt + 1, gt - lt - 1);
+ free(name);
+ }
+ else
+ item->author_name = _edi_scm_ui_log_strip_copy(author_line);
+}
+
+static void
+_edi_scm_ui_log_item_finalize(Edi_Scm_Log_View_Data *ld, Edi_Scm_Log_Item **item_ptr)
+{
+ Edi_Scm_Log_Item *item;
+ Eina_Strbuf *display;
+
+ item = *item_ptr;
+ if (!item) return;
+
+ display = eina_strbuf_new();
+
+ if (item->author_name && *item->author_name)
+ {
+ if (item->author_email && *item->author_email)
+ eina_strbuf_append_printf(display, "Author: %s <%s>\n", item->author_name, item->author_email);
+ else
+ eina_strbuf_append_printf(display, "Author: %s\n", item->author_name);
+ }
+ else if (item->author_email && *item->author_email)
+ eina_strbuf_append_printf(display, "Author: <%s>\n", item->author_email);
+
+ if (item->date && *item->date)
+ eina_strbuf_append_printf(display, "Date: %s\n", item->date);
+
+ if ((item->title && *item->title) || (item->body && *item->body))
+ eina_strbuf_append(display, "\n");
+
+ if (item->title && *item->title)
+ eina_strbuf_append(display, item->title);
+
+ if (item->body && *item->body)
+ {
+ if (item->title && *item->title)
+ eina_strbuf_append(display, "\n");
+ eina_strbuf_append(display, item->body);
+ }
+
+ item->display_text = strdup(eina_strbuf_string_get(display));
+
+ eina_strbuf_free(display);
+
+ ld->items = eina_list_append(ld->items, item);
+ *item_ptr = NULL;
+}
+
static void
_edi_scm_ui_log_view_data_free(Edi_Scm_Log_View_Data *ld)
{
@@ -738,10 +832,10 @@ _edi_scm_ui_log_list_refresh(Edi_Scm_Log_View_Data *ld)
{
if (has_query)
{
- match_message = item->message_filter_text &&
- strcasestr(item->message_filter_text, query_utf8);
- match_author = item->author_filter_text &&
- strcasestr(item->author_filter_text, query_utf8);
+ match_message = (item->title && strcasestr(item->title, query_utf8)) ||
+ (item->body && strcasestr(item->body, query_utf8));
+ match_author = (item->author_name && strcasestr(item->author_name, query_utf8)) ||
+ (item->author_email && strcasestr(item->author_email, query_utf8));
if (!match_message && !match_author)
continue;
}
@@ -773,11 +867,9 @@ _edi_scm_ui_log_fill_cb(void *data)
Edi_Scm_Log_View_Data *ld;
Eina_List *log;
char *line;
- char *current_hash = NULL;
- Eina_Strbuf *current_text = NULL;
- Eina_Strbuf *current_message_filter = NULL;
- Eina_Strbuf *current_author_filter = NULL;
- Edi_Scm_Log_Item *item;
+ Edi_Scm_Log_Item *item = NULL;
+ Eina_Strbuf *body = NULL;
+ const char *value;
ld = data;
@@ -787,56 +879,56 @@ _edi_scm_ui_log_fill_cb(void *data)
{
if (!strncmp(line, "commit ", 7) && _edi_scm_ui_commit_hash_valid(line + 7))
{
- if (current_hash)
+ if (item && body && !item->body)
+ item->body = strdup(eina_strbuf_string_get(body));
+ _edi_scm_ui_log_item_finalize(ld, &item);
+ if (body)
{
- item = calloc(1, sizeof(*item));
- item->hash = current_hash;
- item->text = strdup(eina_strbuf_string_get(current_text));
- item->message_filter_text = strdup(eina_strbuf_string_get(current_message_filter));
- item->author_filter_text = strdup(eina_strbuf_string_get(current_author_filter));
- ld->items = eina_list_append(ld->items, item);
- current_hash = NULL;
- eina_strbuf_free(current_text);
- eina_strbuf_free(current_message_filter);
- eina_strbuf_free(current_author_filter);
- current_text = NULL;
- current_message_filter = NULL;
- current_author_filter = NULL;
+ eina_strbuf_free(body);
+ body = NULL;
}
- current_hash = strdup(line + 7);
- current_text = eina_strbuf_new();
- current_message_filter = eina_strbuf_new();
- current_author_filter = eina_strbuf_new();
+ item = calloc(1, sizeof(*item));
+ item->hash = strdup(line + 7);
+ body = eina_strbuf_new();
free(line);
continue;
}
- if (current_hash && current_text)
+ if (item)
{
- eina_strbuf_append_printf(current_text, "%s\n", line);
-
- if (!strncmp(line, " ", 4))
- eina_strbuf_append_printf(current_message_filter, "%s\n", line + 4);
- else if (!strncmp(line, "Author: ", 8))
- eina_strbuf_append_printf(current_author_filter, "%s\n", line + 8);
+ if (!strncmp(line, "Author: ", 8))
+ _edi_scm_ui_log_author_parse(item, line + 8);
+ else if (!strncmp(line, "Date:", 5))
+ {
+ value = line + 5;
+ while (*value == ' ') value++;
+ free(item->date);
+ item->date = strdup(value);
+ }
+ else if (!strncmp(line, " ", 4))
+ {
+ value = line + 4;
+ if (!item->title && *value)
+ item->title = strdup(value);
+ else
+ {
+ if (eina_strbuf_length_get(body))
+ eina_strbuf_append(body, "\n");
+ eina_strbuf_append(body, value);
+ }
+ }
}
free(line);
}
- if (current_hash)
+ if (item)
{
- item = calloc(1, sizeof(*item));
- item->hash = current_hash;
- item->text = strdup(eina_strbuf_string_get(current_text));
- item->message_filter_text = strdup(eina_strbuf_string_get(current_message_filter));
- item->author_filter_text = strdup(eina_strbuf_string_get(current_author_filter));
- ld->items = eina_list_append(ld->items, item);
- eina_strbuf_free(current_text);
- eina_strbuf_free(current_message_filter);
- eina_strbuf_free(current_author_filter);
+ item->body = strdup(eina_strbuf_string_get(body));
+ _edi_scm_ui_log_item_finalize(ld, &item);
}
+ if (body) eina_strbuf_free(body);
_edi_scm_ui_log_list_refresh(ld);
@@ -1015,7 +1107,7 @@ _edi_scm_ui_log_item_content_get_cb(void *data, Evas_Object *obj, const char *pa
elm_entry_line_wrap_set(entry, ELM_WRAP_NONE);
evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
- markup = elm_entry_utf8_to_markup(item->text ? item->text : "");
+ markup = elm_entry_utf8_to_markup(item->display_text ? item->display_text : "");
elm_object_text_set(entry, markup);
free(markup);
evas_object_show(entry);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.