You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2018/07/26 16:55:24 UTC

svn commit: r1836746 - /subversion/trunk/subversion/libsvn_client/diff.c

Author: julianfoad
Date: Thu Jul 26 16:55:24 2018
New Revision: 1836746

URL: http://svn.apache.org/viewvc?rev=1836746&view=rev
Log:
Fix double diff headers.

Diff printed the 'Index:' header twice in some cases. One case was if an
external diff showed nothing (e.g. whitespace-only changes with a
suppress-whitespace-diffs option) and a property diff was shown.

* subversion/libsvn_client/diff.c
  (diff_content_changed): Always tell the caller if we printed a header.

Modified:
    subversion/trunk/subversion/libsvn_client/diff.c   (contents, props changed)

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1836746&r1=1836745&r2=1836746&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu Jul 26 16:55:24 2018
@@ -988,6 +988,7 @@ diff_content_changed(svn_boolean_t *wrot
                "Index: %s" APR_EOL_STR
                SVN_DIFF__EQUAL_STRING APR_EOL_STR,
                index_path));
+      *wrote_header = TRUE;
 
       /* ### Do we want to add git diff headers here too? I'd say no. The
        * ### 'Index' and '===' line is something subversion has added. The rest
@@ -1040,10 +1041,6 @@ diff_content_changed(svn_boolean_t *wrot
                                                              scratch_pool),
                                    NULL, NULL, scratch_pool));
         }
-
-      /* If we have printed a diff for this path, mark it as visited. */
-      if (exitcode == 1)
-        *wrote_header = TRUE;
     }
   else   /* use libsvn_diff to generate the diff  */
     {
@@ -1063,6 +1060,7 @@ diff_content_changed(svn_boolean_t *wrot
                    "Index: %s" APR_EOL_STR
                    SVN_DIFF__EQUAL_STRING APR_EOL_STR,
                    index_path));
+          *wrote_header = TRUE;
 
           if (dwi->use_git_diff_format)
             {
@@ -1087,10 +1085,6 @@ diff_content_changed(svn_boolean_t *wrot
                      dwi->options.for_internal->context_size,
                      dwi->cancel_func, dwi->cancel_baton,
                      scratch_pool));
-
-          /* If we have printed a diff for this path, mark it as visited. */
-          if (dwi->use_git_diff_format || svn_diff_contains_diffs(diff))
-            *wrote_header = TRUE;
         }
     }
 

Propchange: subversion/trunk/subversion/libsvn_client/diff.c
------------------------------------------------------------------------------
    p = v