Skip to content

Commit

Permalink
fix(hooks): first argument missing from GIT_ARGS
Browse files Browse the repository at this point in the history
Closes #82
  • Loading branch information
umbopepato committed Oct 23, 2021
1 parent 9be9ab0 commit 5ecea0e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
19 changes: 19 additions & 0 deletions src/git_hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,22 @@ export async function checkGitHooks(configData: ConfigData) {
// Not a git repo
}
}

export function getScriptPrefix(shell: string): string {
let prefix;
const nameShell = path.basename(shell);
switch (nameShell) {
case "powershell.exe":
prefix = `set GIT_ARGS=("$args");`;
break;
case "fish":
prefix = `set GIT_ARGS $argv;`;
break;
case "bash":
case "zsh":
default:
prefix = `GIT_ARGS=("$0" "$@");`;
break;
}
return prefix;
}
22 changes: 0 additions & 22 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { path } from "../deps.ts";

import { ParallelScripts, Script, ScriptObject } from "./scripts_config.ts";

export type OneOrMore<T> = T | T[];
Expand All @@ -21,26 +19,6 @@ export function makeFileExecutable(filePath: string) {
}
}

export function getScriptPrefix(shell: string): string {
let prefix;
const nameShell = path.basename(shell);
switch (nameShell) {
case "cmd.exe":
case "powershell.exe":
prefix = `set GIT_ARGS=("$args");`;
break;
case "fish":
prefix = `set GIT_ARGS $argv;`;
break;
case "bash":
case "zsh":
default:
prefix = `GIT_ARGS=("$@")`;
break;
}
return prefix;
}

export async function spawn(args: string[], cwd?: string): Promise<string> {
const process = Deno.run({
cmd: args,
Expand Down

0 comments on commit 5ecea0e

Please sign in to comment.