add note about license
[small-misc-bash] / gitget
diff --git a/gitget b/gitget
index a61c11479b850f9b2642e14a67ec38edf387f1e2..e177a30f730f22b559451ff0a00b6d9bd9d3347f 100755 (executable)
--- a/gitget
+++ b/gitget
@@ -1,5 +1,12 @@
 #!/bin/bash
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,6 +20,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 gitget() {
     local help="Usage: gitget [--help] [REPO_URL] [REPO_DIR]
 Idempotent git clone/pull
@@ -38,23 +46,11 @@ REPO_DIR is, or will become the root of the repo."
     local workingdir
     local orig_dir="$PWD"
     local ret
-    if [[ $1 == *[^/].git ]]; then
-        if [[ $2 ]]; then
-            workingdir="$2"
-        else
-            workingdir="${1##*/}"
-            workingdir="${workingdir%.git}"
-        fi
-    elif (( $# == 2 )); then
-        echo error: 2 arguments given but the first does not end in .git
-        echo "$help"
-        return 1
+    if [[ $2 ]]; then
+        workingdir="$2"
     else
-        workingdir="$1"
-        if [[ ! -d $workingdir/.git ]]; then
-            echo "error: expected $workingdir/.git to exist"
-            return 1
-        fi
+        workingdir="${1##*/}"
+        workingdir="${workingdir%.git}"
     fi
     [[ -d $workingdir ]] || mkdir -p "$workingdir"
     cd "$workingdir"