author | Lars Hjemli <hjemli@gmail.com> | 2007-11-11 12:04:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-11-11 12:04:28 (UTC) |
commit | 2915483ef6c9c29ac1493e6945688bb62f7825b4 (patch) (unidiff) | |
tree | 3ee4afec27ec8cb0ad5e10008f3bd8c994747c39 /ui-diff.c | |
parent | b4649fc90597910c89c3f37a6aec9af54d9f416b (diff) | |
download | cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.zip cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.tar.gz cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.tar.bz2 |
Fix html error detected by test-suite
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-diff.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -96,54 +96,54 @@ static void filepair_cb(struct diff_filepair *pair) | |||
96 | print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); | 96 | print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | if (cgit_diff_files(pair->one->sha1, pair->two->sha1, print_line)) | 99 | if (cgit_diff_files(pair->one->sha1, pair->two->sha1, print_line)) |
100 | cgit_print_error("Error running diff"); | 100 | cgit_print_error("Error running diff"); |
101 | } | 101 | } |
102 | 102 | ||
103 | void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) | 103 | void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) |
104 | { | 104 | { |
105 | enum object_type type; | 105 | enum object_type type; |
106 | unsigned long size; | 106 | unsigned long size; |
107 | struct commit *commit, *commit2; | 107 | struct commit *commit, *commit2; |
108 | 108 | ||
109 | if (!new_rev) | 109 | if (!new_rev) |
110 | new_rev = cgit_query_head; | 110 | new_rev = cgit_query_head; |
111 | get_sha1(new_rev, new_rev_sha1); | 111 | get_sha1(new_rev, new_rev_sha1); |
112 | type = sha1_object_info(new_rev_sha1, &size); | 112 | type = sha1_object_info(new_rev_sha1, &size); |
113 | if (type == OBJ_BAD) { | 113 | if (type == OBJ_BAD) { |
114 | cgit_print_error(fmt("Bad object name: %s", new_rev)); | 114 | cgit_print_error(fmt("Bad object name: %s", new_rev)); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | if (type != OBJ_COMMIT) { | 117 | if (type != OBJ_COMMIT) { |
118 | cgit_print_error(fmt("Unhandled object type: %s", | 118 | cgit_print_error(fmt("Unhandled object type: %s", |
119 | typename(type))); | 119 | typename(type))); |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | 122 | ||
123 | commit = lookup_commit_reference(new_rev_sha1); | 123 | commit = lookup_commit_reference(new_rev_sha1); |
124 | if (!commit || parse_commit(commit)) | 124 | if (!commit || parse_commit(commit)) |
125 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1))); | 125 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1))); |
126 | 126 | ||
127 | if (old_rev) | 127 | if (old_rev) |
128 | get_sha1(old_rev, old_rev_sha1); | 128 | get_sha1(old_rev, old_rev_sha1); |
129 | else if (commit->parents && commit->parents->item) | 129 | else if (commit->parents && commit->parents->item) |
130 | hashcpy(old_rev_sha1, commit->parents->item->object.sha1); | 130 | hashcpy(old_rev_sha1, commit->parents->item->object.sha1); |
131 | else | 131 | else |
132 | hashclr(old_rev_sha1); | 132 | hashclr(old_rev_sha1); |
133 | 133 | ||
134 | if (!is_null_sha1(old_rev_sha1)) { | 134 | if (!is_null_sha1(old_rev_sha1)) { |
135 | type = sha1_object_info(old_rev_sha1, &size); | 135 | type = sha1_object_info(old_rev_sha1, &size); |
136 | if (type == OBJ_BAD) { | 136 | if (type == OBJ_BAD) { |
137 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1))); | 137 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1))); |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | commit2 = lookup_commit_reference(old_rev_sha1); | 140 | commit2 = lookup_commit_reference(old_rev_sha1); |
141 | if (!commit2 || parse_commit(commit2)) | 141 | if (!commit2 || parse_commit(commit2)) |
142 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(old_rev_sha1))); | 142 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(old_rev_sha1))); |
143 | } | 143 | } |
144 | html("<table class='diff'>"); | 144 | html("<table summary='diff' class='diff'>"); |
145 | html("<tr><td>"); | 145 | html("<tr><td>"); |
146 | cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix); | 146 | cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix); |
147 | html("</td></tr>"); | 147 | html("</td></tr>"); |
148 | html("</table>"); | 148 | html("</table>"); |
149 | } | 149 | } |