[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] prevent diff from extra/waste processing

From: Charles Acknin <charlesacknin_at_gmail.com>
Date: 2007-03-27 22:02:48 CEST

Hi,

I had a little talk with Daniel on #svn-dev about something that
seemed a bit weird in libsvn_wc/diff.c(directory_elements_diff) I
noticed as running within gdb while writing my GSoC proposal: for
single-file diff on WC/WC (e.g. svn diff foo),
directory_elements_diff() would keep looping (line 692, rev 24191)
until all files of foo's directory have been processed instead of
breaking when foo is done. Those few lines will ensure we 'break'
when files passed as argument are processed.

[[[
Prevent from some useless processing when performing single-file diff on WC/WC.

* subversion/libsvn_wc/diff.c
  (directory_elements_diff): add a boolean so that we know when the
file passed as argument is diffed
]]]

(a 'goto' statement might be simpler but I'm not sure about 'cleaner' :)

Cheers,

Charles

--- subversion/libsvn_wc/diff.c (revision 24191)
+++ subversion/libsvn_wc/diff.c (working copy)
@@ -697,6 +697,7 @@
       const svn_wc_entry_t *entry;
       struct dir_baton *subdir_baton;
       const char *name, *path;
+ svn_boolean_t file_diffed = FALSE;

       svn_pool_clear(subpool);

@@ -726,6 +727,7 @@
         {
         case svn_node_file:
           SVN_ERR(file_diff(dir_baton, path, entry, subpool));
+ file_diffed = TRUE;
           break;

         case svn_node_dir:
@@ -756,6 +758,9 @@
         default:
           break;
         }
+
+ if (file_diffed)
+ break;
     }

   svn_pool_destroy(subpool);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 29 01:07:26 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.