From 456609a8adfc2b8335ce8233f0da2cc0d929e8a8 Mon Sep 17 00:00:00 2001 From: Tim Waugh
Date: Fri, 12 Aug 2011 17:20:03 +0100 Subject: [PATCH] diff: apply --ignore-file-name-case even outside recursive directory traversal * src/diff.c (find_dir_file_pathname): New function for finding a matching filename in a directory. * src/diff.h: Prototype for new function. * src/dir.c: Use it. --- NEWS | 4 ++++ doc/diffutils.texi | 2 +- src/diff.c | 2 +- src/diff.h | 1 + src/dir.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 42d9358..5a37963 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ GNU diffutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** Changes in behavior + + The --ignore-file-name-case option now applies throughout and is not + limited to recursive directory traversal. * Noteworthy changes in release 3.1 (2011-08-10) [stable] diff --git a/doc/diffutils.texi b/doc/diffutils.texi index ee419a1..16ea6c9 100644 --- a/doc/diffutils.texi +++ b/doc/diffutils.texi @@ -3802,7 +3802,7 @@ Ignore changes that just insert or delete lines that match @var{regexp}. @xref{Specified Lines}. @item --ignore-file-name-case -Ignore case when comparing file names during recursive comparison. +Ignore case when comparing file names. @xref{Comparing Directories}. @item -l diff --git a/src/diff.c b/src/diff.c index 6a08f36..1e334b7 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1170,7 +1170,7 @@ compare_files (struct comparison const *parent, char const *fnm = cmp.file[fnm_arg].name; char const *dir = cmp.file[dir_arg].name; char const *filename = cmp.file[dir_arg].name = free0 - = file_name_concat (dir, last_component (fnm), NULL); + = find_dir_file_pathname (dir, last_component (fnm)); if (STREQ (fnm, "-")) fatal ("cannot compare `-' to a directory"); diff --git a/src/diff.h b/src/diff.h index 88332a5..b1c90c7 100644 --- a/src/diff.h +++ b/src/diff.h @@ -327,6 +327,7 @@ extern void print_context_script (struct change *, bool); extern int diff_dirs (struct comparison const *, int (*) (struct comparison const *, char const *, char const *)); +char *find_dir_file_pathname (char const *, char const *); /* ed.c */ extern void print_ed_script (struct change *); diff --git a/src/dir.c b/src/dir.c index 30bef2c..92eb8b4 100644 --- a/src/dir.c +++ b/src/dir.c @@ -21,6 +21,7 @@ #include "diff.h" #include