getGitCommit() — react Function Reference
Architecture documentation for the getGitCommit() function in utils.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 16c21054_f727_ea31_fa2a_025ba6e0a6b4["getGitCommit()"] 491fc4c3_2611_502b_1efa_dc935b6722c3["utils.js"] 16c21054_f727_ea31_fa2a_025ba6e0a6b4 -->|defined in| 491fc4c3_2611_502b_1efa_dc935b6722c3 0af1ed3e_03cf_5267_aa34_7fa547c94a45["getVersionString()"] 0af1ed3e_03cf_5267_aa34_7fa547c94a45 -->|calls| 16c21054_f727_ea31_fa2a_025ba6e0a6b4 style 16c21054_f727_ea31_fa2a_025ba6e0a6b4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-extensions/utils.js lines 14–42
function getGitCommit() {
try {
return execSync('git show -s --no-show-signature --format=%h')
.toString()
.trim();
} catch (error) {
// Mozilla runs this command from a git archive.
// In that context, there is no Git context.
// Using the commit hash specified to download-experimental-build.js script as a fallback.
// Try to read from build/COMMIT_SHA file
const commitShaPath = resolve(__dirname, '..', '..', 'build', 'COMMIT_SHA');
if (!existsSync(commitShaPath)) {
throw new Error(
'Could not find build/COMMIT_SHA file. Did you run scripts/release/download-experimental-build.js script?',
);
}
try {
const commitHash = readFileSync(commitShaPath, 'utf8').trim();
// Return short hash (first 7 characters) to match abbreviated commit hash format
return commitHash.slice(0, 7);
} catch (readError) {
throw new Error(
`Failed to read build/COMMIT_SHA file: ${readError.message}`,
);
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getGitCommit() do?
getGitCommit() is a function in the react codebase, defined in packages/react-devtools-extensions/utils.js.
Where is getGitCommit() defined?
getGitCommit() is defined in packages/react-devtools-extensions/utils.js at line 14.
What calls getGitCommit()?
getGitCommit() is called by 1 function(s): getVersionString.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free