Skip to content

Commit

Permalink
Git: work more robustly in bare repos.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Jul 2, 2013
1 parent e9efe2b commit 655524d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/git.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function git(d)
isempty(d) && return `git`
work_tree = abspath(d)
git_dir = joinpath(work_tree, dir(work_tree))
`git --work-tree=$work_tree --git-dir=$git_dir`
normpath(work_tree, ".") == normpath(git_dir, ".") ? # is it a bare repo?
`git --git-dir=$work_tree` : `git --work-tree=$work_tree --git-dir=$git_dir`
end

run(args::Cmd; dir="", out=STDOUT) = Base.run(`$(git(dir)) $args` |> out)
Expand Down

0 comments on commit 655524d

Please sign in to comment.