summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 9ec646b..5192800 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -390,49 +390,49 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
390 struct tag *tag; 390 struct tag *tag;
391 struct taginfo *info; 391 struct taginfo *info;
392 struct object *obj; 392 struct object *obj;
393 char buf[256], *url; 393 char buf[256], *url;
394 unsigned char fileid[20]; 394 unsigned char fileid[20];
395 int *header = (int *)cb_data; 395 int *header = (int *)cb_data;
396 396
397 if (prefixcmp(refname, "refs/archives")) 397 if (prefixcmp(refname, "refs/archives"))
398 return 0; 398 return 0;
399 strncpy(buf, refname+14, sizeof(buf)); 399 strncpy(buf, refname+14, sizeof(buf));
400 obj = parse_object(sha1); 400 obj = parse_object(sha1);
401 if (!obj) 401 if (!obj)
402 return 1; 402 return 1;
403 if (obj->type == OBJ_TAG) { 403 if (obj->type == OBJ_TAG) {
404 tag = lookup_tag(sha1); 404 tag = lookup_tag(sha1);
405 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) 405 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag)))
406 return 0; 406 return 0;
407 hashcpy(fileid, tag->tagged->sha1); 407 hashcpy(fileid, tag->tagged->sha1);
408 } else if (obj->type != OBJ_BLOB) { 408 } else if (obj->type != OBJ_BLOB) {
409 return 0; 409 return 0;
410 } else { 410 } else {
411 hashcpy(fileid, sha1); 411 hashcpy(fileid, sha1);
412 } 412 }
413 if (!*header) { 413 if (!*header) {
414 html("<p><h1>download</h1>"); 414 html("<h1>download</h1>\n");
415 *header = 1; 415 *header = 1;
416 } 416 }
417 url = cgit_pageurl(cgit_query_repo, "blob", 417 url = cgit_pageurl(cgit_query_repo, "blob",
418 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid), 418 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
419 buf)); 419 buf));
420 html_link_open(url, NULL, "menu"); 420 html_link_open(url, NULL, "menu");
421 html_txt(strlpart(buf, 20)); 421 html_txt(strlpart(buf, 20));
422 html_link_close(); 422 html_link_close();
423 return 0; 423 return 0;
424} 424}
425 425
426void add_hidden_formfields(int incl_head, int incl_search, char *page) 426void add_hidden_formfields(int incl_head, int incl_search, char *page)
427{ 427{
428 char *url; 428 char *url;
429 429
430 if (!cgit_virtual_root) { 430 if (!cgit_virtual_root) {
431 url = fmt("%s/%s", cgit_query_repo, page); 431 url = fmt("%s/%s", cgit_query_repo, page);
432 if (cgit_query_path) 432 if (cgit_query_path)
433 url = fmt("%s/%s", url, cgit_query_path); 433 url = fmt("%s/%s", url, cgit_query_path);
434 html_hidden("url", url); 434 html_hidden("url", url);
435 } 435 }
436 436
437 if (incl_head && strcmp(cgit_query_head, cgit_repo->defbranch)) 437 if (incl_head && strcmp(cgit_query_head, cgit_repo->defbranch))
438 html_hidden("h", cgit_query_head); 438 html_hidden("h", cgit_query_head);