11#! /bin/sh
22
33usage () {
4- echo " usage:" $@
5- exit 127
4+ echo " usage:" $@
5+ exit 127
66}
77
88die () {
9- echo $@
10- exit 128
9+ echo $@
10+ exit 128
1111}
1212
1313if test $# -lt 2 || test $# -gt 3
1414then
15- usage " $0 <repository> <new_workdir> [<branch>]"
15+ usage " $0 <repository> <new_workdir> [<branch>]"
1616fi
1717
1818orig_git=$1
@@ -26,32 +26,32 @@ git_dir=$(cd "$orig_git" 2>/dev/null &&
2626
2727case " $git_dir " in
2828.git)
29- git_dir=" $orig_git /.git"
30- ;;
29+ git_dir=" $orig_git /.git"
30+ ;;
3131.)
32- git_dir=$orig_git
33- ;;
32+ git_dir=$orig_git
33+ ;;
3434esac
3535
3636# don't link to a configured bare repository
3737isbare=$( git --git-dir=" $git_dir " config --bool --get core.bare)
3838if test ztrue = z$isbare
3939then
40- die " \" $git_dir \" has core.bare set to true," \
41- " remove from \" $git_dir /config\" to use $0 "
40+ die " \" $git_dir \" has core.bare set to true," \
41+ " remove from \" $git_dir /config\" to use $0 "
4242fi
4343
4444# don't link to a workdir
4545if test -h " $git_dir /config"
4646then
47- die " \" $orig_git \" is a working directory only, please specify" \
48- " a complete repository."
47+ die " \" $orig_git \" is a working directory only, please specify" \
48+ " a complete repository."
4949fi
5050
5151# don't recreate a workdir over an existing repository
5252if test -e " $new_workdir "
5353then
54- die " destination directory '$new_workdir ' already exists."
54+ die " destination directory '$new_workdir ' already exists."
5555fi
5656
5757# make sure the links use full paths
@@ -65,12 +65,12 @@ mkdir -p "$new_workdir/.git" || die "unable to create \"$new_workdir\"!"
6565# directory, and should not be shared.
6666for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn
6767do
68- case $x in
69- * /* )
70- mkdir -p " $( dirname " $new_workdir /.git/$x " ) "
71- ;;
72- esac
73- ln -s " $git_dir /$x " " $new_workdir /.git/$x "
68+ case $x in
69+ * /* )
70+ mkdir -p " $( dirname " $new_workdir /.git/$x " ) "
71+ ;;
72+ esac
73+ ln -s " $git_dir /$x " " $new_workdir /.git/$x "
7474done
7575
7676# now setup the workdir
@@ -80,3 +80,4 @@ cp "$git_dir/HEAD" .git/HEAD
8080# checkout the branch (either the same as HEAD from the original repository, or
8181# the one that was asked for)
8282git checkout -f $branch
83+
0 commit comments