INNER CODE UNIT · JavaScript

calculateDiffHash

rancher/terraform-provider-rancher2 · agent-scripts/gating.js:19

export function calculateDiffHash() {
  try {
    const currentBranch = execSync('git branch --show-current', { stdio: ['ignore', 'pipe', 'ignore'] })
      .toString()
      .trim();
    const diffCmdArgs = currentBranch !== 'main' && currentBranch !== '' ? ['diff', 'main'] : ['diff', 'HEAD'];
    const diff = execFileSync('git', diffCmdArgs, { stdio: ['ignore', 'pipe', 'ignore'] }).toString();
    return crypto.createHash('sha256').update(diff).digest('hex');
  } catch (err) {
    console.error('🔒 Hook Debug: calculateDiffHash failed:', err.message || err);
    return null;
  }
}

// Automatically scans the Gemini tmp directories to find the latest active plan file
export function findLatestActivePlan(targetDir) {
  try {
    const activeSessions = fs.readdirSync(targetDir);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…