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

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

 



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@xxxxxx>
    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"


-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]