| ... | ... | 
                    @@ -7,6 +7,70 @@ host.  | 
            
| 7 | 7 | 
                    [Git]: https://en.wikipedia.org/wiki/Git  | 
            
| 8 | 8 | 
                    [gitolite]: https://gitolite.com  | 
            
| 9 | 9 | 
                     | 
            
| 10 | 
                    +## Usage  | 
            |
| 11 | 
                    +  | 
            |
| 12 | 
                    +`git-gitolite --help`:  | 
            |
| 13 | 
                    +  | 
            |
| 14 | 
                    +```  | 
            |
| 15 | 
                    +git-gitolite 1.0  | 
            |
| 16 | 
                    +  | 
            |
| 17 | 
                    +Manage the counterpart of a local Git repository on a remote gitolite  | 
            |
| 18 | 
                    +host.  | 
            |
| 19 | 
                    +  | 
            |
| 20 | 
                    +usage:  | 
            |
| 21 | 
                    + git-gitolite help  | 
            |
| 22 | 
                    + git-gitolite info  | 
            |
| 23 | 
                    + git-gitolite init <license> [<description> [<references>]]  | 
            |
| 24 | 
                    + git-gitolite remote  | 
            |
| 25 | 
                    + git-gitolite head  | 
            |
| 26 | 
                    + git-gitolite publish  | 
            |
| 27 | 
                    + git-gitolite unpublish  | 
            |
| 28 | 
                    + git-gitolite rm  | 
            |
| 29 | 
                    + git-gitolite <command> [<args>...]  | 
            |
| 30 | 
                    + git-gitolite --help|-h  | 
            |
| 31 | 
                    + git-gitolite --version  | 
            |
| 32 | 
                    +  | 
            |
| 33 | 
                    +commands:  | 
            |
| 34 | 
                    + help  | 
            |
| 35 | 
                    + Runs the gitolite 'help' command.  | 
            |
| 36 | 
                    + info  | 
            |
| 37 | 
                    + Runs the gitolite 'info' command.  | 
            |
| 38 | 
                    + init  | 
            |
| 39 | 
                    + Creates and commits, separately, readme and license files.  | 
            |
| 40 | 
                    + A note about the <license> (which should be an SPDX identifier), as  | 
            |
| 41 | 
                    + well as <description> and <references> if given, is inserted into the  | 
            |
| 42 | 
                    + readme. The readme is opened in the editor configured for git  | 
            |
| 43 | 
                    + for review before each commit. This command then (re)sets the remote  | 
            |
| 44 | 
                    + URL, creates the remote repository and pushes.  | 
            |
| 45 | 
                    + remote  | 
            |
| 46 | 
                    + (Re)sets the remote URL.  | 
            |
| 47 | 
                    + head  | 
            |
| 48 | 
                    + Resets the remote HEAD to point to the same ref as the local HEAD,  | 
            |
| 49 | 
                    + making it the default view on a web server.  | 
            |
| 50 | 
                    + publish  | 
            |
| 51 | 
                    + Grants read permissions to 'gitweb', making it viewable through a  | 
            |
| 52 | 
                    + web server.  | 
            |
| 53 | 
                    + unpublish  | 
            |
| 54 | 
                    + Revokes read permissions from 'gitweb', preventing it from being  | 
            |
| 55 | 
                    + viewable through a web server.  | 
            |
| 56 | 
                    + rm  | 
            |
| 57 | 
                    + (Unlocks and) removes the remote repository.  | 
            |
| 58 | 
                    + <command>  | 
            |
| 59 | 
                    + Perform a gitolite command, filling in the host and repository name  | 
            |
| 60 | 
                    + automatically. See `git-gitolite help` for a list of commands.  | 
            |
| 61 | 
                    +  | 
            |
| 62 | 
                    +environment variables:  | 
            |
| 63 | 
                    + GIT_GITOLITE_USER  | 
            |
| 64 | 
                    + The gitolite user under which repositories are found.  | 
            |
| 65 | 
                    + [default: $USER]  | 
            |
| 66 | 
                    + GIT_GITOLITE_HOST  | 
            |
| 67 | 
                    + The host to connect to.  | 
            |
| 68 | 
                    + [default: git.$(dnsdomainname)]  | 
            |
| 69 | 
                    + GIT_GITOLITE_REMOTE  | 
            |
| 70 | 
                    + The git remote used to identify the gitolite server.  | 
            |
| 71 | 
                    + [default: origin]  | 
            |
| 72 | 
                    +```  | 
            |
| 73 | 
                    +  | 
            |
| 10 | 74 | 
                    ## License  | 
            
| 11 | 75 | 
                     | 
            
| 12 | 76 | 
                    Licensed under the [ISC License][] unless otherwise noted, see the  | 
            
| 13 | 77 | 
                    new file mode 100755  | 
            
| ... | ... | 
                    @@ -0,0 +1,107 @@  | 
            
| 1 | 
                    +#!/bin/sh  | 
            |
| 2 | 
                    +set -euC  | 
            |
| 3 | 
                    +  | 
            |
| 4 | 
                    +##/// git-gitolite 1.0  | 
            |
| 5 | 
                    +#////  | 
            |
| 6 | 
                    +#//// Manage the counterpart of a local Git repository on a remote gitolite  | 
            |
| 7 | 
                    +#//// host.  | 
            |
| 8 | 
                    +#////  | 
            |
| 9 | 
                    +###// usage:  | 
            |
| 10 | 
                    +#//// git-gitolite help  | 
            |
| 11 | 
                    +#//// git-gitolite info  | 
            |
| 12 | 
                    +#//// git-gitolite init <license> [<description> [<references>]]  | 
            |
| 13 | 
                    +#//// git-gitolite remote  | 
            |
| 14 | 
                    +#//// git-gitolite head  | 
            |
| 15 | 
                    +#//// git-gitolite publish  | 
            |
| 16 | 
                    +#//// git-gitolite unpublish  | 
            |
| 17 | 
                    +#//// git-gitolite rm  | 
            |
| 18 | 
                    +#//// git-gitolite <command> [<args>...]  | 
            |
| 19 | 
                    +#//// git-gitolite --help|-h  | 
            |
| 20 | 
                    +#//// git-gitolite --version  | 
            |
| 21 | 
                    +#////  | 
            |
| 22 | 
                    +###// commands:  | 
            |
| 23 | 
                    +####/ help  | 
            |
| 24 | 
                    +#//// Runs the gitolite 'help' command.  | 
            |
| 25 | 
                    +####/ info  | 
            |
| 26 | 
                    +#//// Runs the gitolite 'info' command.  | 
            |
| 27 | 
                    +####/ init  | 
            |
| 28 | 
                    +#//// Creates and commits, separately, readme and license files.  | 
            |
| 29 | 
                    +#//// A note about the <license> (which should be an SPDX identifier), as  | 
            |
| 30 | 
                    +#//// well as <description> and <references> if given, is inserted into the  | 
            |
| 31 | 
                    +#//// readme. The readme is opened in the editor configured for git  | 
            |
| 32 | 
                    +#//// for review before each commit. This command then (re)sets the remote  | 
            |
| 33 | 
                    +#//// URL, creates the remote repository and pushes.  | 
            |
| 34 | 
                    +####/ remote  | 
            |
| 35 | 
                    +#//// (Re)sets the remote URL.  | 
            |
| 36 | 
                    +####/ head  | 
            |
| 37 | 
                    +#//// Resets the remote HEAD to point to the same ref as the local HEAD,  | 
            |
| 38 | 
                    +#//// making it the default view on a web server.  | 
            |
| 39 | 
                    +####/ publish  | 
            |
| 40 | 
                    +#//// Grants read permissions to 'gitweb', making it viewable through a  | 
            |
| 41 | 
                    +#//// web server.  | 
            |
| 42 | 
                    +####/ unpublish  | 
            |
| 43 | 
                    +#//// Revokes read permissions from 'gitweb', preventing it from being  | 
            |
| 44 | 
                    +#//// viewable through a web server.  | 
            |
| 45 | 
                    +####/ rm  | 
            |
| 46 | 
                    +#//// (Unlocks and) removes the remote repository.  | 
            |
| 47 | 
                    +####/ <command>  | 
            |
| 48 | 
                    +#//// Perform a gitolite command, filling in the host and repository name  | 
            |
| 49 | 
                    +#//// automatically. See `git-gitolite help` for a list of commands.  | 
            |
| 50 | 
                    +#////  | 
            |
| 51 | 
                    +###// environment variables:  | 
            |
| 52 | 
                    +####/ GIT_GITOLITE_USER  | 
            |
| 53 | 
                    +#//// The gitolite user under which repositories are found.  | 
            |
| 54 | 
                    +#//// [default: $USER]  | 
            |
| 55 | 
                    +####/ GIT_GITOLITE_HOST  | 
            |
| 56 | 
                    +#//// The host to connect to.  | 
            |
| 57 | 
                    +#//// [default: git.$(dnsdomainname)]  | 
            |
| 58 | 
                    +####/ GIT_GITOLITE_REMOTE  | 
            |
| 59 | 
                    +#//// The git remote used to identify the gitolite server.  | 
            |
| 60 | 
                    +#//// [default: origin]  | 
            |
| 61 | 
                    +  | 
            |
| 62 | 
                    +## Messages  | 
            |
| 63 | 
                    +prog="$(basename "$0")"  | 
            |
| 64 | 
                    +help()    { sed -n 's|^#[#/]*/ \?||p' "$0";                 exit 0; }
                 | 
            |
| 65 | 
                    +version() { help | awk '/^$/{++p;next}p==0';                exit 0; }
                 | 
            |
| 66 | 
                    +usage()   { help | awk '/^$/{++p;next}p==2';                exit 0; }
                 | 
            |
| 67 | 
                    +parse()   { printf '%s: error: %s\n'   "$prog" "$1"; usage; exit 1; } >&2
                 | 
            |
| 68 | 
                    +error()   { printf '%s: error: %s\n'   "$prog" "$1";        exit 1; } >&2
                 | 
            |
| 69 | 
                    +warning() { printf '%s: warning: %s\n' "$prog" "$1";                } >&2
                 | 
            |
| 70 | 
                    +opt()     { [ $# -gt 1 ] || parse "option '$1' value not provided"; }
                 | 
            |
| 71 | 
                    +arg()     { [ $# -gt 1 ] || parse "argument '$1' not provided";     }
                 | 
            |
| 72 | 
                    +argend()  { [ $# -eq 0 ] || parse "unrecognized argument '$1'";     }
                 | 
            |
| 73 | 
                    +  | 
            |
| 74 | 
                    +## Parse special options  | 
            |
| 75 | 
                    +case "${1:-}"
                 | 
            |
| 76 | 
                    +in  | 
            |
| 77 | 
                    + '-h'|'--help') help; ;;  | 
            |
| 78 | 
                    + '--version') version; ;;  | 
            |
| 79 | 
                    +esac  | 
            |
| 80 | 
                    +  | 
            |
| 81 | 
                    +## Parse required arguments  | 
            |
| 82 | 
                    +arg 'command' "$@"; command="$1"; shift;  | 
            |
| 83 | 
                    +  | 
            |
| 84 | 
                    +case "$command" in  | 
            |
| 85 | 
                    + 'init')  | 
            |
| 86 | 
                    + ## Parse required arguments  | 
            |
| 87 | 
                    + arg 'license' "$@"; license="$1"; shift;  | 
            |
| 88 | 
                    +  | 
            |
| 89 | 
                    + ## Parse optional arguments  | 
            |
| 90 | 
                    + description='<DESCRIPTION>'  | 
            |
| 91 | 
                    + references=''  | 
            |
| 92 | 
                    +    [ $# -eq 0 ] || { description="$1"; shift; }
                 | 
            |
| 93 | 
                    +    [ $# -eq 0 ] || { references="$1";  shift; }
                 | 
            |
| 94 | 
                    + ;;  | 
            |
| 95 | 
                    +esac  | 
            |
| 96 | 
                    +  | 
            |
| 97 | 
                    +## Parse unrecognized arguments  | 
            |
| 98 | 
                    +case "$command" in  | 
            |
| 99 | 
                    + 'help'|'info'|'init'|'remote'|'head'|'publish'|'unpublish'|'rm')  | 
            |
| 100 | 
                    + argend  | 
            |
| 101 | 
                    + ;;  | 
            |
| 102 | 
                    +esac  | 
            |
| 103 | 
                    +  | 
            |
| 104 | 
                    +## Parse environment variables  | 
            |
| 105 | 
                    +user="${GIT_GITOLITE_USER:-"$USER"}"
                 | 
            |
| 106 | 
                    +host="${GIT_GITOLITE_HOST:-"git.$(dnsdomainname)"}"
                 | 
            |
| 107 | 
                    +remote="${GIT_GITOLITE_REMOTE:-"origin"}"
                 |