so://phie

soso

My pretty neat website
git clone git://soophie.de/soso

feat: Improved commit message rendering and added styling


commit: e3d82ae94ec73ac952aa6e03ea0b069a11dd9822
parent: 74150dc67cc17ac6c181601d622102d9b9f6144b
author: Sophie <info@soophie.de>
time: 2026-10-09 16:39

diff --git a/asset/style/main.css b/asset/style/main.css

index dd52159..617257f 100644

--- a/asset/style/main.css

+++ b/asset/style/main.css

1@@ -20,6 +20,7 @@ html {

2 max-width: 900px;

3 margin: 4rem auto;

4 margin-bottom: 6rem;

5+ padding: 0px 1rem;

6 font-size: var(--ft-size);

7 font-weight: var(--ft-weight);

8 }

9@@ -34,19 +35,31 @@ pre {

10 white-space: pre-wrap;

11 }

12

13+img {

14+ max-width: 100%;

15+}

16+

17 ul.row-list {

18 padding: 0px;

19 width: 100%;

20

21 li.row {

22 display: flex;

23- gap: 0px 0.75rem;

24+ align-items: center;

25+ gap: 0px 1rem;

26 margin: 0px;

27- padding: 0px;

28+ padding: 0px 2ch;

29+ height: 24px;

30 list-style-type: none;

31

32 &.row--head {

33 margin-bottom: 0.5rem;

34+ border-bottom: 1px solid #bbbbbb;

35+ font-weight: 600;

36+ }

37+

38+ &:not(.row--head):hover {

39+ background-color: #e1e1e1;

40 }

41

42 span.col {

43@@ -70,11 +83,17 @@ ul.row-list {

44 &.col--owner {

45 min-width: 20ch;

46 max-width: 20ch;

47+ text-overflow: ellipsis;

48+ white-space: nowrap;

49+ overflow: hidden;

50 }

51

52 &.col--author {

53 min-width: 20ch;

54 max-width: 20ch;

55+ text-overflow: ellipsis;

56+ white-space: nowrap;

57+ overflow: hidden;

58 }

59

60 &.col--size {

61@@ -85,11 +104,17 @@ ul.row-list {

62 &.col--message {

63 min-width: 50ch;

64 flex: 1;

65+ text-overflow: ellipsis;

66+ white-space: nowrap;

67+ overflow: hidden;

68 }

69

70 &.col--description {

71 min-width: 50ch;

72 flex: 1;

73+ text-overflow: ellipsis;

74+ white-space: nowrap;

75+ overflow: hidden;

76 }

77 }

78 }

79@@ -121,6 +146,15 @@ ul.row-list {

80

81 .git--repo {

82 margin-top: 2rem;

83+

84+ .repo--description {

85+

86+ }

87+

88+ .repo--clone {

89+ display: inline-block;

90+ margin-top: 0.5rem;

91+ }

92

93 hr {

94 border: none;

95@@ -181,7 +215,23 @@ ul.row-list {

96 }

97 }

98

99-.commit-diff {

100+.commit--meta {

101+

102+ .commit--body {

103+ white-space: pre-wrap;

104+ }

105+

106+ hr {

107+ margin-top: 1rem;

108+ margin-bottom: 1rem;

109+ }

110+

111+ .commit--info {

112+ line-height: 1.1rem;

113+ }

114+}

115+

116+.commit--diff {

117 margin-top: 2rem;

118

119 pre {

120@@ -296,3 +346,102 @@ ul.row-list {

121 }

122 }

123 }

124+

125+.blob {

126+ margin-top: 2rem;

127+

128+ pre {

129+ margin: 1rem 0px;

130+

131+ &.blob--meta {

132+ display: flex;

133+ gap: 0px 2ch;

134+ padding-top: 0.25rem;

135+ padding-bottom: 0.25rem;

136+ padding-left: 1ch;

137+ padding-right: 1ch;

138+ border: 1px solid #bbbbbb;

139+ background-color: #eeeeee;

140+

141+ &:has(+ pre.blob--code) {

142+ margin-bottom: -1rem;

143+ border-bottom: 0px;

144+ }

145+

146+ span {

147+ flex: 1;

148+ }

149+

150+ a {

151+

152+ &.link--raw {

153+ margin-left: auto;

154+ }

155+ }

156+ }

157+

158+ &.blob--code {

159+ padding-top: 0.5rem;

160+ padding-bottom: 0.5rem;

161+ border: 1px solid #bbbbbb;

162+

163+ span.blob--binary {

164+ display: block;

165+ padding-top: 1rem;

166+ padding-bottom: 1rem;

167+ text-align: center;

168+ }

169+

170+ p {

171+ display: flex;

172+ margin: 0px;

173+

174+ &:not(:hover) {

175+

176+ &:target {

177+ background-color: #ffff9a !important;

178+

179+ span.ln {

180+

181+ a {

182+ color: #666666;

183+ }

184+ }

185+ }

186+ }

187+

188+ &:hover {

189+ background-color: #e1e1e1;

190+

191+ span.ln {

192+

193+ a {

194+ color: #666666;

195+ }

196+ }

197+ }

198+

199+ span.ln {

200+ min-width: max-content;

201+ user-select: none;

202+ padding-left: 1ch;

203+ margin-right: 2ch;

204+ border-left: 3px solid transparent;

205+

206+ a {

207+ text-decoration: none;

208+ color: #888888;

209+

210+ &:hover {

211+ text-decoration: underline;

212+ }

213+ }

214+ }

215+

216+ span.line {

217+

218+ }

219+ }

220+ }

221+ }

222+}

223

224

diff --git a/src/module/git_repo.h b/src/module/git_repo.h

index b145385..99c9b27 100644

--- a/src/module/git_repo.h

+++ b/src/module/git_repo.h

1@@ -22,6 +22,8 @@ typedef struct {

2 typedef struct {

3 char *oid;

4 char *message;

5+ char *summary;

6+ char *body;

7 char *author_name;

8 char *author_email;

9 time_t time;

10

11

diff --git a/src/module/git_repo_commit.c b/src/module/git_repo_commit.c

index 6dceb23..fd85e7b 100644

--- a/src/module/git_repo_commit.c

+++ b/src/module/git_repo_commit.c

1@@ -21,6 +21,9 @@ static orb_rc_t fetch(orb_module_t *self) {

2 git_repo_commit_t *commit = data->commit;

3 commit->oid = strdup(data->repo->oid);

4 commit->message = strdup(git_commit_message(commit_handle));

5+ commit->summary = strdup(git_commit_summary(commit_handle));

6+ const char *body = git_commit_body(commit_handle);

7+ if (body) commit->body = strdup(body);

8 commit->author_name = strdup(git_commit_author(commit_handle)->name);

9 commit->author_email = strdup(git_commit_author(commit_handle)->email);

10 commit->time = (time_t) git_commit_time(commit_handle);

11@@ -81,6 +84,8 @@ static void cleanup(orb_module_t *self) {

12 git_repo_commit_t *commit = data->commit;

13 free(commit->oid);

14 free(commit->message);

15+ free(commit->summary);

16+ if (commit->body) free(commit->body);

17 free(commit->author_name);

18 free(commit->author_email);

19 free(commit);

20

21

diff --git a/src/module/git_repo_log.c b/src/module/git_repo_log.c

index 021e998..5d9b854 100644

--- a/src/module/git_repo_log.c

+++ b/src/module/git_repo_log.c

1@@ -32,9 +32,13 @@ static orb_rc_t fetch(orb_module_t *self) {

2 git_commit_lookup(&commit_handle, param_list->repo->handle, &oid);

3 data->commit_list = realloc(data->commit_list, sizeof(git_repo_commit_t) * (data->commit_list_len + 1));

4 git_repo_commit_t *commit = &data->commit_list[data->commit_list_len];

5+ memset(commit, 0, sizeof(git_repo_commit_t));

6 commit->oid = malloc(sizeof(char) * (GIT_OID_HEXSZ + 1));

7 git_oid_tostr(commit->oid, GIT_OID_HEXSZ + 1, &oid);

8 commit->message = strdup(git_commit_message(commit_handle));

9+ commit->summary = strdup(git_commit_summary(commit_handle));

10+ const char *body = git_commit_body(commit_handle);

11+ if (body) commit->body = strdup(body);

12 commit->author_name = strdup(git_commit_author(commit_handle)->name);

13 commit->author_email = strdup(git_commit_author(commit_handle)->email);

14 commit->time = (time_t) git_commit_time(commit_handle);

15@@ -56,6 +60,8 @@ static void cleanup(orb_module_t *self) {

16 git_repo_commit_t *commit = &data->commit_list[i];

17 free(commit->oid);

18 free(commit->message);

19+ free(commit->summary);

20+ if (commit->body) free(commit->body);

21 free(commit->author_name);

22 free(commit->author_email);

23 }

24

25

diff --git a/templ/git_list.html b/templ/git_list.html

index 9d46f81..e658431 100644

--- a/templ/git_list.html

+++ b/templ/git_list.html

1@@ -22,7 +22,7 @@

2 % if (repo_meta->is_archive) { %<span>(archive)</span>% } %

3 % if (repo_meta->is_fork) { %<span>(fork)</span>% } %

4 </span>

5- <span class="col col--description">% STRING(repo_meta->description) %</span>

6+ <span class="col col--description" title="% STRING(repo_meta->description) %">% STRING(repo_meta->description) %</span>

7 <span class="col col--owner">% STRING(repo_meta->owner) %</span>

8 </li>

9 % } %

10

11

diff --git a/templ/git_repo_commit.html b/templ/git_repo_commit.html

index 3ac9e24..f37fe7c 100644

--- a/templ/git_repo_commit.html

+++ b/templ/git_repo_commit.html

1@@ -11,16 +11,20 @@

2 char *diff;

3 ) %

4

5-<p>

6- <h3>% STRING(ctx->commit->message) %</h3>

7- <span>commit: <a href="/git/% STRING(ctx->repo->meta.name) %/commit?oid=% STRING(ctx->commit->oid) %">% STRING(ctx->commit->oid) %</a></span><br/>

8+<div class="commit--meta">

9+ <h3 class="commit--summary">% STRING(ctx->commit->summary) %</h3>

10+ % if (ctx->commit->body) { %

11+ <pre class="commit--body">% STRING(ctx->commit->body) %</pre>

12+ % } %

13+ <hr/>

14+ <span class="commit--info">commit: <a href="/git/% STRING(ctx->repo->meta.name) %/commit?oid=% STRING(ctx->commit->oid) %">% STRING(ctx->commit->oid) %</a></span><br/>

15 % if (ctx->parent_commit_oid) { %

16- <span>parent: <a href="/git/% STRING(ctx->repo->meta.name) %/commit?oid=% STRING(ctx->parent_commit_oid) %">% STRING(ctx->parent_commit_oid) %</a></span><br/>

17+ <span class="commit--info">parent: <a href="/git/% STRING(ctx->repo->meta.name) %/commit?oid=% STRING(ctx->parent_commit_oid) %">% STRING(ctx->parent_commit_oid) %</a></span><br/>

18 % } %

19- <span>author: % STRING(ctx->commit->author_name) % &lt;<a href="mailto:% STRING(ctx->commit->author_email) %">% STRING(ctx->commit->author_email) %</a>&gt;</span><br/>

20- <span>time: % FORMAT_TIME(&ctx->commit->time, "%%Y-%%m-%%d %%H:%%M") %</span></br>

21-</p>

22-<div class="commit-diff">

23+ <span class="commit--info">author: % STRING(ctx->commit->author_name) % &lt;<a href="mailto:% STRING(ctx->commit->author_email) %">% STRING(ctx->commit->author_email) %</a>&gt;</span><br/>

24+ <span class="commit--info">time: % FORMAT_TIME(&ctx->commit->time, "%%Y-%%m-%%d %%H:%%M") %</span></br>

25+</div>

26+<div class="commit--diff">

27 % if (ctx->diff) { %

28 <pre class="diff--meta">%

29

30

31

diff --git a/templ/git_repo_log.html b/templ/git_repo_log.html

index 19d3593..7fbeafe 100644

--- a/templ/git_repo_log.html

+++ b/templ/git_repo_log.html

1@@ -21,9 +21,9 @@

2 git_repo_commit_t *commit = &ctx->commit_list[i];

3 %

4 <li class="row">

5- <span class="col col--oid">% PRINTF("%%.7s", commit->oid) %</span>

6+ <span class="col col--oid" title="% STRING(commit->oid) %">% PRINTF("%%.7s", commit->oid) %</span>

7 <span class="col col--time">% FORMAT_TIME(&commit->time, "%%Y-%%m-%%d") %</span>

8- <span class="col col--message"><a href="/git/% STRING(ctx->repo->meta.name) %/commit?% if (ctx->repo->ref) { %ref=% STRING(ctx->repo->ref->oid) %&% } %oid=% STRING(commit->oid) %">% STRING(commit->message) %</a></span>

9+ <span class="col col--message" title="% STRING(commit->message) %"><a href="/git/% STRING(ctx->repo->meta.name) %/commit?% if (ctx->repo->ref) { %ref=% STRING(ctx->repo->ref->oid) %&% } %oid=% STRING(commit->oid) %">% STRING(commit->summary) %</a></span>

10 <span class="col col--author">% STRING(commit->author_name) %</span>

11 </li>

12 % } %

13

14

diff --git a/templ/git_repo_refs.html b/templ/git_repo_refs.html

index 93e6fc6..74a03fb 100644

--- a/templ/git_repo_refs.html

+++ b/templ/git_repo_refs.html

1@@ -18,7 +18,7 @@

2 git_repo_ref_t *ref = &ctx->ref_list[i];

3 %

4 <li class="row">

5- <span class="col col--oid">% PRINTF("%%.7s", ref->oid) %</span>

6+ <span class="col col--oid" title="% STRING(ref->oid) %">% PRINTF("%%.7s", ref->oid) %</span>

7 <span class="col col--name"><a href="/git/% STRING(ctx->repo->meta.name) if (strcmp(ctx->repo->ref_head->oid, ref->oid) != 0) { %?ref=% STRING(ref->oid) } %">% if (ref->type) { STRING(ref->type) %:% } STRING(ref->name) %</a></span>

8 </li>

9 % } %

10

11

diff --git a/templ/git_repo_tree.html b/templ/git_repo_tree.html

index a1c2cc8..384fd7c 100644

--- a/templ/git_repo_tree.html

+++ b/templ/git_repo_tree.html

1@@ -14,13 +14,13 @@

2 <span class="col col--oid">OID</span>

3 <span class="col col--mode">MODE</span>

4 <span class="col col--name">NAME</span>

5- <span class="col col--size">SIZE</span>

6+ <span class="col col--size">SIZE (bytes)</span>

7 </li>

8 % for (size_t i = 0; i < ctx->entry_list_len; i++) {

9 git_repo_tree_entry_t *entry = &ctx->entry_list[i];

10 %

11 <li class="row">

12- <span class="col col--oid">% PRINTF("%%.7s", entry->oid) %</span>

13+ <span class="col col--oid" title="% STRING(entry->oid) %">% PRINTF("%%.7s", entry->oid) %</span>

14 <span class="col col--mode">% STRING(entry->mode) %</span>

15 <span class="col col--name"><a href="/git/% STRING(ctx->repo->meta.name) %/blob?% if (ctx->repo->ref) { %ref=% STRING(ctx->repo->ref->oid) %&% } %oid=% STRING(entry->oid) %">% STRING(entry->name) %</a></span>

16 <span class="col col--size">% NUMBER(entry->size) %</span>

17

18