This commit is contained in:
2025-06-01 22:21:30 +02:00
parent f306225b81
commit 521fb13b1b
3 changed files with 3 additions and 11 deletions

View File

@@ -165,13 +165,10 @@ int get_last_commit(char *title, size_t title_size, char *hash,
pclose(fp);
}
fp = popen("git log -1 --pretty=format:'%s' 2>/dev/null", "r");
fp = popen("git log -1 --pretty=format:%s 2>/dev/null", "r");
if (fp) {
if (fgets(title, title_size, fp) != NULL) {
if (title[0] == '\'' && title[strlen(title)-1] == '\'') {
memmove(title, title + 1, strlen(title) - 1);
title[strlen(title) - 1] = '\0';
}
// No need to remove quotes since we're not using them in the format
}
pclose(fp);
}
@@ -185,7 +182,7 @@ int get_recent_commit(char commits[][256], int count) {
}
char cmd[256];
snprintf(cmd, sizeof(cmd), "git log -%d --pretty=format:'%%s' 2>/dev/null", count);
snprintf(cmd, sizeof(cmd), "git log -%d --pretty=format:%%s 2>/dev/null", count);
FILE *fp = popen(cmd, "r");
if (!fp) {
@@ -197,11 +194,6 @@ int get_recent_commit(char commits[][256], int count) {
char *newline = strchr(commits[retrieved], '\n');
if (newline) *newline = '\0';
if (commits[retrieved][0] == '\'' && commits[retrieved][strlen(commits[retrieved])-1] == '\'') {
memmove(commits[retrieved], commits[retrieved] + 1, strlen(commits[retrieved]) - 1);
commits[retrieved][strlen(commits[retrieved]) - 1] = '\0';
}
retrieved++;
}

Binary file not shown.

BIN
shell

Binary file not shown.