author | Lars Hjemli <hjemli@gmail.com> | 2007-02-17 12:46:18 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-02-20 23:24:36 (UTC) |
commit | 66cacd053ba900c8eb3b7962027370c84a97f990 (patch) (unidiff) | |
tree | 9ccd8202204bf556a186ba1520a6c767756855bf /ui-diff.c | |
parent | ac70cb4795c90db02917db63d169b0fadfe9fb99 (diff) | |
download | cgit-66cacd053ba900c8eb3b7962027370c84a97f990.zip cgit-66cacd053ba900c8eb3b7962027370c84a97f990.tar.gz cgit-66cacd053ba900c8eb3b7962027370c84a97f990.tar.bz2 |
Layout update
-rw-r--r-- | ui-diff.c | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -79,53 +79,52 @@ int diff_cb(void *priv_, mmbuffer_t *mb, int nbuf) | |||
79 | } | 79 | } |
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int load_mmfile(mmfile_t *file, const unsigned char *sha1) | 83 | static int load_mmfile(mmfile_t *file, const unsigned char *sha1) |
84 | { | 84 | { |
85 | char type[20]; | 85 | char type[20]; |
86 | 86 | ||
87 | if (is_null_sha1(sha1)) { | 87 | if (is_null_sha1(sha1)) { |
88 | file->ptr = (char *)""; | 88 | file->ptr = (char *)""; |
89 | file->size = 0; | 89 | file->size = 0; |
90 | } else { | 90 | } else { |
91 | file->ptr = read_sha1_file(sha1, type, &file->size); | 91 | file->ptr = read_sha1_file(sha1, type, &file->size); |
92 | } | 92 | } |
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
95 | 95 | ||
96 | static void run_diff(const unsigned char *sha1, const unsigned char *sha2) | 96 | static void run_diff(const unsigned char *sha1, const unsigned char *sha2) |
97 | { | 97 | { |
98 | mmfile_t file1, file2; | 98 | mmfile_t file1, file2; |
99 | xpparam_t diff_params; | 99 | xpparam_t diff_params; |
100 | xdemitconf_t emit_params; | 100 | xdemitconf_t emit_params; |
101 | xdemitcb_t emit_cb; | 101 | xdemitcb_t emit_cb; |
102 | 102 | ||
103 | if (!load_mmfile(&file1, sha1) || !load_mmfile(&file2, sha2)) { | 103 | if (!load_mmfile(&file1, sha1) || !load_mmfile(&file2, sha2)) { |
104 | cgit_print_error("Unable to load files for diff"); | 104 | cgit_print_error("Unable to load files for diff"); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | 107 | ||
108 | diff_params.flags = XDF_NEED_MINIMAL; | 108 | diff_params.flags = XDF_NEED_MINIMAL; |
109 | 109 | ||
110 | emit_params.ctxlen = 3; | 110 | emit_params.ctxlen = 3; |
111 | emit_params.flags = XDL_EMIT_FUNCNAMES; | 111 | emit_params.flags = XDL_EMIT_FUNCNAMES; |
112 | 112 | ||
113 | emit_cb.outf = diff_cb; | 113 | emit_cb.outf = diff_cb; |
114 | 114 | ||
115 | xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb); | 115 | xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb); |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | void cgit_print_diff(const char *old_hex, const char *new_hex) | 120 | void cgit_print_diff(const char *old_hex, const char *new_hex) |
121 | { | 121 | { |
122 | unsigned char sha1[20], sha2[20]; | 122 | unsigned char sha1[20], sha2[20]; |
123 | 123 | ||
124 | get_sha1(old_hex, sha1); | 124 | get_sha1(old_hex, sha1); |
125 | get_sha1(new_hex, sha2); | 125 | get_sha1(new_hex, sha2); |
126 | 126 | ||
127 | html("<h2>diff</h2>\n"); | ||
128 | html("<table class='diff'><tr><td>"); | 127 | html("<table class='diff'><tr><td>"); |
129 | run_diff(sha1, sha2); | 128 | run_diff(sha1, sha2); |
130 | html("</td></tr></table>"); | 129 | html("</td></tr></table>"); |
131 | } | 130 | } |