lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master a8e0d02 2/2: Replace complex manual commands


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a8e0d02 2/2: Replace complex manual commands with a script
Date: Sun, 12 Nov 2017 18:41:37 -0500 (EST)

branch: master
commit a8e0d0258afe16d334d824226503849645749a6f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Replace complex manual commands with a script
---
 check_git_setup.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gwc/develop2.txt   | 37 +++++-------------------------------
 2 files changed, 60 insertions(+), 32 deletions(-)

diff --git a/check_git_setup.sh b/check_git_setup.sh
new file mode 100755
index 0000000..66b18cf
--- /dev/null
+++ b/check_git_setup.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Ensure sound git configuration.
+
+# Copyright (C) 2017 Gregory W. Chicares.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# http://savannah.nongnu.org/projects/lmi
+# email: <address@hidden>
+# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+# For msw (cygwin) only, make sure 'core.filemode' is "false". See:
+#   https://lists.nongnu.org/archive/html/lmi/2017-11/msg00018.html
+
+if [ "$(expr substr $(uname -s) 1 6)" = "CYGWIN" ]
+then
+    printf "cygwin detected\n"
+    git config --global core.filemode false
+fi
+
+printf "core.filemode is '%s'\n" $(git config --get-all core.filemode)
+
+# Make sure the hooks in the repository's hooks/ directory are used.
+
+cd $(git rev-parse --show-toplevel)
+case "$(readlink -f .git/hooks)" in
+  ("$(pwd)/.git/hooks")
+    printf "must reconfigure git hooks directory\n"
+    mv .git/hooks .git/hooks-orig
+    ln --symbolic --force --no-dereference ../hooks .git
+    ;;
+  ("$(pwd)/hooks")
+    printf "git hooks directory is properly symlinked\n"
+    ;;
+  (*)
+    printf "unanticipated error\n"
+    ;;
+esac
+
+printf "  'readlink -f .git/hooks':\n"
+printf "    expected '%s'\n" "$(pwd)"/hooks
+printf "    observed '%s'\n" "$(readlink -f .git/hooks)"
+
diff --git a/gwc/develop2.txt b/gwc/develop2.txt
index 0ef3984..d1ecd09 100644
--- a/gwc/develop2.txt
+++ b/gwc/develop2.txt
@@ -3,46 +3,19 @@
   # Discussed in detail here:
   #   http://lists.nongnu.org/archive/html/lmi/2016-03/msg00031.html
 
-  # First of all, to avoid agony, do the following for msw (cygwin)
-  # only, for the reasons given here:
-  #   https://lists.nongnu.org/archive/html/lmi/2017-11/msg00018.html
-
-git config --global core.filemode false
-
   # Initial setup: create a working copy, cloned from the
   # already-provided "blessed" repo...
 
 cd /opt/lmi
 git clone file:///opt/lmi/blessed/proprietary
 
-  # ...then symlink its hooks/ directory:
-
-cd /opt/lmi/proprietary
-mv .git/hooks .git/hooks-orig
-ln --symbolic --force --no-dereference ../hooks .git
-
-  # When migrating to a new machine, restore that symlink explicitly
-  # in case the working copy was transferred by simplistic means:
-
-cd /opt/lmi/proprietary
-ln --symbolic --force --no-dereference ../hooks .git
-
-  # To verify proper setup at any time:
+  # ...then make sure it's set up as intended:
 
 cd /opt/lmi/proprietary
-readlink -f .git/hooks
-
-  # The output should be
-  #   /opt/lmi/proprietary/hooks
-  # indicating that everything is in order. If the output is
-  #   /opt/lmi/.git/hooks
-  # then the 'ln' command above has not executed correctly.
-
-  # For msw (cygwin) only, this command:
-
-git config --get-all core.filemode
+./check_git_setup.sh
 
-  # should print the word "false".
+  # ...and do that also when migrating to a new machine, in case a
+  # working copy was transferred by simplistic means.
 
   # Create a bundle to share by email
 
@@ -86,7 +59,7 @@ rm proprietary.dat proprietary.ndx
   # msw cross build:
 wine /opt/lmi/bin/rate_table_tool --accept --file=proprietary 
--merge=/opt/lmi/proprietary/tables
 
-  # When committing fails
+  # To recover from errors
 
   # As long as git hooks are set up correctly, every commit is tested
   # for common problems, and fails if any are found. Take these steps



reply via email to

[Prev in Thread] Current Thread [Next in Thread]