summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2007-05-15 22:58:35 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-15 22:58:35 (UTC)
commitf9ff7df613b4ee86fe5914c4ae3400650882c03d (patch) (unidiff)
treec26fde3a4d3485943c275232f18359bebd133f1a /cgit.c
parenta2ddc10479ec463708e422ca5ce7ec02c22a7d02 (diff)
downloadcgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.zip
cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.gz
cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.bz2
Add support for commitdiff via h parameter
The commitdiff will be generated against the first parent, and the diff page also gets the benefit of repo.defbranch. Cleaned up some bad whitespace in cgit.h while at it. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index 9b4815d..3e7e595 100644
--- a/cgit.c
+++ b/cgit.c
@@ -99,49 +99,50 @@ static void cgit_print_repo_page(struct cacheitem *item)
99 99
100 cgit_print_docstart(title, item); 100 cgit_print_docstart(title, item);
101 101
102 102
103 if (!cgit_query_page) { 103 if (!cgit_query_page) {
104 cgit_print_pageheader("summary", show_search); 104 cgit_print_pageheader("summary", show_search);
105 cgit_print_summary(); 105 cgit_print_summary();
106 cgit_print_docend(); 106 cgit_print_docend();
107 return; 107 return;
108 } 108 }
109 109
110 cgit_print_pageheader(cgit_query_page, show_search); 110 cgit_print_pageheader(cgit_query_page, show_search);
111 111
112 if (!strcmp(cgit_query_page, "log")) { 112 if (!strcmp(cgit_query_page, "log")) {
113 cgit_print_log(cgit_query_head, cgit_query_ofs, 113 cgit_print_log(cgit_query_head, cgit_query_ofs,
114 cgit_max_commit_count, cgit_query_search, 114 cgit_max_commit_count, cgit_query_search,
115 cgit_query_path); 115 cgit_query_path);
116 } else if (!strcmp(cgit_query_page, "tree")) { 116 } else if (!strcmp(cgit_query_page, "tree")) {
117 cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path); 117 cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
118 } else if (!strcmp(cgit_query_page, "commit")) { 118 } else if (!strcmp(cgit_query_page, "commit")) {
119 cgit_print_commit(cgit_query_head); 119 cgit_print_commit(cgit_query_head);
120 } else if (!strcmp(cgit_query_page, "view")) { 120 } else if (!strcmp(cgit_query_page, "view")) {
121 cgit_print_view(cgit_query_sha1, cgit_query_path); 121 cgit_print_view(cgit_query_sha1, cgit_query_path);
122 } else if (!strcmp(cgit_query_page, "diff")) { 122 } else if (!strcmp(cgit_query_page, "diff")) {
123 cgit_print_diff(cgit_query_sha1, cgit_query_sha2, cgit_query_path); 123 cgit_print_diff(cgit_query_head, cgit_query_sha1, cgit_query_sha2,
124 cgit_query_path);
124 } else { 125 } else {
125 cgit_print_error("Invalid request"); 126 cgit_print_error("Invalid request");
126 } 127 }
127 cgit_print_docend(); 128 cgit_print_docend();
128} 129}
129 130
130static void cgit_fill_cache(struct cacheitem *item, int use_cache) 131static void cgit_fill_cache(struct cacheitem *item, int use_cache)
131{ 132{
132 static char buf[PATH_MAX]; 133 static char buf[PATH_MAX];
133 int stdout2; 134 int stdout2;
134 135
135 getcwd(buf, sizeof(buf)); 136 getcwd(buf, sizeof(buf));
136 item->st.st_mtime = time(NULL); 137 item->st.st_mtime = time(NULL);
137 138
138 if (use_cache) { 139 if (use_cache) {
139 stdout2 = chk_positive(dup(STDOUT_FILENO), 140 stdout2 = chk_positive(dup(STDOUT_FILENO),
140 "Preserving STDOUT"); 141 "Preserving STDOUT");
141 chk_zero(close(STDOUT_FILENO), "Closing STDOUT"); 142 chk_zero(close(STDOUT_FILENO), "Closing STDOUT");
142 chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)"); 143 chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)");
143 } 144 }
144 145
145 if (cgit_query_repo) 146 if (cgit_query_repo)
146 cgit_print_repo_page(item); 147 cgit_print_repo_page(item);
147 else 148 else