[PATCH] do not use the no-op "-s" to diff-files.

From: Junio C Hamano <junkio@cox.net>
Date: 2006-04-22 17:49:46
The code to use '-s' flag to git-diff-files has been in cg-merge
(and its ancestor) since this commit:

    commit 39c1ae5dfd229fb87c723fcf9737f29a506a31f9
    Author: Petr Baudis <pasky@ucw.cz>
    Date:   Tue Apr 19 02:42:08 2005 +0200

The "-s" flag has been a no-op to git-diff-files (but not for
other diff siblings) for quite some time.  For other diff
siblings, the flag means "do not output anything", and it is
primarily useful to squelch patch/raw from one-tree form of
"diff-tree --pretty".

I am not sure if running diff-files to see if there is any
difference and then running update-index --refresh when it is is
a win -- I suspect you did this out of performance concerns, but
it might be faster to let update-index to figure out if there is
anything that needs to be done.  So the first variant is the
minimum impact (absolutely no semantic changes), the second
variant _might_ be a performance improvement.

-jc

-- >8 --
First variant

diff --git a/cg-merge b/cg-merge
index 004b78a..24fb6ca 100755
--- a/cg-merge
+++ b/cg-merge
@@ -199,7 +199,7 @@ if { [ "$head" = "$base" ] || [ "$head" 
 fi
 
 
-[ "$(git-diff-files -s)" ] && git-update-index --refresh >/dev/null
+[ "$(git-diff-files)" ] && git-update-index --refresh >/dev/null
 
 if [ ! "$squash" ]; then
 	[ -s "$_git/squashing" ] && die "cannot combine squashing and non-squashing merges"

-- >8 --
Second variant

diff --git a/cg-merge b/cg-merge
index 24fb6ca..938d21a 100755
--- a/cg-merge
+++ b/cg-merge
@@ -199,7 +199,7 @@ if { [ "$head" = "$base" ] || [ "$head" 
 fi
 
 
-[ "$(git-diff-files -s)" ] && git-update-index --refresh >/dev/null
+git-update-index --refresh >/dev/null
 
 if [ ! "$squash" ]; then
 	[ -s "$_git/squashing" ] && die "cannot combine squashing and non-squashing merges"


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sun Apr 23 03:54:41 2006

This archive was generated by hypermail 2.1.8 : 2006-04-23 03:54:57 EST