Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Sep 2022 19:08:28 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 50a6ae407596 - stable/12 - newvers.sh: Speed up git_tree_modified
Message-ID:  <202209061908.286J8SUo009686@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=50a6ae40759607424052ca70ad0bf246c3ed6087

commit 50a6ae40759607424052ca70ad0bf246c3ed6087
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2020-12-17 00:00:21 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-09-06 17:25:49 +0000

    newvers.sh: Speed up git_tree_modified
    
    We're looking for file content differences, so ask the question of git
    more directly. This helps a lot, saving tens of thousands of fork()s,
    when the builder and editor see different stat() results (e.g., UIDs),
    as they might with containers.
    
    Submitted by:   Nathaniel Wesley Filardo <nwf20@cl.cam.ac.uk>
    Reviewed by:    bdrewery, emaste, imp
    Obtained from:  CheriBSD
    MFC after:      3 days
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D27646
    
    PR:             252028
    
    (cherry picked from commit 17eba5e32a2cf7a217bb9f1e5dcca351f2b71cfc)
---
 sys/conf/newvers.sh | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index e1aa29f8d98d..18ada43e0cbc 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -81,29 +81,7 @@ findvcs()
 
 git_tree_modified()
 {
-	# git diff-index lists both files that are known to have changes as
-	# well as those with metadata that does not match what is recorded in
-	# git's internal state.  The latter case is indicated by an all-zero
-	# destination file hash.
-
-	local fifo
-
-	fifo=$(mktemp -u)
-	mkfifo -m 600 $fifo
-	$git_cmd --work-tree=${VCSTOP} diff-index HEAD > $fifo &
-	while read smode dmode ssha dsha status file; do
-		if ! expr $dsha : '^00*$' >/dev/null; then
-			rm $fifo
-			return 0
-		fi
-		if ! $git_cmd --work-tree=${VCSTOP} diff --quiet -- "${file}"; then
-			rm $fifo
-			return 0
-		fi
-	done < $fifo
-	# No files with content differences.
-	rm $fifo
-	return 1
+	! $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c core.fileMode=off diff --quiet
 }
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209061908.286J8SUo009686>