From 5fb666791483646656df7498a4caea7dda234e96 Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Fri, 22 Dec 2023 01:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=85=B1=E7=94=A8=E7=9A=84no?= =?UTF-8?q?=5Fchange=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/commit.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/commands/commit.rs b/src/commands/commit.rs index b5e5594..498fe16 100644 --- a/src/commands/commit.rs +++ b/src/commands/commit.rs @@ -3,14 +3,9 @@ use crate::models::{commit, index}; use super::status; -fn no_change() -> bool { - //todo: move to status.rs - let change = status::changes_to_be_committed(); - change.new.len() == 0 && change.modified.len() == 0 && change.deleted.len() == 0 -} pub fn commit(message: String, allow_empty: bool) { let index = index::Index::new(); - if no_change() && !allow_empty { + if !allow_empty && status::changes_to_be_committed().is_empty() { panic!("工作区没有任何改动,不需要提交"); }