Hi all,
Not everyone likes the "Index:" lines in front of diff files. In
particular, some well-known kernel hackers don't. In order to keep them
happy, I have been adding a --no-index option to both the diff and the
refresh commands of quilt. As its name suggests, passing the option to
either command will prevent it from prepending the two "Index:" lines to
each patch.
I implemented this option in a very similar way to --no-timestamps,
there's nothing really new here. In particular, this means that one can
add QUILT_NO_DIFF_INDEX=1 in his/her .quiltrc file for it to affect all
quilt functions. I also added a test for this option in the test suite.
Patch against current CVS attached. Please consider for inclusion.
Thanks,
--
Jean Delvare
Index: quilt/diff.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/diff.in,v
retrieving revision 1.48
diff -u -r1.48 diff.in
--- quilt/diff.in 13 Apr 2005 13:04:06 -0000 1.48
+++ quilt/diff.in 4 Jun 2005 17:50:43 -0000
@@ -21,7 +21,7 @@
usage()
{
- printf $"Usage: quilt diff [-p n] [-u|-U num|-c|-C num] [--combine
patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility] [--sort] [--color]
[file ...]\n"
+ printf $"Usage: quilt diff [-p n] [-u|-U num|-c|-C num] [--combine
patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility] [--no-timestamps]
[--no-index] [--sort] [--color] [file ...]\n"
if [ x$1 = x-h ]
then
@@ -40,6 +40,9 @@
--no-timestamps
Do not include file timestamps in patch headers.
+--no-index
+ Do not prepend an Index: line to patch headers.
+
-z Write to standard output the changes that have been made
relative to the topmost or specified patch.
@@ -133,7 +136,9 @@
exit $status
}
-options=`getopt -o p:P:RuU:cC:zh --long
diff:,snapshot,no-timestamps,combine:,color::,sort -- "$@"`
+options=`getopt -o p:P:RuU:cC:zh --long diff:,snapshot,no-timestamps \
+ --long combine:,color::,sort \
+ --long no-index -- "$@"`
if [ $? -ne 0 ]
then
@@ -192,6 +197,9 @@
--no-timestamps)
QUILT_NO_DIFF_TIMESTAMPS=1
shift ;;
+ --no-index)
+ QUILT_NO_DIFF_INDEX=1
+ shift ;;
--sort)
opt_sort=1
shift ;;
Index: quilt/refresh.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/refresh.in,v
retrieving revision 1.39
diff -u -r1.39 refresh.in
--- quilt/refresh.in 22 May 2005 16:15:33 -0000 1.39
+++ quilt/refresh.in 4 Jun 2005 17:50:43 -0000
@@ -19,7 +19,7 @@
usage()
{
- printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps]
[--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n"
+ printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps]
[--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace]
[patch]\n"
if [ x$1 = x-h ]
then
@@ -46,6 +46,9 @@
--no-timestamps
Do not include file timestamps in patch headers.
+--no-index
+ Do not prepend an Index: line to patch headers.
+
--diffstat
Add a diffstat section to the patch header, or replace the
existing diffstat section.
@@ -76,6 +79,7 @@
}
options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \
+ --long no-index \
--long strip-trailing-whitespace -- "$@"`
if [ $? -ne 0 ]
@@ -106,6 +110,9 @@
--no-timestamps)
QUILT_NO_DIFF_TIMESTAMPS=1
shift ;;
+ --no-index)
+ QUILT_NO_DIFF_INDEX=1
+ shift ;;
--diffstat)
opt_diffstat=1
shift ;;
Index: scripts/patchfns.in
===================================================================
RCS file: /cvsroot/quilt/quilt/scripts/patchfns.in,v
retrieving revision 1.61
diff -u -r1.61 patchfns.in
--- scripts/patchfns.in 13 Apr 2005 13:04:06 -0000 1.61
+++ scripts/patchfns.in 4 Jun 2005 17:50:43 -0000
@@ -575,14 +575,21 @@
-r "$new_file")
fi
- @DIFF@ -N $QUILT_DIFF_OPTS $old_file $new_file \
- --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
- | if read line
- then
- echo "Index: $index"
- echo
"==================================================================="
- echo "$line"
- cat
+ if [ -n "$QUILT_NO_DIFF_INDEX" ]
+ then
+ @DIFF@ -N $QUILT_DIFF_OPTS $old_file $new_file \
+ --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
+ || true
+ else
+ @DIFF@ -N $QUILT_DIFF_OPTS $old_file $new_file \
+ --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
+ | if read line
+ then
+ echo "Index: $index"
+ echo
"==================================================================="
+ echo "$line"
+ cat
+ fi
fi
}
Index: test/formats.test
===================================================================
RCS file: /cvsroot/quilt/quilt/test/formats.test,v
retrieving revision 1.2
diff -u -r1.2 formats.test
--- test/formats.test 9 Jul 2004 07:26:41 -0000 1.2
+++ test/formats.test 4 Jun 2005 17:50:43 -0000
@@ -92,5 +92,16 @@
> ! new
> 4
+ $ quilt diff --no-index
+ > --- d.orig/test.txt
+ > +++ d/test.txt
+ > @@ -1,5 +1,5 @@
+ > 1
+ > 2
+ > -old
+ > +new
+ > 4
+ > 5
+
$ cd ..
$ rm -rf d
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev