diff --git a/src/gh_changes_since.rs b/src/gh_changes_since.rs index 8f5ee43b..94fde1a6 100644 --- a/src/gh_changes_since.rs +++ b/src/gh_changes_since.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyhow::Context as _; use axum::{ extract::{Path, State}, - response::{IntoResponse, Redirect, Response}, + response::{Html, IntoResponse, Redirect, Response}, }; use hyper::StatusCode; @@ -47,6 +47,20 @@ pub async fn gh_changes_since( let newbase = &pr.base.as_ref().context("no base")?.sha; let newhead = &pr.head.as_ref().context("no head")?.sha; + // Did something changed, no? + if oldhead == newhead { + // Inform the user that nothing changed. + return Ok((StatusCode::OK, Html(format!( +r##" +
Head back to the latest changes here.
+"##))).into_response()); + } + // Has the base changed? if oldbase == newbase { // No, try finding if only new commits have been added by trying to finding the oldhead between oldbase..newhead