From 0e721f7973c9020dc691d27373d6746e5aa7a624 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Tue, 30 May 2017 10:47:13 +0200 Subject: [PATCH] improve gitfetcher/lister and add pretty overview log --- gitconfig | 1 + local/bin/gitfetcher | 21 ++++++++++++++------- local/bin/gitlister | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) create mode 120000 local/bin/gitlister diff --git a/gitconfig b/gitconfig index 23734b5..8480ec6 100644 --- a/gitconfig +++ b/gitconfig @@ -16,3 +16,4 @@ gpgsign = true [alias] pushf = push --force-with-lease + lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit diff --git a/local/bin/gitfetcher b/local/bin/gitfetcher index 0b875cf..ac4d3e1 100755 --- a/local/bin/gitfetcher +++ b/local/bin/gitfetcher @@ -2,16 +2,23 @@ wd="$(pwd)" temp="$(mktemp)" +name="$(basename "$0")" find /data -name '.git' -exec dirname \{\} \; | while read gitrepo; do cd "$gitrepo" - echo "$gitrepo" - - git remote | while read remote; do - git fetch --prune "$remote" - done 2>&1 | sed 's/^/ /' - - git status | grep behind | sed 's/^/ /' + case "$name" in + "gitfetcher") + echo "$gitrepo" + git remote | while read remote; do + git fetch --prune "$remote" + done 2>&1 | sed 's/^/ /' + ;; + "gitlister") + if git status | grep -q behind; then + echo "$gitrepo" + fi + ;; + esac done cd "$wd" diff --git a/local/bin/gitlister b/local/bin/gitlister new file mode 120000 index 0000000..a4fa5b1 --- /dev/null +++ b/local/bin/gitlister @@ -0,0 +1 @@ +gitfetcher \ No newline at end of file