зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/orphan-unborn' into maint-2.43
Doc updates to clarify what an "unborn branch" means. * jc/orphan-unborn: orphan/unborn: fix use of 'orphan' in end-user facing messages orphan/unborn: add to the glossary and use them consistently
This commit is contained in:
Коммит
974c9369aa
|
@ -140,6 +140,6 @@ advice.*::
|
||||||
Advice shown when a fast-forward is not possible.
|
Advice shown when a fast-forward is not possible.
|
||||||
worktreeAddOrphan::
|
worktreeAddOrphan::
|
||||||
Advice shown when a user tries to create a worktree from an
|
Advice shown when a user tries to create a worktree from an
|
||||||
invalid reference, to instruct how to create a new orphan
|
invalid reference, to instruct how to create a new unborn
|
||||||
branch instead.
|
branch instead.
|
||||||
--
|
--
|
||||||
|
|
|
@ -215,7 +215,7 @@ variable.
|
||||||
below for details.
|
below for details.
|
||||||
|
|
||||||
--orphan <new-branch>::
|
--orphan <new-branch>::
|
||||||
Create a new 'orphan' branch, named `<new-branch>`, started from
|
Create a new unborn branch, named `<new-branch>`, started from
|
||||||
`<start-point>` and switch to it. The first commit made on this
|
`<start-point>` and switch to it. The first commit made on this
|
||||||
new branch will have no parents and it will be the root of a new
|
new branch will have no parents and it will be the root of a new
|
||||||
history totally disconnected from all the other branches and
|
history totally disconnected from all the other branches and
|
||||||
|
|
|
@ -171,7 +171,7 @@ name, the guessing is aborted. You can explicitly give a name with
|
||||||
`branch.autoSetupMerge` configuration variable is true.
|
`branch.autoSetupMerge` configuration variable is true.
|
||||||
|
|
||||||
--orphan <new-branch>::
|
--orphan <new-branch>::
|
||||||
Create a new 'orphan' branch, named `<new-branch>`. All
|
Create a new unborn branch, named `<new-branch>`. All
|
||||||
tracked files are removed.
|
tracked files are removed.
|
||||||
|
|
||||||
--ignore-other-worktrees::
|
--ignore-other-worktrees::
|
||||||
|
|
|
@ -99,7 +99,7 @@ command will refuse to create the worktree (unless `--force` is used).
|
||||||
If `<commit-ish>` is omitted, neither `--detach`, or `--orphan` is
|
If `<commit-ish>` is omitted, neither `--detach`, or `--orphan` is
|
||||||
used, and there are no valid local branches (or remote branches if
|
used, and there are no valid local branches (or remote branches if
|
||||||
`--guess-remote` is specified) then, as a convenience, the new worktree is
|
`--guess-remote` is specified) then, as a convenience, the new worktree is
|
||||||
associated with a new orphan branch named `<branch>` (after
|
associated with a new unborn branch named `<branch>` (after
|
||||||
`$(basename <path>)` if neither `-b` or `-B` is used) as if `--orphan` was
|
`$(basename <path>)` if neither `-b` or `-B` is used) as if `--orphan` was
|
||||||
passed to the command. In the event the repository has a remote and
|
passed to the command. In the event the repository has a remote and
|
||||||
`--guess-remote` is used, but no remote or local branches exist, then the
|
`--guess-remote` is used, but no remote or local branches exist, then the
|
||||||
|
@ -234,7 +234,7 @@ This can also be set up as the default behaviour by using the
|
||||||
|
|
||||||
--orphan::
|
--orphan::
|
||||||
With `add`, make the new worktree and index empty, associating
|
With `add`, make the new worktree and index empty, associating
|
||||||
the worktree with a new orphan/unborn branch named `<new-branch>`.
|
the worktree with a new unborn branch named `<new-branch>`.
|
||||||
|
|
||||||
--porcelain::
|
--porcelain::
|
||||||
With `list`, output in an easy-to-parse format for scripts.
|
With `list`, output in an easy-to-parse format for scripts.
|
||||||
|
|
|
@ -314,6 +314,12 @@ This commit is referred to as a "merge commit", or sometimes just a
|
||||||
[[def_octopus]]octopus::
|
[[def_octopus]]octopus::
|
||||||
To <<def_merge,merge>> more than two <<def_branch,branches>>.
|
To <<def_merge,merge>> more than two <<def_branch,branches>>.
|
||||||
|
|
||||||
|
[[def_orphan]]orphan::
|
||||||
|
The act of getting on a <<def_branch,branch>> that does not
|
||||||
|
exist yet (i.e., an <<def_unborn,unborn>> branch). After
|
||||||
|
such an operation, the commit first created becomes a commit
|
||||||
|
without a parent, starting a new history.
|
||||||
|
|
||||||
[[def_origin]]origin::
|
[[def_origin]]origin::
|
||||||
The default upstream <<def_repository,repository>>. Most projects have
|
The default upstream <<def_repository,repository>>. Most projects have
|
||||||
at least one upstream project which they track. By default
|
at least one upstream project which they track. By default
|
||||||
|
@ -697,6 +703,18 @@ The most notable example is `HEAD`.
|
||||||
object,
|
object,
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
|
[[def_unborn]]unborn::
|
||||||
|
The <<def_HEAD,HEAD>> can point at a <<def_branch,branch>>
|
||||||
|
that does not yet exist and that does not have any commit on
|
||||||
|
it yet, and such a branch is called an unborn branch. The
|
||||||
|
most typical way users encounter an unborn branch is by
|
||||||
|
creating a repository anew without cloning from elsewhere.
|
||||||
|
The HEAD would point at the 'main' (or 'master', depending
|
||||||
|
on your configuration) branch that is yet to be born. Also
|
||||||
|
some operations can get you on an unborn branch with their
|
||||||
|
<<def_orphan,orphan>> option.
|
||||||
|
|
||||||
|
|
||||||
[[def_unmerged_index]]unmerged index::
|
[[def_unmerged_index]]unmerged index::
|
||||||
An <<def_index,index>> which contains unmerged
|
An <<def_index,index>> which contains unmerged
|
||||||
<<def_index_entry,index entries>>.
|
<<def_index_entry,index entries>>.
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ static struct option *add_common_switch_branch_options(
|
||||||
parse_opt_tracking_mode),
|
parse_opt_tracking_mode),
|
||||||
OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
|
OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
|
||||||
PARSE_OPT_NOCOMPLETE),
|
PARSE_OPT_NOCOMPLETE),
|
||||||
OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
|
OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unborn branch")),
|
||||||
OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
|
OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
|
||||||
N_("update ignored files (default)"),
|
N_("update ignored files (default)"),
|
||||||
PARSE_OPT_NOCOMPLETE),
|
PARSE_OPT_NOCOMPLETE),
|
||||||
|
|
|
@ -49,14 +49,14 @@
|
||||||
_("No possible source branch, inferring '--orphan'")
|
_("No possible source branch, inferring '--orphan'")
|
||||||
|
|
||||||
#define WORKTREE_ADD_ORPHAN_WITH_DASH_B_HINT_TEXT \
|
#define WORKTREE_ADD_ORPHAN_WITH_DASH_B_HINT_TEXT \
|
||||||
_("If you meant to create a worktree containing a new orphan branch\n" \
|
_("If you meant to create a worktree containing a new unborn branch\n" \
|
||||||
"(branch with no commits) for this repository, you can do so\n" \
|
"(branch with no commits) for this repository, you can do so\n" \
|
||||||
"using the --orphan flag:\n" \
|
"using the --orphan flag:\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" git worktree add --orphan -b %s %s\n")
|
" git worktree add --orphan -b %s %s\n")
|
||||||
|
|
||||||
#define WORKTREE_ADD_ORPHAN_NO_DASH_B_HINT_TEXT \
|
#define WORKTREE_ADD_ORPHAN_NO_DASH_B_HINT_TEXT \
|
||||||
_("If you meant to create a worktree containing a new orphan branch\n" \
|
_("If you meant to create a worktree containing a new unborn branch\n" \
|
||||||
"(branch with no commits) for this repository, you can do so\n" \
|
"(branch with no commits) for this repository, you can do so\n" \
|
||||||
"using the --orphan flag:\n" \
|
"using the --orphan flag:\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
|
@ -784,7 +784,7 @@ static int add(int ac, const char **av, const char *prefix)
|
||||||
N_("create a new branch")),
|
N_("create a new branch")),
|
||||||
OPT_STRING('B', NULL, &new_branch_force, N_("branch"),
|
OPT_STRING('B', NULL, &new_branch_force, N_("branch"),
|
||||||
N_("create or reset a branch")),
|
N_("create or reset a branch")),
|
||||||
OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn/orphaned branch")),
|
OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn branch")),
|
||||||
OPT_BOOL('d', "detach", &opts.detach, N_("detach HEAD at named commit")),
|
OPT_BOOL('d', "detach", &opts.detach, N_("detach HEAD at named commit")),
|
||||||
OPT_BOOL(0, "checkout", &opts.checkout, N_("populate the new working tree")),
|
OPT_BOOL(0, "checkout", &opts.checkout, N_("populate the new working tree")),
|
||||||
OPT_BOOL(0, "lock", &keep_locked, N_("keep the new working tree locked")),
|
OPT_BOOL(0, "lock", &keep_locked, N_("keep the new working tree locked")),
|
||||||
|
|
|
@ -415,7 +415,7 @@ test_wt_add_orphan_hint () {
|
||||||
git -C repo switch --orphan noref &&
|
git -C repo switch --orphan noref &&
|
||||||
test_must_fail git -C repo worktree add $opts foobar/ 2>actual &&
|
test_must_fail git -C repo worktree add $opts foobar/ 2>actual &&
|
||||||
! grep "error: unknown switch" actual &&
|
! grep "error: unknown switch" actual &&
|
||||||
grep "hint: If you meant to create a worktree containing a new orphan branch" actual &&
|
grep "hint: If you meant to create a worktree containing a new unborn branch" actual &&
|
||||||
if [ $use_branch -eq 1 ]
|
if [ $use_branch -eq 1 ]
|
||||||
then
|
then
|
||||||
grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
|
grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
|
||||||
|
@ -436,7 +436,7 @@ test_expect_success "'worktree add' doesn't show orphan hint in bad/orphan HEAD
|
||||||
(cd repo && test_commit commit) &&
|
(cd repo && test_commit commit) &&
|
||||||
test_must_fail git -C repo worktree add --quiet foobar_branch foobar/ 2>actual &&
|
test_must_fail git -C repo worktree add --quiet foobar_branch foobar/ 2>actual &&
|
||||||
! grep "error: unknown switch" actual &&
|
! grep "error: unknown switch" actual &&
|
||||||
! grep "hint: If you meant to create a worktree containing a new orphan branch" actual
|
! grep "hint: If you meant to create a worktree containing a new unborn branch" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'local clone from linked checkout' '
|
test_expect_success 'local clone from linked checkout' '
|
||||||
|
@ -709,7 +709,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '
|
||||||
test_dwim_orphan () {
|
test_dwim_orphan () {
|
||||||
local info_text="No possible source branch, inferring '--orphan'" &&
|
local info_text="No possible source branch, inferring '--orphan'" &&
|
||||||
local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
|
local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
|
||||||
local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" &&
|
local orphan_hint="hint: If you meant to create a worktree containing a new unborn branch" &&
|
||||||
local invalid_ref_regex="^fatal: invalid reference: " &&
|
local invalid_ref_regex="^fatal: invalid reference: " &&
|
||||||
local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
|
local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче