X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=clone2current;fp=clone2current;h=e79ec715eea3e5f0f87d7fe1ae75c3a06afc9476;hb=66c0623a378dabb5e714afa61ec6dbc6b1bef300;hp=0000000000000000000000000000000000000000;hpb=bc165058ca1cfa91695b67d85a591316d14353e8;p=cookiecutter.git diff --git a/clone2current b/clone2current new file mode 100755 index 0000000..e79ec71 --- /dev/null +++ b/clone2current @@ -0,0 +1,38 @@ +#! /bin/sh + +if [ -z "$1" ]; then + echo "Usage: $0 repoistory [directories]" >&2 + exit 1 +fi + +cd "$1" && source_dir="`pwd`" && + +if [ ! -d ".git" ]; then + echo "$source_dir is not a repoistory (.git isn't found)" >&2 + exit 1 +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" && + +cd "$dest_dir" && +pwd >> "`dirname \"$0\"`"/locate-all.list && +if [ "`cat \"$source_dir\"/.git/description`" = \ + "Unnamed repository; edit this file 'description' to name the repository." ] +then + `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"