Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 2020 00:00:21 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368709 - head/sys/conf
Message-ID:  <202012170000.0BH00L3v027587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Dec 17 00:00:21 2020
New Revision: 368709
URL: https://svnweb.freebsd.org/changeset/base/368709

Log:
  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

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Wed Dec 16 22:25:40 2020	(r368708)
+++ head/sys/conf/newvers.sh	Thu Dec 17 00:00:21 2020	(r368709)
@@ -162,29 +162,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 || exit 1
-	$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
 }
 
 LC_ALL=C; export LC_ALL



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