MCPcopy
hub / github.com/tailwindlabs/tailwindcss / isRepoDirty

Function isRepoDirty

packages/@tailwindcss-upgrade/src/utils/git.ts:3–17  ·  view source on GitHub ↗
(cwd?: string)

Source from the content-addressed store, hash-verified

1import { execSync } from 'node:child_process'
2
3export function isRepoDirty(cwd?: string) {
4 try {
5 let stdout = execSync('git status --porcelain', { encoding: 'utf-8', cwd })
6 return stdout.trim() !== ''
7 } catch (error) {
8 // If it's not a git repository we don't know if it's dirty or not. But we
9 // also don't want to block the migration. Maybe we can still fail and
10 // require a `--force` flag?
11 if (error?.toString?.().includes('not a git repository')) {
12 return false
13 }
14
15 return true
16 }
17}

Callers 2

runFunction · 0.90
index.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected