From 7bb9c147c0e4815ff8ed48dfee1d8267133bbef7 Mon Sep 17 00:00:00 2001
From: Aleksey Kladov <aleksey.kladov@gmail.com>
Date: Mon, 26 Apr 2021 13:41:34 +0300
Subject: [PATCH] internal: make normal release after a poin release less
 annoying

---
 xtask/src/release.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xtask/src/release.rs b/xtask/src/release.rs
index 22bb504674f..f7e6dca4e44 100644
--- a/xtask/src/release.rs
+++ b/xtask/src/release.rs
@@ -10,7 +10,16 @@ impl flags::Release {
             cmd!("git switch release").run()?;
             cmd!("git fetch upstream --tags --force").run()?;
             cmd!("git reset --hard tags/nightly").run()?;
-            cmd!("git push").run()?;
+            // The `release` branch sometimes have a couple of cherry-picked
+            // commits for patch releases. If that's the case, just overwrite
+            // it. As we are setting `release` branch to an up-to-date `nightly`
+            // tag, this shouldn't be problematic in general.
+            //
+            // Note that, as we tag releases, we don't worry about "loosing"
+            // commits -- they'll be kept alive by the tag. More generally, we
+            // don't care about historic releases all that much, it's fine even
+            // to delete old tags.
+            cmd!("git push --force").run()?;
         }
         codegen::docs()?;