X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=clone2current;h=92590b97f73562f4255a2ca31f5e77d9539189d0;hb=f48b49196fe5c3f0bf50bb1c0fc4773d5bcd78b1;hp=583a895e378fc4c778066565d2ea76c06ad98a08;hpb=38ab9e31c986f27acc4f45364bacfac18edf7bc4;p=git-scripts.git diff --git a/clone2current b/clone2current index 583a895..92590b9 100755 --- a/clone2current +++ b/clone2current @@ -1,7 +1,7 @@ #! /bin/sh if [ -z "$1" ]; then - echo "Usage: $0 repoistory" >&2 + echo "Usage: $0 repoistory [directories]" >&2 exit 1 fi @@ -13,6 +13,11 @@ if [ ! -d ".git" ]; then fi && cd "$HOME"/current/projects && +directories="$2" && +if [ -n "$directories" ]; then + mkdir -p "$directories" && cd "$directories" +fi && + dest_dir="`basename \"$source_dir\"`" && git clone "$source_dir" "$dest_dir" && @@ -20,10 +25,13 @@ cd "$dest_dir" && if [ "`cat \"$source_dir\"/.git/description`" = \ "Unnamed repository; edit this file 'description' to name the repository." ] then - "${VISUAL:-${EDITOR:-vi}}" "$source_dir"/.git/description .git/description + `git var GIT_EDITOR` "$source_dir"/.git/description .git/description else cp -p "$source_dir"/.git/description .git fi && cd "$source_dir" && +if [ -n "$directories" ]; then + dest_dir="$directories/$dest_dir" +fi && exec git remote add current "$HOME"/current/projects/"$dest_dir"