]> git.phdru.name Git - git-scripts.git/blob - clone2current
Comment out messing with remote refs
[git-scripts.git] / clone2current
1 #! /bin/sh
2
3 if [ -z "$1" ]; then
4    echo "Usage: $0 repoistory" >&2
5    exit 1
6 fi
7
8 cd "$1" && source_dir="`pwd`" &&
9
10 if [ ! -d ".git" ]; then
11    echo "$source_dir is not a repoistory (.git isn't found)" >&2
12    exit 1
13 fi &&
14
15 cd "$HOME"/current/projects &&
16 dest_dir="`basename \"$source_dir\"`" &&
17 git clone "$source_dir" "$dest_dir" &&
18
19 cd "$dest_dir" &&
20 if [ "`cat \"$source_dir\"/.git/description`" = \
21    "Unnamed repository; edit this file 'description' to name the repository." ]
22 then
23    "${VISUAL:-${EDITOR:-vi}}" "$source_dir"/.git/description .git/description
24 else
25    cp -p "$source_dir"/.git/description .git
26 fi &&
27
28 cd "$source_dir" &&
29 exec git remote add current "$HOME"/current/projects/"$dest_dir"