Created attachment 220789 [details] git_tree_modiied inversion check patch I've made a tiny shell script to demonstrate the problem, but it looks like the dirty/clean logic is inverted. #!/bin/sh - git_tree_modified() { git -c core.checkStat=minimal -c core.fileMode=off diff --quiet if [ $? -eq 0 ]; then return 1; else return 0; fi } export git=foo if git_tree_modified; then git="${git}-dirty" fi echo $git
Smaller change: diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index f5e34b4946a5..5ce93567e3af 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -162,7 +162,7 @@ findvcs() git_tree_modified() { - $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c core.fileMode=off diff --quiet + ! $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c core.fileMode=off diff --quiet } I'll commit this once the git repo is opened for commits
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=17eba5e32a2cf7a217bb9f1e5dcca351f2b71cfc commit 17eba5e32a2cf7a217bb9f1e5dcca351f2b71cfc Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2020-12-23 04:31:15 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2020-12-23 04:31:15 +0000 newvers.sh: fix sense of git dirty check Previously we reported -dirty for an unmodified tree, and no -dirty if there were changes. PR: 252028 Reported by: John Kennedy sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/12 references this bug: 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(-)