Make git-clone --use-separate-remote the default
We've talked about this for quite some time on the list, and it is a sane thing to do for a repository with an associcated working tree. For somebody who wants to use the traditional layout, there is a backward compatibility option --use-immingled-remote, but it is expected to be removed before the next major release. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
Petr Baudis committed
Nov 23, 2006 at 23:58 UTC
7182135189d1942d8538a0d0c17fc79f5cb82c71
2 files changed
+25
-13
Documentation/git-clone.txt
+18
-6
@@ -11,7 +11,8 @@ SYNOPSIS
11
[verse]
12
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
13
[-o <name>] [-u <upload-pack>] [--reference <repository>]
14
- [--use-separate-remote] <repository> [<directory>]
14
+ [--use-separate-remote | --use-immingled-remote] <repository>
15
+ [<directory>]
16
17
DESCRIPTION
18
-----------
@@ -71,9 +72,13 @@ OPTIONS
72
Make a 'bare' GIT repository. That is, instead of
73
creating `<directory>` and placing the administrative
74
files in `<directory>/.git`, make the `<directory>`
74
- itself the `$GIT_DIR`. This implies `-n` option. When
75
- this option is used, neither the `origin` branch nor the
76
- default `remotes/origin` file is created.
75
+ itself the `$GIT_DIR`. This obviously implies the `-n`
76
+ because there is nowhere to check out the working tree.
77
+ Also the branch heads at the remote are copied directly
78
+ to corresponding local branch heads, without mapping
79
+ them to `refs/remotes/origin/`. When this option is
80
+ used, neither the `origin` branch nor the default
81
+ `remotes/origin` file is created.
82
83
--origin <name>::
84
-o <name>::
@@ -97,8 +102,15 @@ OPTIONS
102
103
--use-separate-remote::
104
Save remotes heads under `$GIT_DIR/remotes/origin/` instead
100
- of `$GIT_DIR/refs/heads/`. Only the master branch is saved
101
- in the latter.
105
+ of `$GIT_DIR/refs/heads/`. Only the local master branch is
106
+ saved in the latter. This is the default.
107
+
108
+--use-immingled-remote::
109
+ Save remotes heads in the same namespace as the local
110
+ heads, `$GIT_DIR/refs/heads/'. In regular repositories,
111
+ this is a legacy setup git-clone created by default in
112
+ older Git versions, and will be removed before the next
113
+ major release.
114
115
<repository>::
116
The (possibly remote) repository to clone from. It can
git-clone.sh
+7
-7
@@ -14,7 +14,7 @@ die() {
14
}
15
16
usage() {
17
- die "Usage: $0 [--template=<template_directory>] [--use-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
17
+ die "Usage: $0 [--template=<template_directory>] [--use-immingled-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
18
}
19
20
get_repo_base() {
@@ -115,7 +115,7 @@ bare=
115
reference=
116
origin=
117
origin_override=
118
-use_separate_remote=
118
+use_separate_remote=t
119
while
120
case "$#,$1" in
121
0,*) break ;;
@@ -134,7 +134,10 @@ while
134
template="$1" ;;
135
*,-q|*,--quiet) quiet=-q ;;
136
*,--use-separate-remote)
137
+ # default
138
use_separate_remote=t ;;
139
+ *,--use-immingled-remote)
140
+ use_separate_remote= ;;
141
1,--reference) usage ;;
142
*,--reference)
143
shift; reference="$1" ;;
@@ -169,18 +172,15 @@ repo="$1"
172
test -n "$repo" ||
173
die 'you must specify a repository to clone.'
174
172
-# --bare implies --no-checkout
175
+# --bare implies --no-checkout and --use-immingled-remote
176
if test yes = "$bare"
177
then
178
if test yes = "$origin_override"
179
then
180
die '--bare and --origin $origin options are incompatible.'
181
fi
179
- if test t = "$use_separate_remote"
180
- then
181
- die '--bare and --use-separate-remote options are incompatible.'
182
- fi
182
no_checkout=yes
183
+ use_separate_remote=
184
fi
185
186
if test -z "$origin"