fix(git): isolate catalog commands from parent hook environment
This commit is contained in:
1 parent
816e3875c2
commit
98b0009206
4 files changed
+51
-2
No files matched your search
@@ -0,0 +1,19 @@
|
||||
/** Git hooks export paths belonging to their repository. Never reuse them for a different checkout. */
|
||||
export function gitProcessEnvironment(
|
||||
source: NodeJS.ProcessEnv = process.env,
|
||||
): NodeJS.ProcessEnv {
|
||||
const environment = { ...source };
|
||||
for (const name of [
|
||||
"GIT_DIR",
|
||||
"GIT_WORK_TREE",
|
||||
"GIT_INDEX_FILE",
|
||||
"GIT_COMMON_DIR",
|
||||
"GIT_OBJECT_DIRECTORY",
|
||||
"GIT_ALTERNATE_OBJECT_DIRECTORIES",
|
||||
"GIT_PREFIX",
|
||||
"GIT_IMPLICIT_WORK_TREE",
|
||||
"GIT_GRAFT_FILE",
|
||||
])
|
||||
delete environment[name];
|
||||
return environment;
|
||||
}
|
||||
Reference in new issue
Block a user