Skip to content

Commit 323b8b4

Browse files
committed
Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp
Conflicts: src/trap.c sys/winnt/Makefile.msc
2 parents 2d6f968 + d3205d9 commit 323b8b4

99 files changed

Lines changed: 4010 additions & 2028 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
*.[ch] filter=NHtext merge=NHsubst
2-
*.sh filter=NHtext merge=NHsubst
1+
*.[ch] NHSUBST
2+
*.sh NHSUBST
33
* text=auto
44
*.hqx -text
55
*.sln -text

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ core
3232
Makefile
3333

3434
# Win32-specific ignores
35+
Debug/
36+
Release/
3537
binary/
3638
build/
3739
ipch/

DEVEL/.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Developer.txt filter=NHtext merge=NHsubst
2-
nhgitset.pl filter=NHtext merge=NHsubst
3-
hookdir/* filter=NHtext merge=NHsubst
1+
Developer.txt NHSUBST
2+
nhgitset.pl NHSUBST
3+
hooksdir/* NHSUBST
44
* text=auto

DEVEL/Developer.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ B. Enabling variable expansion
136136
Variable expansion is controlled by the .gitattributes file.
137137

138138
To enable variable expansion:
139-
pattern filter=NHtext merge=NHsubst
139+
pattern NHSUBST
140140
To disable variable expansion:
141-
pattern -filter
141+
pattern -NHSUBST
142142

143143
More information: "git help gitattributes"
144144

@@ -147,8 +147,8 @@ C. Oddities
147147
instead of "git add" or "git commit." Nothing terrible will happen if you
148148
use the wrong one, but the values will not be updated.
149149

150-
Due to the way this abuses git filters, the updated values are not visible
151-
in your working tree.
150+
Variable expansion modifies the files in the work tree - your editor or
151+
IDE may or may not be happy with this.
152152

153153
D. Using your own hooks
154154
You can use your own hooks - put them in .git/hooks as usual BUT name them

DEVEL/git_recipes.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,22 @@ you specify:
3232
-pretty=one: format output as a single line for each entry
3333
(branch): show the commits from (branch) instead of the current one
3434

35+
[*] git log --pretty=one --decorate --graph --all
36+
37+
(This is best explained by executing and looking at the output.)
38+
3539

3640
[*] git add (filename)
3741
[*] git nhadd (filename)
3842

3943
Adds the changes you've made in (filename) to the pre-commit staging area.
4044
(also referred to as the 'index')
45+
OR
46+
Make a new file be tracked by git.
4147

4248
"nhadd" is the preferred syntax and will automatically update the source file
43-
headers with the latest date, branch, and version.
49+
headers with the latest date, branch, and version. See Developer.txt for
50+
details.
4451

4552

4653
[*] git commit [-a] [-m "text"]
@@ -53,7 +60,8 @@ Including -m will use "text" as the commit message instead of opening an
5360
editor window for you to create one.
5461

5562
"nhcommit" is the preferred syntax and will automatically update the source file
56-
headers with the latest date, branch, and version.
63+
headers with the latest date, branch, and version. See Developer.txt for
64+
details.
5765

5866

5967
[*] git push [--all] [-u origin (branch)]
@@ -101,10 +109,10 @@ the prior commit.
101109
[/end area-of-concern]
102110

103111

104-
[*] git fetch [-a]
112+
[*] git fetch [--all]
105113

106114
Retrieve commits from the remote repository to your machine.
107-
Including -a will get commits for all branches.
115+
Including --all will get commits for all branches.
108116
Does NOT merge them into your local repository.
109117

110118

DEVEL/hooksdir/NHadd

100755100644
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/usr/bin/perl
22
# wrapper for nhadd and nhcommit aliases
3-
# $NHDT-Date$
3+
# $NHDT-Date: 1427408239 2015/03/26 22:17:19 $
44

55
%ok = map { $_ => 1 } ('add', 'commit');
66

77
die "Bad subcommand '$ARGV[0]'" unless $ok{$ARGV[0]};
88

9+
# we won't fail on a failure, so just system()
10+
$rv = system('.git/hooks/nhsub',"--$ARGV[0]",@ARGV[1..$#ARGV]);
11+
if($rv){
12+
print "warning: nhsub failed: $rv $!\n";
13+
}
14+
915
if(length $ENV{GIT_PREFIX}){
1016
chdir($ENV{GIT_PREFIX}) or die "Can't chdir $ENV{GIT_PREFIX}: $!";
1117
}
1218

13-
$ENV{NHMODE} = 1;
1419
exec "git", @ARGV or die "Can't exec git: $!";

DEVEL/hooksdir/NHsubst

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ my $rawin = 0; # feed diff to stdin for testing (do NOT set $debug=1)
1313
# this first block because it's expensive and dumpfile() hangs with $rawin.
1414
my $sink = ($^O eq "MSWin32") ? "NUL" : "/dev/null";
1515
my $dbgfile = ($^O eq "MSWin32") ? "$ENV{TEMP}.$$" : "/tmp/trace.$$";
16-
open TRACE, ">>", ($debug==0)? $sink : $dbgfile;
16+
open TRACE, ">>", $rawin?"/dev/tty":(($debug==0)? $sink : $dbgfile);
17+
print TRACE "TEST TRACE\n";
1718
if($debug){
1819
print TRACE "START CLIENT ARGV:\n";
1920
print TRACE "[0] $0\n";
@@ -233,7 +234,7 @@ sub merge_one_line_maybe {
233234
$theirval = $1;
234235
}
235236
}
236-
237+
print TRACE "MID: $ourstype/$oursval $theirtype/$theirval\n";
237238
# are we done?
238239
if(pos($ours)==length $ours && pos($theirs) == length $theirs){
239240
$more = 0;
@@ -245,6 +246,12 @@ sub merge_one_line_maybe {
245246
# now see if ours and their match or can be resolved
246247
# text
247248
if($ourstype == 3 && $theirtype == 3){
249+
#mismatch is \s vs \s\s - where is this coming from?
250+
# HACK - hopefully temporary
251+
if($oursval =~ m/^\s+$/ && $theirval =~ m/^\s+$/){
252+
$out .= $oursval;
253+
next;
254+
}
248255
if($oursval eq $theirval){
249256
$out .= $oursval;
250257
next;
@@ -273,6 +280,7 @@ sub merge_one_line_maybe {
273280
# return undef if we can't merge the values; $NAME: VALUE $ or $NAME$ (as appropriate) if we can.
274281
sub merge_one_var_maybe {
275282
my($varname, $oursval, $theirval) = @_;
283+
print TRACE "MVM: -$varname-$oursval-$theirval-\n";
276284
my $resolvedas;
277285
{
278286
no strict;
@@ -309,12 +317,28 @@ sub Date {
309317

310318
sub Branch {
311319
my($PREFIX, $varname, $mine, $theirs) = @_;
312-
return "\$$PREFIX-$varname: $mine \$";
320+
$mine =~ s/^\s+//; $mine =~ s/\s+$//;
321+
$theirs =~ s/^\s+//; $theirs =~ s/\s+$//;
322+
return "\$$PREFIX-$varname: $mine \$" if(length $mine);
323+
return "\$$PREFIX-$varname: $theirs \$" if(length $theirs);
324+
return "\$$PREFIX-$varname\$" if(length $theirs);
313325
}
314326

315327
sub Revision {
316328
my($PREFIX, $varname, $mine, $theirs) = @_;
317-
return "\$$PREFIX-$varname: $mine \$";
329+
my($m) = ($mine =~ m/1.(\d+)/);
330+
my($t) = ($theirs =~ m/1.(\d+)/);
331+
if($m > 0 && $t > 0){
332+
my $q = ($m > $t) ? $m : $t;
333+
return "\$$PREFIX-$varname: 1.$q \$";
334+
}
335+
if($m > 0){
336+
return "\$$PREFIX-$varname: 1.$m \$";
337+
}
338+
if($t > 0){
339+
return "\$$PREFIX-$varname: 1.$t \$";
340+
}
341+
return "\$$PREFIX-$varname\$";
318342
}
319343
__END__
320344
@@ -364,3 +388,10 @@ $TEST-Branch: mine $
364388
===
365389
$TEST-Branch: theirs $
366390
>>> d3
391+
392+
TEST 8:
393+
<<< d1
394+
/* NetHack 3.5 objnam.c $TEST-Date$ $TEST-Branch$:$TEST-Revision$ */
395+
===
396+
/* NetHack 3.5 objnam.c $TEST-Date: 1426977394 2015/03/21 22:36:34 $ $TEST-Branch: master $:$TEST-Revision: 1.108 $ */
397+
>>> d3

0 commit comments

Comments
 (0)