1*c66ec88fSEmmanuel Vadot#!/bin/bash 2*c66ec88fSEmmanuel Vadot 3*c66ec88fSEmmanuel Vadotcase $1 in 4*c66ec88fSEmmanuel Vadot v*-dts) ;; 5*c66ec88fSEmmanuel Vadot '') 6*c66ec88fSEmmanuel Vadot echo >&2 "No version given" 7*c66ec88fSEmmanuel Vadot exit 1 8*c66ec88fSEmmanuel Vadot ;; 9*c66ec88fSEmmanuel Vadot *) 10*c66ec88fSEmmanuel Vadot echo >&2 "Unexpected version: $1" 11*c66ec88fSEmmanuel Vadot exit 1 12*c66ec88fSEmmanuel Vadot ;; 13*c66ec88fSEmmanuel Vadotesac 14*c66ec88fSEmmanuel Vadot 15*c66ec88fSEmmanuel Vadotv=$1 16*c66ec88fSEmmanuel Vadot 17*c66ec88fSEmmanuel Vadotset -e 18*c66ec88fSEmmanuel Vadot 19*c66ec88fSEmmanuel Vadot# Use the date of Linus' originally tagged commit for the merge. This might 20*c66ec88fSEmmanuel Vadot# differ from what the commit that the rewritten tag points to, since the 21*c66ec88fSEmmanuel Vadot# orignal commit may have been discarded. 22*c66ec88fSEmmanuel Vadotexport GIT_AUTHOR_DATE=$(git log -1 --format=%ad "${v%-dts}") 23*c66ec88fSEmmanuel Vadotif [ ! "${GIT_AUTHOR_DATE}" ] ; then 24*c66ec88fSEmmanuel Vadot echo >&2 "Unable to determine commit date for merge" 25*c66ec88fSEmmanuel Vadot exit 1 26*c66ec88fSEmmanuel Vadotfi 27*c66ec88fSEmmanuel Vadotif [ "${v}" = "v2.6.12-rc2-dts" ] ; then 28*c66ec88fSEmmanuel Vadot auh="--allow-unrelated-histories" 29*c66ec88fSEmmanuel Vadotfi 30*c66ec88fSEmmanuel Vadotgit merge $auh --no-edit "${v}-raw" 31*c66ec88fSEmmanuel Vadotgit clean -fdqx 32*c66ec88fSEmmanuel Vadot# Use the date of Linus' original tag for the tag. 33*c66ec88fSEmmanuel Vadotcase "${v%-dts}" in 34*c66ec88fSEmmanuel Vadot v2.6.12*|v2.6.13-rc[123]) 35*c66ec88fSEmmanuel Vadot # Commits from v2.6.12-rc2..v2.6.13-rc3 lacked the date. So use the commit's 36*c66ec88fSEmmanuel Vadot # date. 37*c66ec88fSEmmanuel Vadot export GIT_COMMITTER_DATE="${GIT_AUTHOR_DATE}" 38*c66ec88fSEmmanuel Vadot ;; 39*c66ec88fSEmmanuel Vadot *) 40*c66ec88fSEmmanuel Vadot export GIT_COMMITTER_DATE="$(git for-each-ref --format='%(taggerdate)' "refs/tags/${v%-dts}")" 41*c66ec88fSEmmanuel Vadot ;; 42*c66ec88fSEmmanuel Vadotesac 43*c66ec88fSEmmanuel Vadotif [ ! "${GIT_COMMITTER_DATE}" ] ; then 44*c66ec88fSEmmanuel Vadot echo >&2 "Unable to determine date for tag" 45*c66ec88fSEmmanuel Vadot exit 1 46*c66ec88fSEmmanuel Vadotfi 47*c66ec88fSEmmanuel Vadotgit tag -s -m "Tagging ${v}" -u 695A46C6 "${v}" 48*c66ec88fSEmmanuel Vadotmake -k -j12 -s 49