Created
February 1, 2012 05:38
-
-
Save mgirouard/1715320 to your computer and use it in GitHub Desktop.
Index all vendor repositories in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function git_uri () | |
{ | |
echo $(git remote -v | grep "$1" | grep "fetch" | sed -E -e 's/^[a-z]+| |\(.+\)//g') | |
} | |
for VENDOR in `ls`; do | |
# Skip files | |
[[ -f $VENDOR ]] && continue | |
# Enter the directory (Git requires this for some reason) | |
pushd $VENDOR > /dev/null | |
# Determine repo type | |
[[ -d .git ]] && TYPE="Git" || TYPE="SVN" | |
if [[ $TYPE == 'Git' ]]; then | |
URL=$(git_uri 'origin') | |
UPSTREAM=$(git_uri 'upstream') | |
else | |
URL=$(svn info | grep "URL" | sed -E -e 's/URL: +//g') | |
fi | |
echo "$TYPE $VENDOR $URL $UPSTREAM" | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment