From 453ece11323f34aca8288c288aced4cc2142b428 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 18 Apr 2018 17:13:56 +0800 Subject: git: Update git shell commands; add git-cmds tag --- roles/git/files/git-shell-commands/list | 4 ++-- roles/git/files/git-shell-commands/make-private | 2 +- roles/git/files/git-shell-commands/make-public | 2 +- roles/git/tasks/main.yml | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/git/files/git-shell-commands/list b/roles/git/files/git-shell-commands/list index 2977541..47e64e1 100644 --- a/roles/git/files/git-shell-commands/list +++ b/roles/git/files/git-shell-commands/list @@ -8,10 +8,10 @@ . ${HOME}/vars.conf -for repo in $(ls -d *.git); do +for repo in $(ls -d ${HOME}/*.git); do is_bare_repo=$(git --git-dir="${repo}" rev-parse --is-bare-repository) if [ "${is_bare_repo}" = "true" ]; then - echo "* ${repo}" + echo "* $(basename ${repo})" if [ -e "${PUBLIC}/${repo}" ]; then echo " [public]" fi diff --git a/roles/git/files/git-shell-commands/make-private b/roles/git/files/git-shell-commands/make-private index 432d847..566b017 100644 --- a/roles/git/files/git-shell-commands/make-private +++ b/roles/git/files/git-shell-commands/make-private @@ -17,7 +17,7 @@ fi project="${1%.[gG][iI][tT]}.git" -if [ ! -d "${project}" ]; then +if [ ! -d "${HOME}/${project}" ]; then echo "ERROR: repository '${project}' not exists!" exit 2 elif [ -L "${PUBLIC}/${project}" ]; then diff --git a/roles/git/files/git-shell-commands/make-public b/roles/git/files/git-shell-commands/make-public index f1dfb1d..52546ee 100644 --- a/roles/git/files/git-shell-commands/make-public +++ b/roles/git/files/git-shell-commands/make-public @@ -23,7 +23,7 @@ fi project="${1%.[gG][iI][tT]}.git" -if [ ! -d "${project}" ]; then +if [ ! -d "${HOME}/${project}" ]; then echo "ERROR: repository '${project}' not exists!" exit 3 elif [ -L "${PUBLIC}/${project}" ]; then diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 90eba2b..c54b2aa 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -50,12 +50,14 @@ copy: src: git-shell-commands/ # trailing '/' -> directory contents dest: "{{ git.user.home }}/git-shell-commands/" + tags: git-cmds - name: add execution permission to git-shell commands file: path: "{{ git.user.home }}/git-shell-commands" mode: 0755 recurse: true + tags: git-cmds - name: (local) github sync - check ssh key existence become: false -- cgit v1.2.2