diff --git a/Makefile.am b/Makefile.am
index b6fce229..58240ac3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,8 +69,6 @@ src/lsdiff$(EXEEXT): src/filterdiff$(EXEEXT)
src/grepdiff$(EXEEXT): src/filterdiff$(EXEEXT)
ln -sf $(notdir $<) $@
-src/patchview$(EXEEXT): src/filterdiff$(EXEEXT)
- ln -sf $(notdir $<) $@
install-exec-hook:
ln -sf "`echo interdiff|sed '$(transform)'`" $(DESTDIR)$(bindir)/"`echo combinediff|sed '$(transform)'`"
@@ -106,7 +104,7 @@ uninstall-hook:
rm -f patchutils; \
fi
-CLEANFILES=src/combinediff src/flipdiff src/lsdiff src/grepdiff src/patchview
+CLEANFILES=src/combinediff src/flipdiff src/lsdiff src/grepdiff
MAINTAINERCLEANFILES=$(man_MANS)
# Regression tests.
@@ -315,7 +313,7 @@ XFAIL_TESTS = \
tests/lsdiff-lines-option/run-test
test-perms: src/combinediff$(EXEEXT) src/flipdiff$(EXEEXT) \
- src/lsdiff$(EXEEXT) src/grepdiff$(EXEEXT) src/patchview$(EXEEXT) \
+ src/lsdiff$(EXEEXT) src/grepdiff$(EXEEXT) \
scripts/splitdiff
for script in $(bin_SCRIPTS); do \
if [ -f $(top_builddir)/$$script ]; then \
diff --git a/NEWS b/NEWS
index ad05c3f3..a23eddf8 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,11 @@ Patchutils news
Added manual pages for gitdiff, gitdiffview, svndiff, and svndiffview
commands. Addresses GitHub issue #112.
+ Deprecated --filter, --list, and --grep options in favor of using
+ the appropriate command names (filterdiff, lsdiff, grepdiff). These
+ options now issue deprecation warnings and may be removed in a future
+ version.
+
0.4.3 (stable)
Added --in-place option to more tools for editing files in place.
diff --git a/doc/patchutils.xml b/doc/patchutils.xml
index 21629e61..1693bab7 100644
--- a/doc/patchutils.xml
+++ b/doc/patchutils.xml
@@ -905,7 +905,8 @@
- Behave like lsdiff1 instead.
+ Behave like lsdiff1 instead.
+ Deprecated: Use the lsdiff command directly instead.
@@ -913,7 +914,8 @@
- Behave like grepdiff1 instead.
+ Behave like grepdiff1 instead.
+ Deprecated: Use the grepdiff command directly instead.
@@ -1353,7 +1355,8 @@ filterdiff -i 'b/*/newname' git-patch-with-renames.patch]]>
- Behave like filterdiff1 instead.
+ Behave like filterdiff1 instead.
+ Deprecated: Use the filterdiff command directly instead.
@@ -1361,7 +1364,8 @@ filterdiff -i 'b/*/newname' git-patch-with-renames.patch]]>
- Behave like grepdiff1 instead.
+ Behave like grepdiff1 instead.
+ Deprecated: Use the grepdiff command directly instead.
@@ -1710,7 +1714,8 @@ will pipe patch of file #2 to vim - -R
- Behave like filterdiff1 instead.
+ Behave like filterdiff1 instead.
+ Deprecated: Use the filterdiff command directly instead.
@@ -1718,7 +1723,8 @@ will pipe patch of file #2 to vim - -R
- Behave like grepdiff1 instead.
+ Behave like grepdiff1 instead.
+ Deprecated: Use the grepdiff command directly instead.
@@ -2384,7 +2390,8 @@ will pipe patch of file #2 to vim - -R
- Behave like filterdiff1 instead.
+ Behave like filterdiff1 instead.
+ Deprecated: Use the filterdiff command directly instead.
@@ -2392,7 +2399,8 @@ will pipe patch of file #2 to vim - -R
- Behave like lsdiff1 instead.
+ Behave like lsdiff1 instead.
+ Deprecated: Use the lsdiff command directly instead.
diff --git a/scripts/patchview b/scripts/patchview
new file mode 100755
index 00000000..2f1edab1
--- /dev/null
+++ b/scripts/patchview
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# patchview - wrapper script for patchutils
+# This script replaces the patchview symlink to filterdiff and provides
+# cleaner mode switching by calling the appropriate tool directly.
+
+# Check for switches (arguments starting with -)
+# Handle -- separator properly: everything after -- is treated as non-options
+has_switches=0
+past_separator=0
+for arg in "$@"; do
+ if [ "$past_separator" -eq 1 ]; then
+ # Everything after -- is treated as filenames, not switches
+ continue
+ fi
+ case "$arg" in
+ --)
+ # -- separator found, stop looking for switches after this
+ past_separator=1
+ ;;
+ -*)
+ has_switches=1
+ break
+ ;;
+ esac
+done
+
+# Default behavior: if no switches, behave like "lsdiff --number"
+# This matches the original patchview behavior in filterdiff.c
+if [ $has_switches -eq 0 ]; then
+ exec lsdiff --number "$@"
+fi
+
+# Check for mode-switching options
+case "$1" in
+ --filter)
+ # Remove --filter and pass remaining args to filterdiff
+ shift
+ exec filterdiff "$@"
+ ;;
+ --grep)
+ # Remove --grep and pass remaining args to grepdiff
+ shift
+ exec grepdiff "$@"
+ ;;
+ --help)
+ cat << 'EOF'
+usage: patchview [OPTION]... [files ...]
+
+patchview is a wrapper for filterdiff that provides numbered file listing.
+
+Without switches:
+ patchview [files...] equivalent to: lsdiff --number [files...]
+
+With mode options:
+ patchview --filter ... equivalent to: filterdiff ...
+ patchview --grep ... equivalent to: grepdiff ...
+
+With other options:
+ patchview -F2- equivalent to: filterdiff -F2-
+
+For complete option details, see:
+ man filterdiff, man lsdiff, man grepdiff
+EOF
+ ;;
+ --version)
+ # Get version from filterdiff
+ exec filterdiff --version
+ ;;
+ *)
+ # Any other arguments: behave like filterdiff
+ exec filterdiff "$@"
+ ;;
+esac
diff --git a/src/filterdiff.c b/src/filterdiff.c
index b245cb4c..c4c239f2 100644
--- a/src/filterdiff.c
+++ b/src/filterdiff.c
@@ -1536,20 +1536,20 @@ const char * syntax_str =
" --lines=L include only hunks with (original) lines in range L, if range begins with x show all excluding range L\n"
" -F F, --files=F\n"
" include only files in range F, if range begins with x show all excluding range F\n"
-" --annotate (filterdiff, patchview, grepdiff)\n"
-" annotate each hunk with the filename and hunk number (filterdiff, patchview, grepdiff)\n"
-" --as-numbered-lines=before|after|original-before|original-after (filterdiff, patchview, grepdiff)\n"
+" --annotate (filterdiff, grepdiff)\n"
+" annotate each hunk with the filename and hunk number (filterdiff, grepdiff)\n"
+" --as-numbered-lines=before|after|original-before|original-after (filterdiff, grepdiff)\n"
" display lines as they would look before, or after, the patch is applied;\n"
" or with original line numbers from the diff (original-before/original-after)\n"
-" --format=context|unified (filterdiff, patchview, grepdiff)\n"
-" set output format (filterdiff, patchview, grepdiff)\n"
+" --format=context|unified (filterdiff, grepdiff)\n"
+" set output format (filterdiff, grepdiff)\n"
" --output-matching=hunk|file (grepdiff)\n"
" show matching hunks or file-level diffs (grepdiff)\n"
" --only-match=rem|removals|add|additions|mod|modifications|all (grepdiff)\n"
" regex will only match removals, additions, modifications or (grepdiff)\n"
" the whole hunk (grepdiff)\n"
-" --remove-timestamps (filterdiff, patchview, grepdiff)\n"
-" don't show timestamps from output (filterdiff, patchview, grepdiff)\n"
+" --remove-timestamps (filterdiff, grepdiff)\n"
+" don't show timestamps from output (filterdiff, grepdiff)\n"
" --clean (filterdiff)\n"
" remove all comments (non-diff lines) from output (filterdiff)\n"
" --in-place (filterdiff)\n"
@@ -1590,9 +1590,9 @@ const char * syntax_str =
" treat empty files as absent (lsdiff)\n"
" -f FILE, --file=FILE (grepdiff)\n"
" read regular expressions from FILE (grepdiff)\n"
-" --filter run as 'filterdiff' (grepdiff, patchview, lsdiff)\n"
-" --list run as 'lsdiff' (filterdiff, patchview, grepdiff)\n"
-" --grep run as 'grepdiff' (filterdiff, patchview, lsdiff)\n"
+" --filter run as 'filterdiff' (deprecated, use program name instead) (grepdiff, lsdiff)\n"
+" --list run as 'lsdiff' (deprecated, use program name instead) (filterdiff, grepdiff)\n"
+" --grep run as 'grepdiff' (deprecated, use program name instead) (filterdiff, lsdiff)\n"
;
NORETURN
@@ -1698,12 +1698,6 @@ static void set_filter (void)
mode = mode_filter;
}
-static void set_view (void)
-{
- /* This is patchview. */
- set_progname ("patchview");
- mode = mode_filter;
-}
static void set_grep (void)
{
@@ -1714,7 +1708,7 @@ static void set_grep (void)
static void determine_mode_from_name (const char *argv0)
{
- /* This is filterdiff, unless it is named 'lsdiff', 'grepdiff' or 'patchview'. */
+ /* This is filterdiff, unless it is named 'lsdiff' or 'grepdiff'. */
const char *p = strrchr (argv0, '/');
if (!p++)
p = argv0;
@@ -1722,9 +1716,6 @@ static void determine_mode_from_name (const char *argv0)
set_list ();
else if (strstr (p, "grepdiff"))
set_grep ();
- else if (strstr (p, "patchview")) {
- set_view ();
- }
else
set_filter ();
}
@@ -1783,7 +1774,6 @@ int main (int argc, char *argv[])
FILE *f = stdin;
char format = '\0';
int regex_file_specified = 0;
- int have_switches = 0;
int inplace_mode = 0;
setlocale (LC_TIME, "C");
@@ -1836,15 +1826,17 @@ int main (int argc, char *argv[])
if (c == -1)
break;
- have_switches = 1;
switch (c) {
case 'g':
+ fprintf (stderr, "Warning: --grep is deprecated, use 'grepdiff' command instead\n");
set_grep ();
break;
case 1000 + 'f':
+ fprintf (stderr, "Warning: --filter is deprecated, use 'filterdiff' command instead\n");
set_filter ();
break;
case 'l':
+ fprintf (stderr, "Warning: --list is deprecated, use 'lsdiff' command instead\n");
set_list ();
break;
case 'E':
@@ -2018,10 +2010,6 @@ int main (int argc, char *argv[])
syntax(1);
}
}
- if (have_switches == 0 && strcmp (progname, "patchview") == 0) {
- mode = mode_list;
- number_files = 1;
- }
/* Preserve the old semantics of -p. */
if (mode != mode_filter && ignore_components && !strip_components &&
diff --git a/tests/common.sh b/tests/common.sh
index fd50b82a..f4d35c3e 100644
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -10,7 +10,7 @@ REDIFF=${top_builddir}/src/rediff
COMBINEDIFF=${top_builddir}/src/combinediff
FLIPDIFF=${top_builddir}/src/flipdiff
LSDIFF=${top_builddir}/src/lsdiff
-PATCHVIEW=${top_builddir}/src/patchview
+PATCHVIEW=${top_builddir}/scripts/patchview
GREPDIFF=${top_builddir}/src/grepdiff
FILTERDIFF=${top_builddir}/src/filterdiff
SELECTDIFF=${top_builddir}/src/selectdiff
diff --git a/tests/git-lsdiff-status/run-test b/tests/git-lsdiff-status/run-test
index d4117d2b..47e7df2a 100755
--- a/tests/git-lsdiff-status/run-test
+++ b/tests/git-lsdiff-status/run-test
@@ -145,10 +145,3 @@ cat << EOF | cmp - result7 || exit 1
+ a/empty-new.txt
- a/empty-deleted.txt
EOF
-
-# Test 8: Test with filterdiff in list mode (should use same code paths)
-${FILTERDIFF} --list -s mixed-git.patch 2>errors8 >result8 || exit 1
-[ -s errors8 ] && exit 1
-
-# Should be identical to lsdiff -s output
-cmp result7 result8 || exit 1