]> granicus.if.org Git - nethack/commitdiff
gitinfo.pl: special case code to allow running it from $TOP or DEVEL without
authorkeni <keni@his.com>
Fri, 9 Feb 2018 16:48:04 +0000 (11:48 -0500)
committerkeni <keni@his.com>
Sat, 24 Feb 2018 00:50:15 +0000 (19:50 -0500)
 installing the hooks first
NHgithook.pm: add some warnings if nhversioning can't open files
make sure nhversioning fails before opening gitinfo.txt if it can't get valid
 data

DEVEL/gitinfo.pl
DEVEL/hooksdir/.NHgithook.pm.swp [deleted file]
DEVEL/hooksdir/NHgithook.pm
src/allmain.c
src/version.c
sys/unix/hints/macosx.sh

index b6242897588d3010d735e4328b79860b2ef67f33..d62f1a5881b07dcba4f0bfd3044bbcff8c62fa36 100644 (file)
@@ -20,6 +20,13 @@ BEGIN {
     $gitdir = `git rev-parse --git-dir`;
     chomp $gitdir;
     push(@INC, $gitdir.$PDS."hooks");
+
+       # special case for this script only: allow
+       # it to run from DEVEL or $TOP
+    if (-f "hooksdir/NHgithook.pm" || -f "DEVEL/hooksdir/NHgithook.pm"){
+       push(@INC, "DEVEL/hooksdir");
+    }
+    chdir("..") if (-f "hooksdir/NHgithook.pm");
 }
 use NHgithook;
 
diff --git a/DEVEL/hooksdir/.NHgithook.pm.swp b/DEVEL/hooksdir/.NHgithook.pm.swp
deleted file mode 100644 (file)
index 19e7ec8..0000000
Binary files a/DEVEL/hooksdir/.NHgithook.pm.swp and /dev/null differ
index 1bb92cf7ef3d89158bea6d4e300bf4ed7a771988..0d586cfb77eb93b35d3927c48ebb6a5ec2835977 100644 (file)
@@ -1,7 +1,7 @@
 #
 # NHgithook.pm
 # NetHack Git Hook Module
-# $NHDT-Date$
+# $NHDT-Date: 1519164205 2018/02/20 22:03:25 $
 
 package NHgithook;
 use Cwd;
@@ -72,6 +72,7 @@ sub nhversioning {
     $git_sha =~ s/\s+//g;
     my $git_branch = `git rev-parse --abbrev-ref HEAD`;
     $git_branch =~ s/\s+//g;
+    die "git rev-parse failed" unless(length $git_sha and length $git_branch);
 
     if (open my $fh, '<', 'dat/gitinfo.txt') {
         while(my $line = <$fh>) {
@@ -82,11 +83,15 @@ sub nhversioning {
             }
         }
         close $fh;
+    } else {
+       print "WARNING: Can't find dat directory\n" unless(-d "dat");
     }
     if (open my $fh, '>', 'dat/gitinfo.txt') {
         print $fh 'githash='.$git_sha."\n";
         print $fh 'gitbranch='.$git_branch."\n";
         print "An updated dat/gitinfo.txt was written, githash=".$git_sha."\n";
+    } else {
+       print "WARNING: Unable to open dat/gitinfo.txt: $!\n";
     }
 }
 
index 789c5d48f4488ea151b69a6962840a4ae787e4bc..eab1fce3d0899b0ac3f7fd9368f9be178b62761d 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 allmain.c       $NHDT-Date: 1513130016 2017/12/13 01:53:36 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.81 $ */
+/* NetHack 3.6 allmain.c       $NHDT-Date: 1518193644 2018/02/09 16:27:24 $  $NHDT-Branch: githash $:$NHDT-Revision: 1.86 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -763,7 +763,8 @@ enum earlyarg e_arg;
 {
     int i, idx;
     boolean match = FALSE;
-    char *userea = (char *)0, *dashdash = "";
+    char *userea = (char *)0;
+    const char *dashdash = "";
 
     for (idx = 0; idx < SIZE(earlyopts); idx++) {
         if (earlyopts[idx].e == e_arg)
index 5146656635ae1c3348d7f7d8528bcedd0595ea61..30e4ce75fa817798076622ab018150426932c4ac 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 version.c       $NHDT-Date: 1517140532 2018/01/28 11:55:32 $  $NHDT-Branch: nhmall-githash3 $:$NHDT-Revision: 1.50 $ */
+/* NetHack 3.6 version.c       $NHDT-Date: 1519155525 2018/02/20 19:38:45 $  $NHDT-Branch: githash $:$NHDT-Revision: 1.47 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -46,7 +46,9 @@ char *buf;
 #endif
 
     if (details) {
+#if defined(RUNTIME_PORT_ID) || defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
         int c = 0;
+#endif
 #if defined(RUNTIME_PORT_ID)
         char tmpbuf[BUFSZ];
         char *tmp = (char *)0;
index 93e28ca512eab990f11e8ff747062a16369f5a51..c6cf10c3135fce3f29706438c51f883a7e9d482a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# NetHack 3.6  macosx.sh $NHDT-Date: 1518800856 2018/02/16 17:07:36 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.19 $
+# NetHack 3.6  macosx.sh $NHDT-Date: 1517231957 2018/01/29 13:19:17 $  $NHDT-Branch: githash $:$NHDT-Revision: 1.20 $
 # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
 # NetHack may be freely redistributed.  See license for details.
 #