From 2a0b5a0714c2a61a475d636104cae27f739fc18a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 20 Mar 2009 13:15:15 +0100 Subject: [PATCH] share/WinGit/release.sh: provide a few safeguards There are some pitfalls when releasing a new installer: as we want to be able to recreate every installer, the version from which the currently installed Git was built needs to be tagged. Check that (and a few other things), and require the flag "--force" if any precondition is not met. The --force flag is needed so that it is still easy to make a quick "release", e.g. when a bug is fixed (so the bug reporter can verify the fix). The order of the checks was chosen by the following measure: the more interesting the check could be even if the user chose to pass --force later, the earlier the check is performed. Signed-off-by: Johannes Schindelin --- share/WinGit/release.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/share/WinGit/release.sh b/share/WinGit/release.sh index ad2c4527..fb8e6779 100644 --- a/share/WinGit/release.sh +++ b/share/WinGit/release.sh @@ -1,11 +1,67 @@ #!/bin/sh +force= +case "$1" in +-f|--force) + force=t + shift + ;; +esac + test -z "$1" && { - echo "Usage: $0 " + echo "Usage: $0 " >&2 exit 1 } version=$1 + +test -z "$force" && { + die () { + echo "$*" >&2 + echo "If that is okay, please call '$0 -f $version'" >&2 + exit 1 + } + + (cd /git && + git update-index --refresh && + git diff-files --quiet && + git diff-index --cached HEAD --) || + die "Git submodule has dirty files" + (cd /git && + test git.exe = $(ls -t git.exe $(git ls-files) | head -n 1)) || + die "Git's git.exe is not up-to-date (run 'cd /git && make' to fix)" + for f in /bin/git* /libexec/git-core/git* + do + case "$f" in + *.manifest) + continue + ;; + */gitk) + basename=gitk-git/gitk + ;; + */git-citool|*/git-gui) + basename=git-gui/git-gui + ;; + */git-gui--askpass|*/git-gui.tcl) + basename=git-gui/$(basename "$f") + ;; + *) + basename=$(basename "$f") + ;; + esac + cmp "$f" "/git/$basename" || + die "Installed Git disagrees with contents of /git/" + done + (cd / && + git update-index --refresh && + git diff-files --quiet && + git diff-index --cached HEAD --) || + die "msysGit super project not up-to-date" + (cd /git && + test ! -z "$(git tag --contains HEAD)") || + die "Git's HEAD is untagged" +} + TMPDIR=/tmp/WinGit /share/WinGit/copy-files.sh $TMPDIR && @@ -15,4 +71,5 @@ homewinpath=$(cd ~ ; pwd -W) && sed -e "s/%APPVERSION%/$version/" -e "s@%OUTPUTDIR%@$homewinpath@" \ < /share/WinGit/install.iss > $TMPDIR/install.iss && echo "Lauching Inno Setup compiler ..." && -/share/InnoSetup/ISCC.exe "$TMPDIR/install.iss" /q | grep -Ev "\s*Reading|\s*Compressing" +/share/InnoSetup/ISCC.exe "$TMPDIR/install.iss" /q | grep -Ev "\s*Reading|\s*Compressing" && +git tag Git-$1 -- 2.11.4.GIT