diffutils-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Diffutils-devel] expand exclude flag to allow for paths instead of just


From: J-
Subject: [Diffutils-devel] expand exclude flag to allow for paths instead of just file names
Date: Sat, 1 Dec 2018 18:45:52 +0000

Hey Guys  would it be possible to modify the exclude code so that we could 
exclude (-x) full paths?

currently i can only do this (filename level) "-x banner.txt"

but i only want to exclude if banner.txt is in folder "-x 
*/resources/banner.txt"

I know i can grep this, but the output of brief doesn't show the full path, of 
the files.

ie: "Only in /Projects/src/main/resources: banner.txt"

Patch would be simple, but is there a better way?

--- a/src/dir.c
+++ b/src/dir.c
@@ -70,6 +70,9 @@ dir_read (struct file_data const *dir, struct dirdata 
*dirdata)
   nnames = 0;
   data = 0;

+  /* store full path to file for exclusion check */
+  char buf[4096];
+
   if (dir->desc != -1)
     {
       /* Open the directory and check for errors.  */
@@ -96,8 +99,12 @@ dir_read (struct file_data const *dir, struct dirdata 
*dirdata)
              && (d_name[1] == 0 || (d_name[1] == '.' && d_name[2] == 0)))
            continue;

-         if (excluded_file_name (excluded, d_name))
+      /* Check entire file path for pattern */
+      snprintf(buf, sizeof buf, "%s/%s", dir->name, d_name);
+         if (excluded_file_name (excluded, buf))
            continue;

          while (data_alloc < data_used + d_size)
            {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]