From 1e368681bd8c35202b91f8998e07d8bbb3de6c7c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 10 Sep 2008 19:32:44 +0200 Subject: [PATCH 1/5] t7501: always use test_cmp instead of diff This should make the output more readable (by default using diff -u) when some tests fail. Also changed the diff order from "current expected" to "expected current". Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 469bff8873..63bfc6d8b3 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -141,7 +141,7 @@ EOF test_expect_success \ 'validate git rev-list output.' \ - 'diff current expected' + 'test_cmp expected current' test_expect_success 'partial commit that involves removal (1)' ' @@ -151,7 +151,7 @@ test_expect_success 'partial commit that involves removal (1)' ' git commit -m "Partial: add elif" elif && git diff-tree --name-status HEAD^ HEAD >current && echo "A elif" >expected && - diff expected current + test_cmp expected current ' @@ -160,7 +160,7 @@ test_expect_success 'partial commit that involves removal (2)' ' git commit -m "Partial: remove file" file && git diff-tree --name-status HEAD^ HEAD >current && echo "D file" >expected && - diff expected current + test_cmp expected current ' @@ -171,7 +171,7 @@ test_expect_success 'partial commit that involves removal (3)' ' git commit -m "Partial: modify elif" elif && git diff-tree --name-status HEAD^ HEAD >current && echo "M elif" >expected && - diff expected current + test_cmp expected current ' @@ -187,7 +187,7 @@ test_expect_success 'amend commit to fix author' ' expected && git commit --amend --author="$author" && git cat-file -p HEAD > current && - diff expected current + test_cmp expected current ' @@ -256,7 +256,7 @@ test_expect_success 'amend commit to fix author' ' expected && git commit --amend --author="$author" && git cat-file -p HEAD > current && - diff expected current + test_cmp expected current ' From 836ff95df6de9924cf8cf23515e3779a67a6bdec Mon Sep 17 00:00:00 2001 From: Marcus Griep Date: Mon, 8 Sep 2008 12:53:01 -0400 Subject: [PATCH 2/5] Git.pm: Use File::Temp->tempfile instead of ->new Perl 5.8.0 ships with File::Temp 0.13, which does not have the new() interface introduced in 0.14, as pointed out by Tom G. Christensen. This modifies Git.pm to use the more established tempfile() interface and updates 'git svn' to match. Signed-off-by: Marcus Griep Acked-by: Eric Wong Tested-by: Tom G. Christensen Signed-off-by: Junio C Hamano --- git-svn.perl | 4 ++-- perl/Git.pm | 42 ++++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 7a1d26db8b..95c6c85bbd 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3284,7 +3284,7 @@ sub close_file { my $out = syswrite($tmp_fh, $str, $res); defined($out) && $out == $res or croak("write ", - $tmp_fh->filename, + Git::temp_path($tmp_fh), ": $!\n"); } defined $res or croak $!; @@ -3295,7 +3295,7 @@ sub close_file { } $hash = $::_repository->hash_and_insert_object( - $fh->filename); + Git::temp_path($fh)); $hash =~ /^[a-f\d]{40}$/ or die "not a sha1: $hash\n"; Git::temp_release($fb->{base}, 1); diff --git a/perl/Git.pm b/perl/Git.pm index 102e6a4ce3..6aab712e6a 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -58,7 +58,7 @@ require Exporter; command_bidi_pipe command_close_bidi_pipe version exec_path hash_object git_cmd_try remote_refs - temp_acquire temp_release temp_reset); + temp_acquire temp_release temp_reset temp_path); =head1 DESCRIPTION @@ -937,7 +937,7 @@ sub _close_cat_blob { { # %TEMP_* Lexical Context -my (%TEMP_LOCKS, %TEMP_FILES); +my (%TEMP_FILEMAP, %TEMP_FILES); =item temp_acquire ( NAME ) @@ -965,7 +965,7 @@ sub temp_acquire { my $temp_fd = _temp_cache($name); - $TEMP_LOCKS{$temp_fd} = 1; + $TEMP_FILES{$temp_fd}{locked} = 1; $temp_fd; } @@ -991,16 +991,16 @@ the same string. sub temp_release { my ($self, $temp_fd, $trunc) = _maybe_self(@_); - if (ref($temp_fd) ne 'File::Temp') { + if (exists $TEMP_FILEMAP{$temp_fd}) { $temp_fd = $TEMP_FILES{$temp_fd}; } - unless ($TEMP_LOCKS{$temp_fd}) { + unless ($TEMP_FILES{$temp_fd}{locked}) { carp "Attempt to release temp file '", $temp_fd, "' that has not been locked"; } temp_reset($temp_fd) if $trunc and $temp_fd->opened; - $TEMP_LOCKS{$temp_fd} = 0; + $TEMP_FILES{$temp_fd}{locked} = 0; undef; } @@ -1009,9 +1009,9 @@ sub _temp_cache { _verify_require(); - my $temp_fd = \$TEMP_FILES{$name}; + my $temp_fd = \$TEMP_FILEMAP{$name}; if (defined $$temp_fd and $$temp_fd->opened) { - if ($TEMP_LOCKS{$$temp_fd}) { + if ($TEMP_FILES{$$temp_fd}{locked}) { throw Error::Simple("Temp file with moniker '", $name, "' already in use"); } @@ -1021,12 +1021,13 @@ sub _temp_cache { carp "Temp file '", $name, "' was closed. Opening replacement."; } - $$temp_fd = File::Temp->new( - TEMPLATE => 'Git_XXXXXX', - DIR => File::Spec->tmpdir + my $fname; + ($$temp_fd, $fname) = File::Temp->tempfile( + 'Git_XXXXXX', UNLINK => 1 ) or throw Error::Simple("couldn't open new temp file"); $$temp_fd->autoflush; binmode $$temp_fd; + $TEMP_FILES{$$temp_fd}{fname} = $fname; } $$temp_fd; } @@ -1053,8 +1054,25 @@ sub temp_reset { or throw Error::Simple("expected file position to be reset"); } +=item temp_path ( NAME ) + +=item temp_path ( FILEHANDLE ) + +Returns the filename associated with the given tempfile. + +=cut + +sub temp_path { + my ($self, $temp_fd) = _maybe_self(@_); + + if (exists $TEMP_FILEMAP{$temp_fd}) { + $temp_fd = $TEMP_FILEMAP{$temp_fd}; + } + $TEMP_FILES{$temp_fd}{fname}; +} + sub END { - unlink values %TEMP_FILES if %TEMP_FILES; + unlink values %TEMP_FILEMAP if %TEMP_FILEMAP; } } # %TEMP_* Lexical Context From 971e628384fea14e9c0bf96e1c69b97df6ec540e Mon Sep 17 00:00:00 2001 From: Marcus Griep Date: Wed, 10 Sep 2008 11:09:46 -0400 Subject: [PATCH 3/5] git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl Signed-off-by: Marcus Griep Signed-off-by: Junio C Hamano --- git-svn.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-svn.perl b/git-svn.perl index 95c6c85bbd..237895c236 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -4383,7 +4383,7 @@ sub config_pager { sub run_pager { return unless -t *STDOUT && defined $pager; - pipe my $rfd, my $wfd or return; + pipe my ($rfd, $wfd) or return; defined(my $pid = fork) or ::fatal "Can't fork: $!"; if (!$pid) { open STDOUT, '>&', $wfd or From 3632cfc2487afc41c7c9e939a9d357daca3e5d67 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Sun, 7 Sep 2008 20:45:37 +0200 Subject: [PATCH 4/5] Use compatibility regex library for OSX/Darwin The standard libc regex library on OSX does not support alternation in POSIX Basic Regular Expression mode. This breaks the diff.funcname functionality on OSX. To fix this, we use the GNU regex library which is already present in the compat/ diretory for the MinGW port. However, simply adding compat/ to the COMPAT_CFLAGS variable causes a conflict between the system fnmatch.h and the one present in compat/. To remedy this, move the regex and fnmatch functionality to their own subdirectories in compat/ so they can be included seperately. Signed-off-by: Arjen Laarhoven Tested-by: Mike Ralphson (AIX) Tested-by: Johannes Sixt (MinGW) Signed-off-by: Junio C Hamano --- Makefile | 6 ++++-- compat/{ => fnmatch}/fnmatch.c | 0 compat/{ => fnmatch}/fnmatch.h | 0 compat/{ => regex}/regex.c | 0 compat/{ => regex}/regex.h | 0 t/t4018-diff-funcname.sh | 6 ++++++ 6 files changed, 10 insertions(+), 2 deletions(-) rename compat/{ => fnmatch}/fnmatch.c (100%) rename compat/{ => fnmatch}/fnmatch.h (100%) rename compat/{ => regex}/regex.c (100%) rename compat/{ => regex}/regex.h (100%) diff --git a/Makefile b/Makefile index 672ea74233..a8b3f9e3c5 100644 --- a/Makefile +++ b/Makefile @@ -626,6 +626,8 @@ ifeq ($(uname_S),Darwin) endif NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease + COMPAT_CFLAGS += -Icompat/regex + COMPAT_OBJS += compat/regex/regex.o endif ifeq ($(uname_S),SunOS) NEEDS_SOCKET = YesPlease @@ -750,10 +752,10 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_SVN_TESTS = YesPlease NO_PERL_MAKEMAKER = YesPlease NO_POSIX_ONLY_PROGRAMS = YesPlease - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" - COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o + COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o EXTLIBS += -lws2_32 X = .exe gitexecdir = ../libexec/git-core diff --git a/compat/fnmatch.c b/compat/fnmatch/fnmatch.c similarity index 100% rename from compat/fnmatch.c rename to compat/fnmatch/fnmatch.c diff --git a/compat/fnmatch.h b/compat/fnmatch/fnmatch.h similarity index 100% rename from compat/fnmatch.h rename to compat/fnmatch/fnmatch.h diff --git a/compat/regex.c b/compat/regex/regex.c similarity index 100% rename from compat/regex.c rename to compat/regex/regex.c diff --git a/compat/regex.h b/compat/regex/regex.h similarity index 100% rename from compat/regex.h rename to compat/regex/regex.h diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 833d6cbcfc..18bcd9713d 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' ' test_must_fail git diff --no-index Beer.java Beer-correct.java ' +test_expect_success 'alternation in pattern' ' + git config diff.java.funcname "^[ ]*\\(\\(public\\|static\\).*\\)$" + git diff --no-index Beer.java Beer-correct.java | + grep "^@@.*@@ public static void main(" +' + test_done From 873358dd2ac3bf2cea9a370d8586378a27a092f2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 10 Sep 2008 12:45:02 -0700 Subject: [PATCH 5/5] Update draft release notes for 1.6.0.2 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.0.2.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/RelNotes-1.6.0.2.txt b/Documentation/RelNotes-1.6.0.2.txt index 6c5446bc07..7a9646fc4f 100644 --- a/Documentation/RelNotes-1.6.0.2.txt +++ b/Documentation/RelNotes-1.6.0.2.txt @@ -17,6 +17,10 @@ Fixes since v1.6.0.1 * Many commands did not use the correct working tree location when used with GIT_WORK_TREE environment settings. +* Some systems needs to use compatibility fnmach and regex libraries + independent from each other; the compat/ area has been reorganized to + allow this. + * "git apply --unidiff-zero" incorrectly applied a -U0 patch that inserts a new line before the second line. @@ -24,9 +28,15 @@ Fixes since v1.6.0.1 * "git blame -c" did not exactly work like "git annotate" when range boundaries are involved. +* "git checkout file" when file is still unmerged checked out contents from + a random high order stage, which was confusing. + * "git clone $there $here/" with extra trailing slashes after explicit local directory name $here did not work as expected. +* "git diff" on tracked contents with CRLF line endings did not drive "less" + intelligently when showing added or removed lines. + * "git diff --dirstat -M" did not add changes in subdirectories up correctly for renamed paths. @@ -42,18 +52,29 @@ Fixes since v1.6.0.1 * "git gui" translation updates and i18n fixes. +* "git index-pack" is more careful against disk corruption while completing + a thin pack. + * "git log -i --grep=pattern" did not ignore case; neither "git log -E --grep=pattern" triggered extended regexp. * "git log --pretty="%ad" --date=short" did not use short format when showing the timestamp. +* "git log --author=author" match incorrectly matched with the + timestamp part of "author " line in commit objects. + +* "git log -F --author=author" did not work at all. + * Build procedure for "git shell" that used stub versions of some functions and globals was not understood by linkers on some platforms. * "git stash" was fooled by a stat-dirty but otherwise unmodified paths and refused to work until the user refreshed the index. +* "git svn" was broken on Perl before 5.8 with recent fixes to reduce + use of temporary files. + * "git verify-pack -v" did not work correctly when given more than one packfile. @@ -61,7 +82,6 @@ Also contains many documentation updates. -- exec >/var/tmp/1 -O=v1.6.0.1-61-g1eff26c +O=v1.6.0.1-78-g3632cfc echo O=$(git describe maint) git shortlog --no-merges $O..maint -