]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

mr: Check if unsafe ENV variables are set
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 7fa3180f56259753a4292b4d8846e60eeb901684..e0d27a125a003471e8e4ca09b8bbf992ef43559f 100755 (executable)
--- a/mr
+++ b/mr
@@ -1879,6 +1879,13 @@ sub getopts {
        }
 }
 
        }
 }
 
+sub check {
+       my @env = qw(GIT_DIR VCSH_COMMAND);
+       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";
 sub init {
        $SIG{INT}=sub {
                print STDERR "mr: interrupted\n";
@@ -1914,6 +1921,7 @@ sub exitstats {
 
 sub main {
        getopts();
 
 sub main {
        getopts();
+       check();
        init();
        help(@ARGV) if $ARGV[0] eq 'help';
 
        init();
        help(@ARGV) if $ARGV[0] eq 'help';