grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.21-23-gff38f09


From: Paul Eggert
Subject: grep branch, master, updated. v2.21-23-gff38f09
Date: Thu, 12 Mar 2015 05:45:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  ff38f097a41ddf908e3036524319de5a3aa6188e (commit)
      from  18af0c4ad225785439af21ff0d5c8e6dc78dddf3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=ff38f097a41ddf908e3036524319de5a3aa6188e


commit ff38f097a41ddf908e3036524319de5a3aa6188e
Author: Paul Eggert <address@hidden>
Date:   Wed Mar 11 22:44:36 2015 -0700

    grep: output "." file name in diagnostic
    
    This is bug C as reported by David Grayson in:
    http://bugs.gnu.org/16444#18
    This bug occurs only in obscure circumstances, and I didn't see
    how to write a reasonable test case for it.
    * src/grep.c (filename_prefix_len): Remove, replacing with ...
    (omit_dot_slash): New static var.  All uses of the former replaced
    with uses of the latter.
    (grepdirent): Don't add 2 if the filename is just ".".

diff --git a/src/grep.c b/src/grep.c
index f720a8a..81b8716 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -384,7 +384,8 @@ static char const *matcher;
 /* For error messages. */
 /* The input file name, or (if standard input) "-" or a --label argument.  */
 static char const *filename;
-static size_t filename_prefix_len;
+/* Omit leading "./" from file names in diagnostics.  */
+static bool omit_dot_slash;
 static bool errseen;
 static bool write_error_seen;
 
@@ -640,7 +641,7 @@ skipped_file (char const *name, bool command_line, bool 
is_dir)
 {
   return (is_dir
           ? (directories == SKIP_DIRECTORIES
-             || (! (command_line && filename_prefix_len != 0)
+             || (! (command_line && omit_dot_slash)
                  && excluded_directory_patterns
                  && excluded_file_name (excluded_directory_patterns, name)))
           : (excluded_patterns
@@ -1483,7 +1484,9 @@ grepdirent (FTS *fts, FTSENT *ent, bool command_line)
       return true;
     }
 
-  filename = ent->fts_path + filename_prefix_len;
+  filename = ent->fts_path;
+  if (omit_dot_slash && filename[1])
+    filename += 2;
   follow = (fts->fts_options & FTS_LOGICAL
             || (fts->fts_options & FTS_COMFOLLOW && command_line));
 
@@ -2595,8 +2598,7 @@ main (int argc, char **argv)
     }
   else if (directories == RECURSE_DIRECTORIES && prepended < last_recursive)
     {
-      /* Grep through ".", omitting leading "./" from diagnostics.  */
-      filename_prefix_len = 2;
+      omit_dot_slash = true;
       ok = grep_command_line_arg (".");
     }
   else

-----------------------------------------------------------------------

Summary of changes:
 src/grep.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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