From 3b18a7d8c9608ed0bf13d546018f44e703c62e11 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 7 Sep 2026 20:26:15 +0700 Subject: diff: add a flip link to the refs panel The from and to refs of a diff can only be swapped by editing the url by hand. Add a flip link to the refs panel that opens the same diff with the refs swapped, carrying the current head and options. --- ui-diff.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ui-diff.c') diff --git a/ui-diff.c b/ui-diff.c index 5ee3830..13c1e32 100644 --- a/ui-diff.c +++ b/ui-diff.c @@ -409,6 +409,14 @@ void cgit_print_diff_ctrls(void) html(""); cgit_print_ref_select("id", new_ref); html(""); + + html(""); + cgit_diff_link("flip", "swap from and to", "button", + ctx.qry.head, + is_null_oid(old_rev_oid) ? NULL : + oid_to_hex(old_rev_oid), + new_ref, ctx.qry.path); + html(""); } html(""); html(""); -- cgit v1.3.1+16