OSDN Git Service

import nethack-3.6.0
[jnethack/source.git] / DEVEL / hooksdir / NHadd
1 #!/usr/bin/perl
2 # wrapper for nhadd and nhcommit aliases
3 # $NHDT-Date: 1427408239 2015/03/26 22:17:19 $
4
5 %ok = map { $_ => 1 } ('add', 'commit');
6
7 die "Bad subcommand '$ARGV[0]'" unless $ok{$ARGV[0]};
8
9 # we won't fail on a failure, so just system()
10 $rv = system('.git/hooks/nhsub',"--$ARGV[0]",@ARGV[1..$#ARGV]);
11 if($rv){
12         print "warning: nhsub failed: $rv $!\n";
13 }
14
15 if(length $ENV{GIT_PREFIX}){
16         chdir($ENV{GIT_PREFIX}) or die "Can't chdir $ENV{GIT_PREFIX}: $!";
17 }
18
19 exec "git", @ARGV or die "Can't exec git: $!";