about summary refs log tree commit diff
path: root/third_party/git/contrib/git-shell-commands
diff options
context:
space:
mode:
authorVincent Ambo <Vincent Ambo>2020-01-11T23·36+0000
committerVincent Ambo <Vincent Ambo>2020-01-11T23·40+0000
commit7ef0d62730840ded097b524104cc0a0904591a63 (patch)
treea670f96103667aeca4789a95d94ca0dff550c4ce /third_party/git/contrib/git-shell-commands
parent6a2a3007077818e24a3d56fc492ada9206a10cf0 (diff)
parent1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5 (diff)
merge(third_party/git): Merge squashed git subtree at v2.23.0 r/373
Merge commit '1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5' as 'third_party/git'
Diffstat (limited to 'third_party/git/contrib/git-shell-commands')
-rw-r--r--third_party/git/contrib/git-shell-commands/README18
-rwxr-xr-xthird_party/git/contrib/git-shell-commands/help18
-rwxr-xr-xthird_party/git/contrib/git-shell-commands/list10
3 files changed, 46 insertions, 0 deletions
diff --git a/third_party/git/contrib/git-shell-commands/README b/third_party/git/contrib/git-shell-commands/README
new file mode 100644
index 000000000000..438463b16099
--- /dev/null
+++ b/third_party/git/contrib/git-shell-commands/README
@@ -0,0 +1,18 @@
+Sample programs callable through git-shell.  Place a directory named
+'git-shell-commands' in the home directory of a user whose shell is
+git-shell.  Then anyone logging in as that user will be able to run
+executables in the 'git-shell-commands' directory.
+
+Provided commands:
+
+help: Prints out the names of available commands.  When run
+interactively, git-shell will automatically run 'help' on startup,
+provided it exists.
+
+list: Displays any bare repository whose name ends with ".git" under
+user's home directory.  No other git repositories are visible,
+although they might be clonable through git-shell.  'list' is designed
+to minimize the number of calls to git that must be made in finding
+available repositories; if your setup has additional repositories that
+should be user-discoverable, you may wish to modify 'list'
+accordingly.
diff --git a/third_party/git/contrib/git-shell-commands/help b/third_party/git/contrib/git-shell-commands/help
new file mode 100755
index 000000000000..535770c6ec19
--- /dev/null
+++ b/third_party/git/contrib/git-shell-commands/help
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if tty -s
+then
+	echo "Run 'help' for help, or 'exit' to leave.  Available commands:"
+else
+	echo "Run 'help' for help.  Available commands:"
+fi
+
+cd "$(dirname "$0")"
+
+for cmd in *
+do
+	case "$cmd" in
+	help) ;;
+	*) [ -f "$cmd" ] && [ -x "$cmd" ] && echo "$cmd" ;;
+	esac
+done
diff --git a/third_party/git/contrib/git-shell-commands/list b/third_party/git/contrib/git-shell-commands/list
new file mode 100755
index 000000000000..6f8993882114
--- /dev/null
+++ b/third_party/git/contrib/git-shell-commands/list
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+print_if_bare_repo='
+	if "$(git --git-dir="$1" rev-parse --is-bare-repository)" = true
+	then
+		printf "%s\n" "${1#./}"
+	fi
+'
+
+find -type d -name "*.git" -exec sh -c "$print_if_bare_repo" -- \{} \; -prune 2>/dev/null