about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-diff.c17
-rw-r--r--ui-patch.c19
2 files changed, 22 insertions, 14 deletions
diff --git a/ui-diff.c b/ui-diff.c index c6bad63..3d46da2 100644 --- a/ui-diff.c +++ b/ui-diff.c
@@ -229,11 +229,6 @@ static void header(unsigned char *sha1, char *path1, int mode1,
229 html(" b/"); 229 html(" b/");
230 html_txt(path2); 230 html_txt(path2);
231 231
232 if (is_null_sha1(sha1))
233 path1 = "dev/null";
234 if (is_null_sha1(sha2))
235 path2 = "dev/null";
236
237 if (mode1 == 0) 232 if (mode1 == 0)
238 htmlf("<br/>new file mode %.6o", mode2); 233 htmlf("<br/>new file mode %.6o", mode2);
239 234
@@ -251,13 +246,21 @@ static void header(unsigned char *sha1, char *path1, int mode1,
251 if (mode2 != mode1) 246 if (mode2 != mode1)
252 htmlf("..%.6o", mode2); 247 htmlf("..%.6o", mode2);
253 } 248 }
254 html("<br/>--- a/"); 249 if (is_null_sha1(sha1)) {
250 path1 = "dev/null";
251 html("<br/>--- /");
252 } else
253 html("<br/>--- a/");
255 if (mode1 != 0) 254 if (mode1 != 0)
256 cgit_tree_link(path1, NULL, NULL, ctx.qry.head, 255 cgit_tree_link(path1, NULL, NULL, ctx.qry.head,
257 sha1_to_hex(old_rev_sha1), path1); 256 sha1_to_hex(old_rev_sha1), path1);
258 else 257 else
259 html_txt(path1); 258 html_txt(path1);
260 html("<br/>+++ b/"); 259 if (is_null_sha1(sha2)) {
260 path2 = "dev/null";
261 html("<br/>+++ /");
262 } else
263 html("<br/>+++ b/");
261 if (mode2 != 0) 264 if (mode2 != 0)
262 cgit_tree_link(path2, NULL, NULL, ctx.qry.head, 265 cgit_tree_link(path2, NULL, NULL, ctx.qry.head,
263 sha1_to_hex(new_rev_sha1), path2); 266 sha1_to_hex(new_rev_sha1), path2);
diff --git a/ui-patch.c b/ui-patch.c index ca008f3..79bc509 100644 --- a/ui-patch.c +++ b/ui-patch.c
@@ -28,11 +28,6 @@ static void header(unsigned char *sha1, char *path1, int mode1,
28 subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2)); 28 subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2));
29 htmlf("diff --git a/%s b/%s\n", path1, path2); 29 htmlf("diff --git a/%s b/%s\n", path1, path2);
30 30
31 if (is_null_sha1(sha1))
32 path1 = "dev/null";
33 if (is_null_sha1(sha2))
34 path2 = "dev/null";
35
36 if (mode1 == 0) 31 if (mode1 == 0)
37 htmlf("new file mode %.6o\n", mode2); 32 htmlf("new file mode %.6o\n", mode2);
38 33
@@ -50,8 +45,18 @@ static void header(unsigned char *sha1, char *path1, int mode1,
50 if (mode2 != mode1) 45 if (mode2 != mode1)
51 htmlf("..%.6o", mode2); 46 htmlf("..%.6o", mode2);
52 } 47 }
53 htmlf("\n--- a/%s\n", path1); 48
54 htmlf("+++ b/%s\n", path2); 49 if (is_null_sha1(sha1)) {
50 path1 = "dev/null";
51 htmlf("\n--- /%s\n", path1);
52 } else
53 htmlf("\n--- a/%s\n", path1);
54
55 if (is_null_sha1(sha2)) {
56 path2 = "dev/null";
57 htmlf("+++ /%s\n", path2);
58 } else
59 htmlf("+++ b/%s\n", path2);
55 } 60 }
56} 61}
57 62