mirror of
https://github.com/git/git.git
synced 2024-10-30 05:47:53 +01:00
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>
This commit is contained in:
parent
29561ad0ad
commit
7182135189
2 changed files with 25 additions and 13 deletions
|
@ -11,7 +11,8 @@ SYNOPSIS
|
||||||
[verse]
|
[verse]
|
||||||
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
|
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
|
||||||
[-o <name>] [-u <upload-pack>] [--reference <repository>]
|
[-o <name>] [-u <upload-pack>] [--reference <repository>]
|
||||||
[--use-separate-remote] <repository> [<directory>]
|
[--use-separate-remote | --use-immingled-remote] <repository>
|
||||||
|
[<directory>]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
|
@ -71,9 +72,13 @@ OPTIONS
|
||||||
Make a 'bare' GIT repository. That is, instead of
|
Make a 'bare' GIT repository. That is, instead of
|
||||||
creating `<directory>` and placing the administrative
|
creating `<directory>` and placing the administrative
|
||||||
files in `<directory>/.git`, make the `<directory>`
|
files in `<directory>/.git`, make the `<directory>`
|
||||||
itself the `$GIT_DIR`. This implies `-n` option. When
|
itself the `$GIT_DIR`. This obviously implies the `-n`
|
||||||
this option is used, neither the `origin` branch nor the
|
because there is nowhere to check out the working tree.
|
||||||
default `remotes/origin` file is created.
|
Also the branch heads at the remote are copied directly
|
||||||
|
to corresponding local branch heads, without mapping
|
||||||
|
them to `refs/remotes/origin/`. When this option is
|
||||||
|
used, neither the `origin` branch nor the default
|
||||||
|
`remotes/origin` file is created.
|
||||||
|
|
||||||
--origin <name>::
|
--origin <name>::
|
||||||
-o <name>::
|
-o <name>::
|
||||||
|
@ -97,8 +102,15 @@ OPTIONS
|
||||||
|
|
||||||
--use-separate-remote::
|
--use-separate-remote::
|
||||||
Save remotes heads under `$GIT_DIR/remotes/origin/` instead
|
Save remotes heads under `$GIT_DIR/remotes/origin/` instead
|
||||||
of `$GIT_DIR/refs/heads/`. Only the master branch is saved
|
of `$GIT_DIR/refs/heads/`. Only the local master branch is
|
||||||
in the latter.
|
saved in the latter. This is the default.
|
||||||
|
|
||||||
|
--use-immingled-remote::
|
||||||
|
Save remotes heads in the same namespace as the local
|
||||||
|
heads, `$GIT_DIR/refs/heads/'. In regular repositories,
|
||||||
|
this is a legacy setup git-clone created by default in
|
||||||
|
older Git versions, and will be removed before the next
|
||||||
|
major release.
|
||||||
|
|
||||||
<repository>::
|
<repository>::
|
||||||
The (possibly remote) repository to clone from. It can
|
The (possibly remote) repository to clone from. It can
|
||||||
|
|
14
git-clone.sh
14
git-clone.sh
|
@ -14,7 +14,7 @@ die() {
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
die "Usage: $0 [--template=<template_directory>] [--use-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
|
die "Usage: $0 [--template=<template_directory>] [--use-immingled-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_repo_base() {
|
get_repo_base() {
|
||||||
|
@ -115,7 +115,7 @@ bare=
|
||||||
reference=
|
reference=
|
||||||
origin=
|
origin=
|
||||||
origin_override=
|
origin_override=
|
||||||
use_separate_remote=
|
use_separate_remote=t
|
||||||
while
|
while
|
||||||
case "$#,$1" in
|
case "$#,$1" in
|
||||||
0,*) break ;;
|
0,*) break ;;
|
||||||
|
@ -134,7 +134,10 @@ while
|
||||||
template="$1" ;;
|
template="$1" ;;
|
||||||
*,-q|*,--quiet) quiet=-q ;;
|
*,-q|*,--quiet) quiet=-q ;;
|
||||||
*,--use-separate-remote)
|
*,--use-separate-remote)
|
||||||
|
# default
|
||||||
use_separate_remote=t ;;
|
use_separate_remote=t ;;
|
||||||
|
*,--use-immingled-remote)
|
||||||
|
use_separate_remote= ;;
|
||||||
1,--reference) usage ;;
|
1,--reference) usage ;;
|
||||||
*,--reference)
|
*,--reference)
|
||||||
shift; reference="$1" ;;
|
shift; reference="$1" ;;
|
||||||
|
@ -169,18 +172,15 @@ repo="$1"
|
||||||
test -n "$repo" ||
|
test -n "$repo" ||
|
||||||
die 'you must specify a repository to clone.'
|
die 'you must specify a repository to clone.'
|
||||||
|
|
||||||
# --bare implies --no-checkout
|
# --bare implies --no-checkout and --use-immingled-remote
|
||||||
if test yes = "$bare"
|
if test yes = "$bare"
|
||||||
then
|
then
|
||||||
if test yes = "$origin_override"
|
if test yes = "$origin_override"
|
||||||
then
|
then
|
||||||
die '--bare and --origin $origin options are incompatible.'
|
die '--bare and --origin $origin options are incompatible.'
|
||||||
fi
|
fi
|
||||||
if test t = "$use_separate_remote"
|
|
||||||
then
|
|
||||||
die '--bare and --use-separate-remote options are incompatible.'
|
|
||||||
fi
|
|
||||||
no_checkout=yes
|
no_checkout=yes
|
||||||
|
use_separate_remote=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$origin"
|
if test -z "$origin"
|
||||||
|
|
Loading…
Reference in a new issue