Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

SVN & diff & empty files

Help
gregman002
2006-09-15
2013-06-03
  • gregman002
    gregman002
    2006-09-15

    Hi,

    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:

    [snip]
    Index: common/ToxicityReportingSystem/trunk/build/VERSION_1_0_2
    ===================================================================
    Index: common/ToxicityReportingSystem/trunk/build/windows.properties
    ===================================================================
    --- common/ToxicityReportingSystem/trunk/build/windows.properties    (revision 14786)
    +++ common/ToxicityReportingSystem/trunk/build/windows.properties    (revision 14785)
    [snip]

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

    To fix, add these last three lines in SubversionDiff.pm

            # 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) {
                    next;
            }

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

    Greg

     
    • 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-
      Greg

       
    • 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.