Add testcase of PR c++/92542, already fixed.
[official-gcc.git] / maintainer-scripts / update_version_git
blobb1b5f4c9cf97548a787f9c2430663e4db68386ec
1 #!/bin/sh
3 # Update the current version date in all files in the tree containing
4 # it. Consider all single-component-version release branches except
5 # those matching the regular expression in $IGNORE_BRANCHES, and also
6 # consider those branches listed in the space separated list in
7 # $ADD_BRANCHES.
9 GITROOT=${GITROOT:-"/git/gcc.git"}
10 IGNORE_BRANCHES='releases/gcc-(.*\..*|5|6|7)'
11 ADD_BRANCHES='master'
13 # Run this from /tmp.
14 export GITROOT
15 BASEDIR=/tmp/$$
16 /bin/rm -rf "$BASEDIR"
17 /bin/mkdir "$BASEDIR"
18 cd "$BASEDIR"
20 GIT=${GIT:-/usr/local/bin/git}
22 # Compute the branches which we should update.
23 BRANCHES=`(cd $GITROOT \
24 && ${GIT} for-each-ref --format='%(refname)' \
25 'refs/heads/releases/gcc-*') \
26 | sed -e 's/refs\/heads\///' \
27 | egrep -v $IGNORE_BRANCHES`
28 # Always update the mainline.
29 BRANCHES="${ADD_BRANCHES} ${BRANCHES}"
31 # This is put into the datestamp files.
32 CURR_DATE=`/bin/date +"%Y%m%d"`
34 datestamp_FILES="gcc/DATESTAMP"
37 # Assume all will go well.
38 RESULT=0
39 SUBDIR=$BASEDIR/gcc
40 for BRANCH in $BRANCHES; do
41 echo "Working on \"$BRANCH\"."
42 # Check out the files on the branch.
43 if [ -d "$SUBDIR" ]; then
44 cd "$SUBDIR"
45 ${GIT} pull -q
46 ${GIT} checkout -q "$BRANCH"
47 else
48 ${GIT} clone -q -b "$BRANCH" "$GITROOT" "$SUBDIR"
51 # There are no files to commit yet.
52 COMMIT_FILES=""
54 cd "$SUBDIR"
55 for file in $datestamp_FILES; do
56 if test -f $file; then
57 echo "${CURR_DATE}" > $file.new
59 if /usr/bin/cmp -s $file $file.new; then
60 rm -f $file.new
61 else
62 mv -f $file.new $file
63 COMMIT_FILES="$COMMIT_FILES $file"
66 done
68 if test -n "$COMMIT_FILES"; then
69 for i in $COMMIT_FILES; do
70 echo "Attempting to commit $i"
71 if ${GIT} commit -m "Daily bump." $i; then
72 if ! ${GIT} push origin "$BRANCH"; then
73 # If we could not push the files, indicate failure.
74 RESULT=1
76 else
77 # If we could not commit the files, indicate failure.
78 RESULT=1
80 done
82 done
84 /bin/rm -rf $BASEDIR
85 exit $RESULT