summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2015-05-08 20:45:22 -0400
committerGlenn Morris <rgm@gnu.org>2015-05-08 20:45:22 -0400
commit907606c84fc35387a84a2de2ee37f9bb25bce567 (patch)
tree964924a9e208ff827fb95978aa3b5087ba54e0d6 /build-aux
parent36c6d20bea2f8af4de126d0d503e3904ee7ab484 (diff)
Add command-line option-parsing to gitlog-to-emacslog.
* build-aux/gitlog-to-emacslog: Add command-line options. By default, refuse to remove an existing output file. * Makefile.in (CHANGELOG): Update default. (ChangeLog): Do not test for existing file. (change-history-nocommit): Ensure temp file does not exist.
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/gitlog-to-emacslog23
1 files changed, 17 insertions, 6 deletions
diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog
index a657cce0b6..2e5741c16f 100755
--- a/build-aux/gitlog-to-emacslog
+++ b/build-aux/gitlog-to-emacslog
@@ -24,15 +24,26 @@ export LC_ALL
# The newest revision that should not appear in the generated ChangeLog.
gen_origin=2c1b8604946efbcd8ec5dd6c6dda7541ce4fc3c0
-test -n "$1" && test "$1" != "." && gen_origin=$1
-
-output=$2
-test -n "$output" || output=ChangeLog
+force=
+output=ChangeLog
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -g|--gen-origin) gen_origin="$2" ; shift ;;
+ -f|--force) force=1 ;;
+ -o|--output) output="$2" ; shift ;;
+ *) echo "Unrecognized argument: $1" >&2; exit 1 ;;
+ esac
+ shift
+done
+
+if [ -f "${distprefix}$output" ]; then
+ [ ! "$force" ] && echo "${distprefix}$output exists" && exit 1
+ rm -f "${distprefix}$output" || exit 1
+fi
# If this is not a Git repository, just generate an empty ChangeLog.
test -d ${srcprefix}.git || {
- # Remove any old ChangeLog, in case it is a vc-dwim symlink.
- rm -f "${distprefix}$output" || exit
>"${distprefix}$output"
exit
}