diff --git a/src/git.coffee b/src/git.coffee index eded6ac..907a444 100644 --- a/src/git.coffee +++ b/src/git.coffee @@ -1,7 +1,8 @@ fs = require 'fs' {exec, spawn} = require 'child_process' -module.exports = Git = (git_dir, dot_git) -> +module.exports = Git = (git_dir, dot_git, git_options) -> + git_options ||= {} dot_git ||= "#{git_dir}/.git" git = (command, options, args, callback) -> @@ -12,7 +13,7 @@ module.exports = Git = (git_dir, dot_git) -> options = options.join " " args ?= [] args = args.join " " if args instanceof Array - bash = "#{Git.bin} #{command} #{options} #{args}" + bash = "#{git_options.bin || Git.bin} #{command} #{options} #{args}" exec bash, {cwd: git_dir, encoding:'binary'}, callback return bash diff --git a/src/index.coffee b/src/index.coffee index 2a61bdf..2991a72 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -4,8 +4,8 @@ Repo = require './repo' # Public: Create a Repo from the given path. # # Returns Repo. -module.exports = Git = (path, bare=false) -> - return new Repo path, bare +module.exports = Git = (path, bare=false, git_options={}) -> + return new Repo path, bare, git_options # Public: Initialize a git repository. diff --git a/src/repo.coffee b/src/repo.coffee index aa992fb..f8edce8 100644 --- a/src/repo.coffee +++ b/src/repo.coffee @@ -11,12 +11,12 @@ Status = require './status' {Ref, Head} = require './ref' module.exports = class Repo - constructor: (@path, @bare) -> + constructor: (@path, @bare, @git_options) -> if @bare @dot_git = @path else @dot_git = "#{@path}/.git" - @git = cmd @path, @dot_git + @git = cmd @path, @dot_git, @git_options # Public: Get the commit identity for this repository.