From a0e60b98ce67ce3cf5c094a2026ca60b4cb0c01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Daron?= Date: Mon, 29 Apr 2024 22:08:35 +0200 Subject: [PATCH] creating new wc commit when @ becomes immuable --- cli/src/cli_util.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 33ee97ab43a..8469e2acf47 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1313,6 +1313,17 @@ See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-workin // update it. } } + + let current_wc = self.repo().view().wc_commit_ids().get(self.workspace_id()); + if let Some(wc) = current_wc { + if self.check_rewritable([wc]).is_err() { + writeln!( + ui.warning_default(), + "@ became immutable. You should create a new commit using jj new." + )?; + // Here i should create a new commit. + } + } let settings = &self.settings; if settings.user_name().is_empty() || settings.user_email().is_empty() { writeln!(