author | Lars Hjemli <hjemli@gmail.com> | 2008-02-16 12:56:09 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-02-16 12:56:09 (UTC) |
commit | d1f3bbe9d22029f45a77bb938c176ccc0c827d46 (patch) (unidiff) | |
tree | 3f1741c012763cbc5485f31377abdd9241fbac6b /ui-tree.c | |
parent | b228d4ff82a65fdcd4a7364759fe36a0bdda5978 (diff) | |
download | cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.zip cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.tar.gz cgit-d1f3bbe9d22029f45a77bb938c176ccc0c827d46.tar.bz2 |
Move cgit_repo into cgit_context
This removes the global variable which is used to keep track of the
currently selected repository, and adds a new variable in the cgit_context
structure.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -62,49 +62,49 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
62 | const char *pathname, unsigned int mode, int stage) | 62 | const char *pathname, unsigned int mode, int stage) |
63 | { | 63 | { |
64 | char *name; | 64 | char *name; |
65 | char *fullpath; | 65 | char *fullpath; |
66 | enum object_type type; | 66 | enum object_type type; |
67 | unsigned long size = 0; | 67 | unsigned long size = 0; |
68 | 68 | ||
69 | name = xstrdup(pathname); | 69 | name = xstrdup(pathname); |
70 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", | 70 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", |
71 | ctx.qry.path ? "/" : "", name); | 71 | ctx.qry.path ? "/" : "", name); |
72 | 72 | ||
73 | type = sha1_object_info(sha1, &size); | 73 | type = sha1_object_info(sha1, &size); |
74 | if (type == OBJ_BAD && !S_ISGITLINK(mode)) { | 74 | if (type == OBJ_BAD && !S_ISGITLINK(mode)) { |
75 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", | 75 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
76 | name, | 76 | name, |
77 | sha1_to_hex(sha1)); | 77 | sha1_to_hex(sha1)); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | html("<tr><td class='ls-mode'>"); | 81 | html("<tr><td class='ls-mode'>"); |
82 | html_filemode(mode); | 82 | html_filemode(mode); |
83 | html("</td><td>"); | 83 | html("</td><td>"); |
84 | if (S_ISGITLINK(mode)) { | 84 | if (S_ISGITLINK(mode)) { |
85 | htmlf("<a class='ls-mod' href='"); | 85 | htmlf("<a class='ls-mod' href='"); |
86 | html_attr(fmt(cgit_repo->module_link, | 86 | html_attr(fmt(ctx.repo->module_link, |
87 | name, | 87 | name, |
88 | sha1_to_hex(sha1))); | 88 | sha1_to_hex(sha1))); |
89 | html("'>"); | 89 | html("'>"); |
90 | html_txt(name); | 90 | html_txt(name); |
91 | html("</a>"); | 91 | html("</a>"); |
92 | } else if (S_ISDIR(mode)) { | 92 | } else if (S_ISDIR(mode)) { |
93 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, | 93 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, |
94 | curr_rev, fullpath); | 94 | curr_rev, fullpath); |
95 | } else { | 95 | } else { |
96 | cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, | 96 | cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, |
97 | curr_rev, fullpath); | 97 | curr_rev, fullpath); |
98 | } | 98 | } |
99 | htmlf("</td><td class='ls-size'>%li</td>", size); | 99 | htmlf("</td><td class='ls-size'>%li</td>", size); |
100 | 100 | ||
101 | html("<td>"); | 101 | html("<td>"); |
102 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, | 102 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, |
103 | fullpath, 0, NULL, NULL); | 103 | fullpath, 0, NULL, NULL); |
104 | html("</td></tr>\n"); | 104 | html("</td></tr>\n"); |
105 | free(name); | 105 | free(name); |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | static void ls_head() | 109 | static void ls_head() |
110 | { | 110 | { |