]> 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: Make check() even more pedantic
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 7fa3180f56259753a4292b4d8846e60eeb901684..300f0887e58b8b0e72fde164bdae4d22c2f2fcc5 100755 (executable)
--- 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";
 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';