[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-vc-dwim] [PATCH] vc-dwim: fix SCALAR(0x...) log pollution
From: |
Jim Meyering |
Subject: |
[Bug-vc-dwim] [PATCH] vc-dwim: fix SCALAR(0x...) log pollution |
Date: |
Tue, 11 Aug 2009 23:33:51 +0200 |
This one has been nagging for some time.
Today, I finally found the time to construct a test case and fix it.
[just removed the FIXME below, too, in a follow-up commit]
>From d29cc8f43478dc81f57be8e172292c34dd10e480 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Aug 2009 20:57:07 +0200
Subject: [PATCH] vc-dwim: fix SCALAR(0x...) log pollution
Under rather unusual circumstances, vc-dwim would erroneously
insert an extra "SCALAR(0x...)" line in a commit log.
* vc-dwim.pl (main): Do not record any references in @log_msg_lines.
* tests/scalar: New test for the above.
* tests/Makefile.am (TESTS): Add scalar.
---
ChangeLog | 10 +++++++++
tests/Makefile.am | 1 +
tests/scalar | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
vc-dwim.pl | 6 +---
4 files changed, 70 insertions(+), 4 deletions(-)
create mode 100755 tests/scalar
diff --git a/ChangeLog b/ChangeLog
index d2a3e67..9cdb910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-11 Jim Meyering <address@hidden>
+
+ vc-dwim: fix SCALAR(0x...) log pollution
+ Under rather unusual circumstances, vc-dwim would erroneously
+ insert an extra "SCALAR(0x...)" line in a commit log.
+ * vc-dwim.pl (main): Do not record any references in @log_msg_lines.
+
+ * tests/scalar: New test for the above.
+ * tests/Makefile.am (TESTS): Add scalar.
+
2009-07-11 Ralf Wildenhues <address@hidden>
Fix testsuite setup error.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e87e0ca..c1e57ad 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,6 +14,7 @@ TESTS = \
cl-other-user \
no-vc \
symlinked-changelog \
+ scalar \
two-vc \
cl-but-no-diff \
leading-comment \
diff --git a/tests/scalar b/tests/scalar
new file mode 100755
index 0000000..3af7e91
--- /dev/null
+++ b/tests/scalar
@@ -0,0 +1,57 @@
+#!/bin/sh
+# test for a bug in the symlinked ChangeLog feature.
+# Before FIXME vc-dwim would insert a line like SCALAR(0xb1d360)
+# in the commit log.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ vc-dwim --version
+fi
+
+. $srcdir/trap-setup
+
+require_git_
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+touch f || framework_failure=1
+( git init && git add . && git commit -m m . ) || framework_failure=1
+mkdir .git/c || framework_failure=1
+cat <<EOF >> .git/c/ChangeLog || framework_failure=1
+2006-09-04 Jo R. User <address@hidden>
+
+ sum:X
+ * f: ..
+
+ sum:0
+ * f: other.
+
+2006-09-03 Jo R. User <address@hidden>
+
+ sum:g
+ * g: Y.
+EOF
+ln -s .git/c/ChangeLog . || framework_failure=1
+( cd .git/c && git init && git add . && git commit -m m . ) ||
framework_failure=1
+
+perl -pi -e '/X/ and print "\t* f: new\n";' \
+ -e '/Y/ and print "\tgah\n"' .git/c/ChangeLog || framework_failure=1
+echo >> f || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
+fail=0
+
+vc-dwim --c || fail=1
+
+git log -1 --pretty=format:%b > log || fail=1
+
+# Before the fix, this would contain SCALAR(0x......)
+test "$(cat log)" = gah || fail=1
+
+Exit $fail
diff --git a/vc-dwim.pl b/vc-dwim.pl
index 7e6e3f7..9803659 100755
--- a/vc-dwim.pl
+++ b/vc-dwim.pl
@@ -1010,7 +1010,7 @@ sub main
}
continue
{
- push @log_msg_lines, $line;
+ push @log_msg_lines, $line if ! ref $line;
}
}
@@ -1030,15 +1030,13 @@ sub main
$fail
and exit 1;
- my @non_ref_log_msg_lines = grep { ! ref $_ } @log_msg_lines;
-
# Collect diffs of non-ChangeLog files.
# But don't print diff output unless we're sure everything is ok.
my $diff_lines = get_diffs $vc, address@hidden;
cross_check $vc, address@hidden, $diff_lines;
- print join ("\n", @non_ref_log_msg_lines), "\n";
+ print join ("\n", @log_msg_lines), "\n";
print join ("\n", @$diff_lines), "\n";
# FIXME: add an option to take ChangeLog-style lines from a file,
--
1.6.4.337.g5420e
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-vc-dwim] [PATCH] vc-dwim: fix SCALAR(0x...) log pollution,
Jim Meyering <=