aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndrew Gallatin <gallatin@FreeBSD.org>2019-01-04 18:38:27 +0000
committerAndrew Gallatin <gallatin@FreeBSD.org>2019-01-04 18:38:27 +0000
commit35bc37b6b9e68e6fd699497e89dd805a9fd734e1 (patch)
tree56e2da2d62ed309e1913709fd9c028847cb2ee01 /sys
parent6871d4882591c9a8fcab24d084c93f0a2972e1af (diff)
downloadsrc-35bc37b6b9e68e6fd699497e89dd805a9fd734e1.tar.gz
src-35bc37b6b9e68e6fd699497e89dd805a9fd734e1.zip
Limit git history searches in newvers.sh
newvers.sh takes upwards of 4-5 seconds to complete on trees checked out from github, due to searching the entire history for non-existent git-svn metadata. Similarly, if one does not check out notes, we again search the entire history for notes. That makes newvers.sh very slow for many github users. To fix this in a fair way, limit the history search to the last 10K commits: if you're more than 10K commits out of sync, then you've forked the project, and our SVN rev is no longer very important to you. Due to how git implements --grep in conjunction with -n, --grep has been removed for performance reasons (git does not seem to limit its search to the -n limit in this case, and takes just as long as it did with no limit). Reviewed by: emaste, imp Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18745
Notes
Notes: svn path=/head/; revision=342774
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/newvers.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index e9bf915ae648..b8b6d66d4e85 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -243,11 +243,15 @@ if [ -n "$git_cmd" ] ; then
svn=" r${gitsvn}"
git="=${git}"
else
- gitsvn=`$git_cmd log --grep '^git-svn-id:' | \
+# Log searches are limited to 10k commits to speed up failures.
+# We assume that if a tree is more than 10k commits out-of-sync
+# with FreeBSD, it has forked the the OS and the SVN rev no
+# longer matters.
+ gitsvn=`$git_cmd log -n 10000 |
grep '^ git-svn-id:' | head -1 | \
sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'`
if [ -z "$gitsvn" ] ; then
- gitsvn=`$git_cmd log --format='format:%N' | \
+ gitsvn=`$git_cmd log -n 10000 --format='format:%N' | \
grep '^svn ' | head -1 | \
sed -n 's/^.*revision=\([0-9][0-9]*\).*$/\1/p'`
fi