Skip to content

Commit

Permalink
enable specify git binary location along with other options in the co…
Browse files Browse the repository at this point in the history
…nstructor

Conflicts:
	src/git.coffee

cc #49
cc sentientwaffle/gift#32
  • Loading branch information
eytan authored and notatestuser committed Dec 26, 2014
1 parent 93e180f commit fdc8399
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/git.coffee
Original file line number Diff line number Diff line change
@@ -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) ->
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/repo.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fdc8399

Please sign in to comment.