summaryrefslogtreecommitdiffabout
path: root/cmd.c
authorLars Hjemli <hjemli@gmail.com>2008-10-11 18:09:42 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-10-11 18:09:42 (UTC)
commited7ff095ca467cdc4c8a1a1459847d68e50c9b91 (patch) (unidiff)
tree4ed7425520cb76eff0a4e7756869620b2562b6c9 /cmd.c
parent5632ba35d133ee29d46c031cdd4b4a37097b8ca1 (diff)
downloadcgit-ed7ff095ca467cdc4c8a1a1459847d68e50c9b91.zip
cgit-ed7ff095ca467cdc4c8a1a1459847d68e50c9b91.tar.gz
cgit-ed7ff095ca467cdc4c8a1a1459847d68e50c9b91.tar.bz2
ui-snapshot: add dwimmery
When downloading a snapshot, the snapshot name will often contain the repo name combined with a tag. This patch tries to exploit this so that the correct revision is downloaded even if no specific revision is specified. PS: this only occurs if neither 'h' nor 'id' is specified in the query- string. PPS: this also fixes a bug which occurs when trying to download a filename with an unsupported suffix: it used to try to print an error message to the user but failed since it didn't prepare the output properly. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cmd.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd.c b/cmd.c
index a989220..5b3c14c 100644
--- a/cmd.c
+++ b/cmd.c
@@ -85,49 +85,49 @@ static void objects_fn(struct cgit_context *ctx)
85static void repolist_fn(struct cgit_context *ctx) 85static void repolist_fn(struct cgit_context *ctx)
86{ 86{
87 cgit_print_repolist(); 87 cgit_print_repolist();
88} 88}
89 89
90static void patch_fn(struct cgit_context *ctx) 90static void patch_fn(struct cgit_context *ctx)
91{ 91{
92 cgit_print_patch(ctx->qry.sha1); 92 cgit_print_patch(ctx->qry.sha1);
93} 93}
94 94
95static void plain_fn(struct cgit_context *ctx) 95static void plain_fn(struct cgit_context *ctx)
96{ 96{
97 cgit_print_plain(ctx); 97 cgit_print_plain(ctx);
98} 98}
99 99
100static void refs_fn(struct cgit_context *ctx) 100static void refs_fn(struct cgit_context *ctx)
101{ 101{
102 cgit_print_refs(); 102 cgit_print_refs();
103} 103}
104 104
105static void snapshot_fn(struct cgit_context *ctx) 105static void snapshot_fn(struct cgit_context *ctx)
106{ 106{
107 cgit_print_snapshot(ctx->qry.head, ctx->qry.sha1, 107 cgit_print_snapshot(ctx->qry.head, ctx->qry.sha1,
108 cgit_repobasename(ctx->repo->url), ctx->qry.path, 108 cgit_repobasename(ctx->repo->url), ctx->qry.path,
109 ctx->repo->snapshots); 109 ctx->repo->snapshots, ctx->qry.nohead);
110} 110}
111 111
112static void summary_fn(struct cgit_context *ctx) 112static void summary_fn(struct cgit_context *ctx)
113{ 113{
114 cgit_print_summary(); 114 cgit_print_summary();
115} 115}
116 116
117static void tag_fn(struct cgit_context *ctx) 117static void tag_fn(struct cgit_context *ctx)
118{ 118{
119 cgit_print_tag(ctx->qry.sha1); 119 cgit_print_tag(ctx->qry.sha1);
120} 120}
121 121
122static void tree_fn(struct cgit_context *ctx) 122static void tree_fn(struct cgit_context *ctx)
123{ 123{
124 cgit_print_tree(ctx->qry.sha1, ctx->qry.path); 124 cgit_print_tree(ctx->qry.sha1, ctx->qry.path);
125} 125}
126 126
127#define def_cmd(name, want_repo, want_layout) \ 127#define def_cmd(name, want_repo, want_layout) \
128 {#name, name##_fn, want_repo, want_layout} 128 {#name, name##_fn, want_repo, want_layout}
129 129
130struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) 130struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx)
131{ 131{
132 static struct cgit_cmd cmds[] = { 132 static struct cgit_cmd cmds[] = {
133 def_cmd(HEAD, 1, 0), 133 def_cmd(HEAD, 1, 0),