author | Johan Herland <johan@herland.net> | 2010-06-09 23:09:33 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-06-19 08:40:23 (UTC) |
commit | eac1b675414722ae90df75abc727b2795bc096f0 (patch) (unidiff) | |
tree | 4deb6c0ac103ab2f42750d6c7230d45366eb1732 /ui-shared.c | |
parent | ab42741c49d369e41c1e1915c6c024d79509f7d6 (diff) | |
download | cgit-eac1b675414722ae90df75abc727b2795bc096f0.zip cgit-eac1b675414722ae90df75abc727b2795bc096f0.tar.gz cgit-eac1b675414722ae90df75abc727b2795bc096f0.tar.bz2 |
ui-patch: Apply path limit to generated patch
Also indicate in the comment section of the patch that a path limit was
applied, too easily see when a generated patch is only partial.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index 4fa506f..d5c4c10 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -327,131 +327,131 @@ void cgit_commit_link(char *name, const char *title, const char *class, | |||
327 | name[ctx.cfg.max_msg_len - 2] = '.'; | 327 | name[ctx.cfg.max_msg_len - 2] = '.'; |
328 | name[ctx.cfg.max_msg_len - 3] = '.'; | 328 | name[ctx.cfg.max_msg_len - 3] = '.'; |
329 | } | 329 | } |
330 | 330 | ||
331 | char *delim; | 331 | char *delim; |
332 | 332 | ||
333 | delim = repolink(title, class, "commit", head, NULL); | 333 | delim = repolink(title, class, "commit", head, NULL); |
334 | if (rev && strcmp(rev, ctx.qry.head)) { | 334 | if (rev && strcmp(rev, ctx.qry.head)) { |
335 | html(delim); | 335 | html(delim); |
336 | html("id="); | 336 | html("id="); |
337 | html_url_arg(rev); | 337 | html_url_arg(rev); |
338 | delim = "&"; | 338 | delim = "&"; |
339 | } | 339 | } |
340 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 340 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
341 | html(delim); | 341 | html(delim); |
342 | html("ss=1"); | 342 | html("ss=1"); |
343 | } | 343 | } |
344 | html("'>"); | 344 | html("'>"); |
345 | html_txt(name); | 345 | html_txt(name); |
346 | html("</a>"); | 346 | html("</a>"); |
347 | } | 347 | } |
348 | 348 | ||
349 | void cgit_refs_link(const char *name, const char *title, const char *class, | 349 | void cgit_refs_link(const char *name, const char *title, const char *class, |
350 | const char *head, const char *rev, const char *path) | 350 | const char *head, const char *rev, const char *path) |
351 | { | 351 | { |
352 | reporevlink("refs", name, title, class, head, rev, path); | 352 | reporevlink("refs", name, title, class, head, rev, path); |
353 | } | 353 | } |
354 | 354 | ||
355 | void cgit_snapshot_link(const char *name, const char *title, const char *class, | 355 | void cgit_snapshot_link(const char *name, const char *title, const char *class, |
356 | const char *head, const char *rev, | 356 | const char *head, const char *rev, |
357 | const char *archivename) | 357 | const char *archivename) |
358 | { | 358 | { |
359 | reporevlink("snapshot", name, title, class, head, rev, archivename); | 359 | reporevlink("snapshot", name, title, class, head, rev, archivename); |
360 | } | 360 | } |
361 | 361 | ||
362 | void cgit_diff_link(const char *name, const char *title, const char *class, | 362 | void cgit_diff_link(const char *name, const char *title, const char *class, |
363 | const char *head, const char *new_rev, const char *old_rev, | 363 | const char *head, const char *new_rev, const char *old_rev, |
364 | const char *path, int toggle_ssdiff) | 364 | const char *path, int toggle_ssdiff) |
365 | { | 365 | { |
366 | char *delim; | 366 | char *delim; |
367 | 367 | ||
368 | delim = repolink(title, class, "diff", head, path); | 368 | delim = repolink(title, class, "diff", head, path); |
369 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { | 369 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { |
370 | html(delim); | 370 | html(delim); |
371 | html("id="); | 371 | html("id="); |
372 | html_url_arg(new_rev); | 372 | html_url_arg(new_rev); |
373 | delim = "&"; | 373 | delim = "&"; |
374 | } | 374 | } |
375 | if (old_rev) { | 375 | if (old_rev) { |
376 | html(delim); | 376 | html(delim); |
377 | html("id2="); | 377 | html("id2="); |
378 | html_url_arg(old_rev); | 378 | html_url_arg(old_rev); |
379 | delim = "&"; | 379 | delim = "&"; |
380 | } | 380 | } |
381 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 381 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
382 | html(delim); | 382 | html(delim); |
383 | html("ss=1"); | 383 | html("ss=1"); |
384 | } | 384 | } |
385 | html("'>"); | 385 | html("'>"); |
386 | html_txt(name); | 386 | html_txt(name); |
387 | html("</a>"); | 387 | html("</a>"); |
388 | } | 388 | } |
389 | 389 | ||
390 | void cgit_patch_link(const char *name, const char *title, const char *class, | 390 | void cgit_patch_link(const char *name, const char *title, const char *class, |
391 | const char *head, const char *rev) | 391 | const char *head, const char *rev, const char *path) |
392 | { | 392 | { |
393 | reporevlink("patch", name, title, class, head, rev, NULL); | 393 | reporevlink("patch", name, title, class, head, rev, path); |
394 | } | 394 | } |
395 | 395 | ||
396 | void cgit_stats_link(const char *name, const char *title, const char *class, | 396 | void cgit_stats_link(const char *name, const char *title, const char *class, |
397 | const char *head, const char *path) | 397 | const char *head, const char *path) |
398 | { | 398 | { |
399 | reporevlink("stats", name, title, class, head, NULL, path); | 399 | reporevlink("stats", name, title, class, head, NULL, path); |
400 | } | 400 | } |
401 | 401 | ||
402 | void cgit_self_link(char *name, const char *title, const char *class, | 402 | void cgit_self_link(char *name, const char *title, const char *class, |
403 | struct cgit_context *ctx) | 403 | struct cgit_context *ctx) |
404 | { | 404 | { |
405 | if (!strcmp(ctx->qry.page, "repolist")) | 405 | if (!strcmp(ctx->qry.page, "repolist")) |
406 | return cgit_index_link(name, title, class, ctx->qry.search, | 406 | return cgit_index_link(name, title, class, ctx->qry.search, |
407 | ctx->qry.ofs); | 407 | ctx->qry.ofs); |
408 | else if (!strcmp(ctx->qry.page, "summary")) | 408 | else if (!strcmp(ctx->qry.page, "summary")) |
409 | return cgit_summary_link(name, title, class, ctx->qry.head); | 409 | return cgit_summary_link(name, title, class, ctx->qry.head); |
410 | else if (!strcmp(ctx->qry.page, "tag")) | 410 | else if (!strcmp(ctx->qry.page, "tag")) |
411 | return cgit_tag_link(name, title, class, ctx->qry.head, | 411 | return cgit_tag_link(name, title, class, ctx->qry.head, |
412 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); | 412 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); |
413 | else if (!strcmp(ctx->qry.page, "tree")) | 413 | else if (!strcmp(ctx->qry.page, "tree")) |
414 | return cgit_tree_link(name, title, class, ctx->qry.head, | 414 | return cgit_tree_link(name, title, class, ctx->qry.head, |
415 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 415 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
416 | ctx->qry.path); | 416 | ctx->qry.path); |
417 | else if (!strcmp(ctx->qry.page, "plain")) | 417 | else if (!strcmp(ctx->qry.page, "plain")) |
418 | return cgit_plain_link(name, title, class, ctx->qry.head, | 418 | return cgit_plain_link(name, title, class, ctx->qry.head, |
419 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 419 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
420 | ctx->qry.path); | 420 | ctx->qry.path); |
421 | else if (!strcmp(ctx->qry.page, "log")) | 421 | else if (!strcmp(ctx->qry.page, "log")) |
422 | return cgit_log_link(name, title, class, ctx->qry.head, | 422 | return cgit_log_link(name, title, class, ctx->qry.head, |
423 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 423 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
424 | ctx->qry.path, ctx->qry.ofs, | 424 | ctx->qry.path, ctx->qry.ofs, |
425 | ctx->qry.grep, ctx->qry.search, | 425 | ctx->qry.grep, ctx->qry.search, |
426 | ctx->qry.showmsg); | 426 | ctx->qry.showmsg); |
427 | else if (!strcmp(ctx->qry.page, "commit")) | 427 | else if (!strcmp(ctx->qry.page, "commit")) |
428 | return cgit_commit_link(name, title, class, ctx->qry.head, | 428 | return cgit_commit_link(name, title, class, ctx->qry.head, |
429 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 429 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
430 | ctx->qry.path, 0); | 430 | ctx->qry.path, 0); |
431 | else if (!strcmp(ctx->qry.page, "patch")) | 431 | else if (!strcmp(ctx->qry.page, "patch")) |
432 | return cgit_patch_link(name, title, class, ctx->qry.head, | 432 | return cgit_patch_link(name, title, class, ctx->qry.head, |
433 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 433 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
434 | ctx->qry.path); | 434 | ctx->qry.path); |
435 | else if (!strcmp(ctx->qry.page, "refs")) | 435 | else if (!strcmp(ctx->qry.page, "refs")) |
436 | return cgit_refs_link(name, title, class, ctx->qry.head, | 436 | return cgit_refs_link(name, title, class, ctx->qry.head, |
437 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 437 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
438 | ctx->qry.path); | 438 | ctx->qry.path); |
439 | else if (!strcmp(ctx->qry.page, "snapshot")) | 439 | else if (!strcmp(ctx->qry.page, "snapshot")) |
440 | return cgit_snapshot_link(name, title, class, ctx->qry.head, | 440 | return cgit_snapshot_link(name, title, class, ctx->qry.head, |
441 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 441 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
442 | ctx->qry.path); | 442 | ctx->qry.path); |
443 | else if (!strcmp(ctx->qry.page, "diff")) | 443 | else if (!strcmp(ctx->qry.page, "diff")) |
444 | return cgit_diff_link(name, title, class, ctx->qry.head, | 444 | return cgit_diff_link(name, title, class, ctx->qry.head, |
445 | ctx->qry.sha1, ctx->qry.sha2, | 445 | ctx->qry.sha1, ctx->qry.sha2, |
446 | ctx->qry.path, 0); | 446 | ctx->qry.path, 0); |
447 | else if (!strcmp(ctx->qry.page, "stats")) | 447 | else if (!strcmp(ctx->qry.page, "stats")) |
448 | return cgit_stats_link(name, title, class, ctx->qry.head, | 448 | return cgit_stats_link(name, title, class, ctx->qry.head, |
449 | ctx->qry.path); | 449 | ctx->qry.path); |
450 | 450 | ||
451 | /* Don't known how to make link for this page */ | 451 | /* Don't known how to make link for this page */ |
452 | repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path); | 452 | repolink(title, class, ctx->qry.page, ctx->qry.head, ctx->qry.path); |
453 | html("><!-- cgit_self_link() doesn't know how to make link for page '"); | 453 | html("><!-- cgit_self_link() doesn't know how to make link for page '"); |
454 | html_txt(ctx->qry.page); | 454 | html_txt(ctx->qry.page); |
455 | html("' -->"); | 455 | html("' -->"); |
456 | html_txt(name); | 456 | html_txt(name); |
457 | html("</a>"); | 457 | html("</a>"); |