]> 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 69c47c637d5724f4e19c40f94e613ab001325715..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";
@@ -1914,6 +1921,7 @@ sub exitstats {
 
 sub main {
        getopts();
+       check();
        init();
        help(@ARGV) if $ARGV[0] eq 'help';
 
@@ -2069,7 +2077,7 @@ fossil_clean =
        else
                fossil clean --force --dotfiles --emptydirs "$@"
        fi
-vcsh_commit = 
+vcsh_clean = 
        if [ "x$1" = x-f ] ; then
                shift
                vcsh run "$MR_REPO" git clean -dx "$@"