Git staging area validation and management utilities for commitizen operations.
Checks if the git staging area is clean (has no staged changes).
/**
* Asynchrounously determines if the staging area is clean
* @param repoPath - Path to the git repository
* @param done - Callback function receiving (error, isClean)
* @param stageAllFiles - Optional flag to check both staged and working directory changes
*/
function isClean(repoPath: string, done: Function, stageAllFiles?: boolean): void;Usage Examples:
import { staging } from 'commitizen';
// Check if staging area is clean
staging.isClean(process.cwd(), (error, clean) => {
if (error) {
console.error('Error checking staging area:', error);
return;
}
if (clean) {
console.log('No staged changes found');
} else {
console.log('Staged changes detected');
}
});
// Check both staged and working directory changes
staging.isClean(process.cwd(), (error, clean) => {
if (error) {
console.error('Error checking repository:', error);
return;
}
if (clean) {
console.log('Repository is completely clean');
} else {
console.log('Changes detected in staging area or working directory');
}
}, true);// Callback signature for isClean function
type StagingCallback = (error: Error | null, isClean: boolean) => void;