home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.utils.bug
- From: mib@gnu.ai.mit.edu (Michael I Bushnell)
- Subject: [gnu@cygnus.com: GNU diff feature to ignore subtrees (like CVS.adm)]
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 20 Aug 1991 09:14:56 GMT
-
- To: mib@ai.mit.edu
- Cc: gnu@cygnus.com
- Subject: GNU diff feature to ignore subtrees (like CVS.adm)
- Date: Mon, 19 Aug 91 16:43:09 -0700
- From: gnu@cygnus.com
-
- This has reduced the size of my diffs by a factor of two, when diffing
- two trees checked out of CVS. You say diff -r -ignore-file CVS.adm foo bar.
-
- John
-
- ===================================================================
- RCS file: /local/cvsfiles/devo/diff/ChangeLog,v
- retrieving revision 1.1.1.3
- diff -c -r1.1.1.3 ChangeLog
- *** 1.1.1.3 1991/02/12 07:24:21
- --- ChangeLog 1991/08/19 22:08:31
- ***************
- *** 1,3 ****
- --- 1,16 ----
- + Mon Aug 19 15:05:23 1991 John Gilmore (gnu at cygint.cygnus.com)
- +
- + Add +ignore-file feature, which causes entire files or
- + directories to be treated like they don't exist. This is for
- + comparing trees checked out of CVS, where the CVS.adm
- + directory produces large extraneous diffs even for identical
- + trees.
- +
- + * diff.h (ignore_files, ignore_files_size): Declare.
- + * diff.c (main, longopts): Initialize them. Parse option to
- + add a file to the ignored list.
- + * dir.c (dir_sort): Ignore any files that are in the list.
- +
- Sun Jan 6 18:42:23 1991 Michael I Bushnell (mib at geech.ai.mit.edu)
-
- * Version 1.15 released.
- ===================================================================
- ===================================================================
- RCS file: /local/cvsfiles/devo/diff/diff.h,v
- retrieving revision 1.1.1.4
- diff -c -r1.1.1.4 diff.h
- *** 1.1.1.4 1991/02/12 07:24:40
- --- diff.h 1991/08/19 22:03:30
- ***************
- *** 147,152 ****
- --- 147,159 ----
- /* Ignore changes that affect only blank lines (-B). */
- EXTERN int ignore_blank_lines_flag;
-
- + /* Ignore any files that show up with these names, in recursive diff.
- + IGNORE_FILES points to a malloc'd array of char *'s, terminated with a
- + zero pointer. IGNORE_FILES_SIZE is how many pointers there are,
- + including the trailing zero pointer. */
- + EXTERN char **ignore_files;
- + EXTERN int ignore_files_size;
- +
- /* Ignore changes that affect only lines matching this regexp (-I). */
- EXTERN char *ignore_regexp;
-
- ===================================================================
- ===================================================================
- RCS file: /local/cvsfiles/devo/diff/diff.c,v
- retrieving revision 1.1.1.4
- diff -c -r1.1.1.4 diff.c
- *** 1.1.1.4 1991/02/12 07:24:37
- --- diff.c 1991/08/19 22:03:45
- ***************
- *** 67,74 ****
- return result;
- }
-
- ! /* The numbers 129 and 130 that appear in the fourth element
- ! for the context and unidiff entries are used as a way of
- telling the big switch in `main' how to process those options. */
-
- static struct option longopts[] =
- --- 67,74 ----
- return result;
- }
-
- ! /* The numbers 129 and 130 and 131 that appear in the fourth element
- ! for the context and unified and ignore-file entries are used as a way of
- telling the big switch in `main' how to process those options. */
-
- static struct option longopts[] =
- ***************
- *** 102,107 ****
- --- 102,108 ----
- {"expand-tabs", 0, 0, 't'},
- {"ignore-all-space", 0, 0, 'w'},
- {"unified", 2, 0, 130},
- + {"ignore-file", 1, 0, 131},
- {"version", 0, 0, 'v'},
- {0, 0, 0, 0}
- };
- ***************
- *** 126,131 ****
- --- 127,135 ----
- length_varies = FALSE;
- ignore_case_flag = FALSE;
- ignore_blank_lines_flag = FALSE;
- + ignore_files_size = 1;
- + ignore_files = (char **) malloc (sizeof (char *));
- + ignore_files[0] = 0;
- ignore_regexp = 0;
- function_regexp = 0;
- print_file_same_flag = FALSE;
- ***************
- *** 266,271 ****
- --- 270,284 ----
- /* Ignore changes affecting only lines that match the
- specified regexp. */
- ignore_regexp = optarg;
- + break;
- +
- + case 131:
- + /* Ignore files of this name, anywhere in the tree. */
- + ignore_files_size++;
- + ignore_files = (char **) realloc (ignore_files,
- + sizeof (char *) * ignore_files_size);
- + ignore_files[ignore_files_size-2] = optarg;
- + ignore_files[ignore_files_size-1] = 0;
- break;
-
- case 'l':
- ===================================================================
- ===================================================================
- RCS file: /local/cvsfiles/devo/diff/dir.c,v
- retrieving revision 1.1.1.4
- diff -c -r1.1.1.4 dir.c
- *** 1.1.1.4 1991/02/12 07:24:46
- --- dir.c 1991/08/19 23:26:26
- ***************
- *** 49,54 ****
- --- 49,57 ----
- /* Index of first unused in `files'. */
- int files_index;
-
- + /* Running pointer to ignored-files list */
- + char **p;
- +
- if (nonex)
- {
- dirdata.length = 0;
- ***************
- *** 83,88 ****
- --- 86,97 ----
- && next->d_name[2] == 0)))
- continue;
-
- + /* Ignore any files that the user asked us to ignore. */
- + for (p = ignore_files; *p; p++) {
- + if (**p == next->d_name[0] && !strcmp (*p, next->d_name))
- + goto nextfile;
- + }
- +
- if (files_index == nfiles)
- {
- nfiles *= 2;
- ***************
- *** 90,95 ****
- --- 99,106 ----
- = (char **) xrealloc (files, sizeof (char *) * nfiles);
- }
- files[files_index++] = concat (next->d_name, "", "");
- +
- + nextfile: ;
- }
-
- closedir (reading);
-
-
-
-
-