home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / diff / diff_115.zoo / diff.up1 < prev    next >
Encoding:
Text File  |  1991-08-21  |  5.3 KB  |  182 lines

  1. Newsgroups: gnu.utils.bug
  2. From: mib@gnu.ai.mit.edu (Michael I Bushnell)
  3. Subject: [gnu@cygnus.com: GNU diff feature to ignore subtrees (like CVS.adm)]
  4. Organization: GNUs Not Usenet
  5. Distribution: gnu
  6. Date: Tue, 20 Aug 1991 09:14:56 GMT
  7.  
  8. To: mib@ai.mit.edu
  9. Cc: gnu@cygnus.com
  10. Subject: GNU diff feature to ignore subtrees (like CVS.adm)
  11. Date: Mon, 19 Aug 91 16:43:09 -0700
  12. From: gnu@cygnus.com
  13.  
  14. This has reduced the size of my diffs by a factor of two, when diffing
  15. two trees checked out of CVS.  You say diff -r -ignore-file CVS.adm foo bar.
  16.  
  17.     John
  18.  
  19. ===================================================================
  20. RCS file: /local/cvsfiles/devo/diff/ChangeLog,v
  21. retrieving revision 1.1.1.3
  22. diff -c -r1.1.1.3 ChangeLog
  23. *** 1.1.1.3    1991/02/12 07:24:21
  24. --- ChangeLog    1991/08/19 22:08:31
  25. ***************
  26. *** 1,3 ****
  27. --- 1,16 ----
  28. + Mon Aug 19 15:05:23 1991  John Gilmore  (gnu at cygint.cygnus.com)
  29. +     Add +ignore-file feature, which causes entire files or
  30. +     directories to be treated like they don't exist.  This is for
  31. +     comparing trees checked out of CVS, where the CVS.adm
  32. +     directory produces large extraneous diffs even for identical
  33. +     trees.
  34. +     
  35. +     * diff.h (ignore_files, ignore_files_size):  Declare.
  36. +     * diff.c (main, longopts):  Initialize them.  Parse option to
  37. +     add a file to the ignored list.
  38. +     * dir.c (dir_sort):  Ignore any files that are in the list.
  39.   Sun Jan  6 18:42:23 1991  Michael I Bushnell  (mib at geech.ai.mit.edu)
  40.   
  41.       * Version 1.15 released.
  42. ===================================================================
  43. ===================================================================
  44. RCS file: /local/cvsfiles/devo/diff/diff.h,v
  45. retrieving revision 1.1.1.4
  46. diff -c -r1.1.1.4 diff.h
  47. *** 1.1.1.4    1991/02/12 07:24:40
  48. --- diff.h    1991/08/19 22:03:30
  49. ***************
  50. *** 147,152 ****
  51. --- 147,159 ----
  52.   /* Ignore changes that affect only blank lines (-B).  */
  53.   EXTERN int      ignore_blank_lines_flag;
  54.   
  55. + /* Ignore any files that show up with these names, in recursive diff. 
  56. +    IGNORE_FILES points to a malloc'd array of char *'s, terminated with a
  57. +    zero pointer.  IGNORE_FILES_SIZE is how many pointers there are,
  58. +    including the trailing zero pointer.  */
  59. + EXTERN char     **ignore_files;
  60. + EXTERN int    ignore_files_size;
  61.   /* Ignore changes that affect only lines matching this regexp (-I).  */
  62.   EXTERN char    *ignore_regexp;
  63.   
  64. ===================================================================
  65. ===================================================================
  66. RCS file: /local/cvsfiles/devo/diff/diff.c,v
  67. retrieving revision 1.1.1.4
  68. diff -c -r1.1.1.4 diff.c
  69. *** 1.1.1.4    1991/02/12 07:24:37
  70. --- diff.c    1991/08/19 22:03:45
  71. ***************
  72. *** 67,74 ****
  73.     return result;
  74.   }
  75.   
  76. ! /* The numbers 129 and 130 that appear in the fourth element
  77. !    for the context and unidiff entries are used as a way of
  78.      telling the big switch in `main' how to process those options.  */
  79.   
  80.   static struct option longopts[] =
  81. --- 67,74 ----
  82.     return result;
  83.   }
  84.   
  85. ! /* The numbers 129 and 130 and 131 that appear in the fourth element
  86. !    for the context and unified and ignore-file entries are used as a way of
  87.      telling the big switch in `main' how to process those options.  */
  88.   
  89.   static struct option longopts[] =
  90. ***************
  91. *** 102,107 ****
  92. --- 102,108 ----
  93.     {"expand-tabs", 0, 0, 't'},
  94.     {"ignore-all-space", 0, 0, 'w'},
  95.     {"unified", 2, 0, 130},
  96. +   {"ignore-file", 1, 0, 131},
  97.     {"version", 0, 0, 'v'},
  98.     {0, 0, 0, 0}
  99.   };
  100. ***************
  101. *** 126,131 ****
  102. --- 127,135 ----
  103.     length_varies = FALSE;
  104.     ignore_case_flag = FALSE;
  105.     ignore_blank_lines_flag = FALSE;
  106. +   ignore_files_size = 1;
  107. +   ignore_files = (char **) malloc (sizeof (char *));
  108. +   ignore_files[0] = 0;
  109.     ignore_regexp = 0;
  110.     function_regexp = 0;
  111.     print_file_same_flag = FALSE;
  112. ***************
  113. *** 266,271 ****
  114. --- 270,284 ----
  115.         /* Ignore changes affecting only lines that match the
  116.            specified regexp.  */
  117.         ignore_regexp = optarg;
  118. +       break;
  119. +      case 131:
  120. +       /* Ignore files of this name, anywhere in the tree.  */
  121. +       ignore_files_size++;
  122. +       ignore_files = (char **) realloc (ignore_files,
  123. +                        sizeof (char *) * ignore_files_size);
  124. +       ignore_files[ignore_files_size-2] = optarg;
  125. +       ignore_files[ignore_files_size-1] = 0;
  126.         break;
  127.   
  128.       case 'l':
  129. ===================================================================
  130. ===================================================================
  131. RCS file: /local/cvsfiles/devo/diff/dir.c,v
  132. retrieving revision 1.1.1.4
  133. diff -c -r1.1.1.4 dir.c
  134. *** 1.1.1.4    1991/02/12 07:24:46
  135. --- dir.c    1991/08/19 23:26:26
  136. ***************
  137. *** 49,54 ****
  138. --- 49,57 ----
  139.     /* Index of first unused in `files'.  */
  140.     int files_index;
  141.   
  142. +   /* Running pointer to ignored-files list */
  143. +   char **p;
  144.     if (nonex)
  145.       {
  146.         dirdata.length = 0;
  147. ***************
  148. *** 83,88 ****
  149. --- 86,97 ----
  150.             && next->d_name[2] == 0)))
  151.       continue;
  152.   
  153. +       /* Ignore any files that the user asked us to ignore.  */
  154. +       for (p = ignore_files; *p; p++) {
  155. +     if (**p == next->d_name[0] && !strcmp (*p, next->d_name))
  156. +       goto nextfile;
  157. +       }
  158.         if (files_index == nfiles)
  159.       {
  160.         nfiles *= 2;
  161. ***************
  162. *** 90,95 ****
  163. --- 99,106 ----
  164.           = (char **) xrealloc (files, sizeof (char *) * nfiles);
  165.       }
  166.         files[files_index++] = concat (next->d_name, "", "");
  167. + nextfile: ;
  168.       }
  169.   
  170.     closedir (reading);
  171.  
  172.  
  173.  
  174.  
  175.