From: Glenn Morris Date: Wed, 31 Jan 2018 20:05:14 +0000 (-0500) Subject: automerge: add option to work in specific directory X-Git-Tag: emacs-27.0.90~5763 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=113963a89d3f5d2692a56007676b78104f6dfce7;p=emacs.git automerge: add option to work in specific directory * admin/automerge (usage): Mention -d. (dir): New variable. (-d): New option. (main): If requested, cd to specified directory. --- diff --git a/admin/automerge b/admin/automerge index 218ecb067c7..6182ad01a55 100755 --- a/admin/automerge +++ b/admin/automerge @@ -28,6 +28,11 @@ ## Intended usage: ## Have a dedicated git directory just for this. ## Have a cron job that calls this script with -r -p. +## +## Modifying a running shell script can have unpredictable results, +## so the paranoid will first make a copy of this script, and then run +## it with the -d option to point to the repository directory, in case +## a pull updates this script while it is working. die () # write error to stderr and exit { @@ -40,20 +45,14 @@ PD=${0%/*} [ "$PD" = "$0" ] && PD=. # if PATH includes PWD -## This should be the admin directory. -cd $PD -cd ../ -[ -d admin ] || die "Could not locate admin directory" - -[ -e .git ] || die "No .git" - usage () { cat 1>&2 < /dev/null