SVN & diff & empty files

  • gregman002

    gregman002 - 2006-09-15


    I'm not sure if it's a bug in SVN or Codestriker, but the diff parser doesn't like "empty" files (files with 0 bytes). We sometimes have these in directories for various "tag" purposes. The SVN diff looks like this:

    Index: common/ToxicityReportingSystem/trunk/build/VERSION_1_0_2
    Index: common/ToxicityReportingSystem/trunk/build/
    --- common/ToxicityReportingSystem/trunk/build/    (revision 14786)
    +++ common/ToxicityReportingSystem/trunk/build/    (revision 14785)

    One index right after another. VERSION_1_0_2 was the empty file.

    To fix, add these last three lines in

            # The separator line appears next.
            return () unless defined $line && $line =~ /^==========================$
            $line = <$fh>;

            #sometimes our VERSION_X_X_X files throw off svn and it prints out
            #seemingly invalid diff files where there is an Index:, then
            #separator, then another immediate Index:. Handle that case.
            if ($line =~ /^Index: (.*)$/o) {

    Thanks for this software. Still playing around with it, but pretty cool so far.


    • gregman002

      gregman002 - 2006-09-15

      Actually, it's more of a workaround than a fix since the empty file doesn't get added to the review... but it's empty, who cares!

      Thanks again-

    • David Sitsky

      David Sitsky - 2006-09-18

      Thanks - I'll make sure this gets in to 1.9.3, and add it as another test case.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks