Skip to content

Commit 237ab05

Browse files
committed
fix git when using devbox / nix
1 parent 5a9ce66 commit 237ab05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bin/git

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use warnings;
55

66
no warnings 'uninitialized';
77

8+
my ($real_git) = grep { chomp; $_ ne $0 } `which -a git`;
9+
810
$0 = 'git';
911

1012
my %commit = (
@@ -19,7 +21,7 @@ my %checkout = (
1921

2022
# git --git-dir=/home/frew/code/dotfiles/.git --no-pager grep -n --no-color foo
2123

22-
exec '/usr/bin/git' unless @ARGV;
24+
exec $real_git unless @ARGV;
2325

2426
my ($precmd, $command, $args) = _parse_args(@ARGV);
2527
my @args = @$args;
@@ -74,7 +76,7 @@ if ($commit{$command} && exists $args[0] && $args[0] =~ /^-a|^--all/) {
7476
}
7577
}
7678

77-
my @run = ('/usr/bin/git', @$precmd, $command, @args);
79+
my @run = ($real_git, @$precmd, $command, @args);
7880
warn join(' ', @run) . "\n" if $ENV{GIT_WRAPPER_DEBUG};
7981
exec @run;
8082

0 commit comments

Comments
 (0)