[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 2bb3da7 3/3: doc/genauthors: won't link to .ma
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 2bb3da7 3/3: doc/genauthors: won't link to .mailmap if it already exists |
Date: |
Fri, 30 Aug 2019 07:03:34 -0400 (EDT) |
branch: master
commit 2bb3da7b879b0d2d1d1778c69d0853b80d02a4e5
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
doc/genauthors: won't link to .mailmap if it already exists
Until now, `doc/genauthors' was assuming that it is run within the
project's `doc' directory. However, it may happen (happened to me!) that it
is run within the top project directory. In this scenario, it will delete
the `.mailmap' file.
With this commit, it checks the file's existance (as a link or as a normal
file) and a link is only made (and later deleted) when it didn't already
exist.
---
doc/genauthors | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/genauthors b/doc/genauthors
index c26b69f..42806e9 100755
--- a/doc/genauthors
+++ b/doc/genauthors
@@ -44,7 +44,13 @@ if [ -d $1/.git ]; then
# directory. The original `.mailmap' is in the `TOP_SRCDIR', so even
# when the source and build directories are the same, there is no
# problem.
- ln -s $1/.mailmap .mailmap
+ #
+ # But in case `.mailmap' already exists (for example the script is run
+ # in the top source directory not from the `doc' directory, or if a
+ # symbolic link was already created), we won't do any copying.
+ if [ -e .mailmap ]; then keepmailmap=1;
+ else keepmailmap=0; ln -s $1/.mailmap .mailmap;
+ fi
# Do NOT test if authors.texi is newer than ../.git. In some cases the
# list of authors is created empty when running make in top directory
@@ -57,8 +63,8 @@ if [ -d $1/.git ]; then
printf("(%s, %s)@*\n", $NF, $1)}' \
> $1/doc/authors.texi
- # Clean up:
- rm .mailmap
+ # Clean up (if necessary)
+ if [ $keepmailmap = 0 ]; then rm .mailmap; fi
# Check if the authors.texi file was actually written:
if [ ! -s $1/doc/authors.texi ]; then