Page MenuHomeFreeBSD

D15968.id44314.diff
No OneTemporary

D15968.id44314.diff

Index: sys/conf/newvers.sh
===================================================================
--- sys/conf/newvers.sh
+++ sys/conf/newvers.sh
@@ -65,7 +65,8 @@
cd ${SYSDIR}/..
while [ $(pwd) != "/" ]; do
if [ -e "./$1" ]; then
- VCSDIR=$(pwd)"/$1"
+ VCSTOP=$(pwd)
+ VCSDIR=${VCSTOP}"/$1"
cd ${savedir}
return 0
fi
@@ -75,6 +76,32 @@
return 1
}
+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 later case is indicated by an all-zero
+ # destination file SHA.
+ 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 ! (cd "${VCSTOP}" && $git_cmd diff --quiet -- "$file"); then
+ rm $fifo
+ return 0
+ fi
+ done < $fifo
+ # No files with content differences.
+ rm $fifo
+ return 1
+}
+
+
if [ -z "${SYSDIR}" ]; then
SYSDIR=$(dirname $0)/..
fi
@@ -239,8 +266,7 @@
if [ -n "$git_b" ] ; then
git="${git}(${git_b})"
fi
- if $git_cmd --work-tree=${VCSDIR}/.. diff-index \
- --name-only HEAD | read dummy; then
+ if git_tree_modified; then
git="${git}-dirty"
modified=true
fi

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 27, 7:49 PM (59 m, 33 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37413708
Default Alt Text
D15968.id44314.diff (1 KB)

Event Timeline