🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1128

diff 1.15 -N option

#1128
From: Johannes Helander
Date: Sat, 21 Nov 1992 10:26
85 lines
3567 bytes
IMHO, the -N option (+new-files) would be more useful if it would
affect only files in the new directory. New files would get inserted
in the diff, deleted files would not.

This is especially useful when using shadowed source trees where it
doesn't make any sence to include unchanged files in the diff (which
occurred to me when I got some 20 MB diffs where there really were
only a few changes).

The following simple fixes implement this change.

	Johannes

*** ChangeLog.orig	Mon Nov 16 02:18:24 1992
--- ChangeLog	Mon Nov 16 02:22:42 1992
***************
*** 1,3 ****
--- 1,10 ----
+ Mon Nov 16 02:18:42 1992  Johannes Helander  (jvh at leia.cs.hut.fi)
+ 
+ 	* README: Fix description of -N flag.
+ 
+ 	* diff.c (compare_files): Only print NEW files when -N flag is
+ 	given. Do not print deleted files.
+ 
  Sun Jan  6 18:42:23 1991  Michael I Bushnell  (mib at geech.ai.mit.edu)
  
  	* Version 1.15 released.
*** README.orig	Mon Nov 16 02:17:32 1992
--- README	Mon Nov 16 02:18:11 1992
***************
*** 80,87 ****
  	to affect neither label, just the first file's label, or both labels.
  	A file's default label is its name, a tab, and its modification date.
  
!    -N	in directory comparison, if a file is found in only one directory,
! 	treat it as present but empty in the other directory.
  
     -p	equivalent to -c -F'^[_a-zA-Z]'.  This is useful for C code
  	because it shows which function each change is in.
--- 80,87 ----
  	to affect neither label, just the first file's label, or both labels.
  	A file's default label is its name, a tab, and its modification date.
  
!    -N	in directory comparison, if a file is found in only in the second
! 	directory, treat it as present but empty in the first directory.
  
     -p	equivalent to -c -F'^[_a-zA-Z]'.  This is useful for C code
  	because it shows which function each change is in.
*** diff.c.orig	Mon Nov 16 02:11:40 1992
--- diff.c	Mon Nov 16 02:27:52 1992
***************
*** 451,457 ****
       that exists only in one of the directories.
       If so, just print a message to that effect.  */
  
!   if (! entire_new_file_flag && (name0 == 0 || name1 == 0))
      {
        char *name = name0 == 0 ? name1 : name0;
        char *dir = name0 == 0 ? dir1 : dir0;
--- 451,457 ----
       that exists only in one of the directories.
       If so, just print a message to that effect.  */
  
!   if (name1 == 0 || !entire_new_file_flag && name0 == 0)
      {
        char *name = name0 == 0 ? name1 : name0;
        char *dir = name0 == 0 ? dir1 : dir0;
***************
*** 631,637 ****
  
        if (inf[0].desc == -1 || inf[1].desc == -1)
  	{
! 	  if (entire_new_file_flag && recursive)
  	    val = diff_dirs (inf[0].name, inf[1].name, compare_files, depth,
  			     inf[0].desc == -1, inf[1].desc == -1);
  	  else
--- 631,637 ----
  
        if (inf[0].desc == -1 || inf[1].desc == -1)
  	{
! 	  if (entire_new_file_flag && inf[1].dir_p && recursive)
  	    val = diff_dirs (inf[0].name, inf[1].name, compare_files, depth,
  			     inf[0].desc == -1, inf[1].desc == -1);
  	  else
Technical Details
Message-ID: <199211210626.AA27376@leia.cs.hut.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sauna.cs.hut.fi!jvh

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sauna.cs.hut.fi!jvh
From: jvh@sauna.cs.hut.fi (Johannes Helander)
Subject: diff 1.15 -N option
Message-ID: <199211210626.AA27376@leia.cs.hut.fi>
Sender: gnulists@ai.mit.edu
Organization: Helsinki University of Technology, CS Lab.
Distribution: gnu
Date: Sat, 21 Nov 1992 10:26:53 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 86