]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
git: don't issue a warning if rcsinfo is undefined
authorSimon McVittie <smcv@debian.org>
Mon, 26 Dec 2016 18:20:41 +0000 (18:20 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 11 Jan 2017 19:55:09 +0000 (19:55 +0000)
The intention here seems to be that $prev may be undefined, and the
only way that can legitimately happen is for $params{token} to be
undefined too.

(cherry picked from commit fd14cd2a4355684951bb40a1e72e8b0960a674fd)

IkiWiki/Plugin/git.pm

index 95307d1ba620b3f16fb37dbd0f849a21f2c403e1..5ec68b0ce4856f3e0dab7d2b65a00ee73aafd9fe 100644 (file)
@@ -567,7 +567,10 @@ sub rcs_commit (@) {
        # Check to see if the page has been changed by someone else since
        # rcs_prepedit was called.
        my $cur    = git_sha1_file($params{file});
-       my ($prev) = $params{token} =~ /^($sha1_pattern)$/; # untaint
+       my $prev;
+       if (defined $params{token}) {
+               ($prev) = $params{token} =~ /^($sha1_pattern)$/; # untaint
+       }
 
        if (defined $cur && defined $prev && $cur ne $prev) {
                my $conflict = merge_past($prev, $params{file}, $dummy_commit_msg);