This commit is contained in:
2025-07-21 13:42:27 +02:00
parent 740b243356
commit 6c3032e65f

View File

@@ -76,7 +76,11 @@ pub fn (mut gitstructure GitStructure) repo_new_from_gitlocation(git_location Gi
// Commit the staged changes with the provided commit message.
pub fn (mut repo GitRepo) commit(msg string) ! {
repo.status_update()!
if repo.need_commit()! {
if !repo.need_commit()! {
console.print_debug('No changes to commit.')
return
}
if msg == '' {
return error('Commit message is empty.')
}
@@ -89,9 +93,6 @@ pub fn (mut repo GitRepo) commit(msg string) ! {
}
console.print_green('Changes committed successfully.')
repo.load()!
} else {
console.print_debug('No changes to commit.')
}
}
// Push local changes to the remote repository.