X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/06117e40ee17ed362927da9d87ffd7c842ca4468..5783dcdfe0cee8b41082556f8a9ed806a91f94a2:/mr diff --git a/mr b/mr index 7fa3180..300f088 100755 --- a/mr +++ b/mr @@ -1879,6 +1879,13 @@ sub getopts { } } +sub check { + my @env = qw(GIT_DIR GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_WORK_TREE VCSH_COMMAND VCSH_DIRECTORY VCSH_REPO_NAME); + foreach (@env) { + die ("mr: environment variable '$_' is set. You are about to shoot your own foot.\n") if ($ENV{$_}); + } +} + sub init { $SIG{INT}=sub { print STDERR "mr: interrupted\n"; @@ -1914,6 +1921,7 @@ sub exitstats { sub main { getopts(); + check(); init(); help(@ARGV) if $ARGV[0] eq 'help';