git/t/t5515
Joey Hess 96890f4c42 write first for-merge ref to FETCH_HEAD first
The FETCH_HEAD refname is supposed to refer to the ref that was fetched
and should be merged. However all fetched refs are written to
.git/FETCH_HEAD in an arbitrary order, and resolve_ref_unsafe simply
takes the first ref as the FETCH_HEAD, which is often the wrong one,
when other branches were also fetched.

The solution is to write the for-merge ref(s) to FETCH_HEAD first.
Then, unless --append is used, the FETCH_HEAD refname behaves as intended.
If the user uses --append, they presumably are doing so in order to
preserve the old FETCH_HEAD.

While we are at it, update an old example in the read-tree documentation
that implied that each entry in FETCH_HEAD only has the object name, which
is not true for quite a while.

[jc: adjusted tests]

Signed-off-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03 16:13:14 -08:00
..
fetch.br-branches-default fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-branches-default_branches-default fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-branches-default-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-default-merge_branches-default write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-default-octopus write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-default-octopus_branches-default write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-one fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-branches-one_branches-one fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-branches-one-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-one-merge_branches-one write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-branches-one-octopus fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-branches-one-octopus_branches-one fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-config-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-config-explicit_config-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-config-explicit-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-explicit-merge_config-explicit write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-explicit-octopus write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-explicit-octopus_config-explicit write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-config-glob_config-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-config-glob-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-glob-merge_config-glob write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-glob-octopus write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-config-glob-octopus_config-glob write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-remote-explicit_remote-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-remote-explicit-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-explicit-merge_remote-explicit write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-explicit-octopus write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-explicit-octopus_remote-explicit write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-remote-glob_remote-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-remote-glob-merge write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-glob-merge_remote-glob write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-glob-octopus write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-remote-glob-octopus_remote-glob write first for-merge ref to FETCH_HEAD first 2012-01-03 16:13:14 -08:00
fetch.br-unconfig fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_--tags_.._.git fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_.._.git
fetch.br-unconfig_.._.git_one
fetch.br-unconfig_.._.git_one_tag_tag-one_tag_tag-three-file fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_.._.git_one_two
fetch.br-unconfig_.._.git_tag_tag-one_tag_tag-three fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_.._.git_tag_tag-one-tree_tag_tag-three-file fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_branches-default fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_branches-one fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_config-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_config-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_remote-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.br-unconfig_remote-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_--tags_.._.git fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_.._.git
fetch.master_.._.git_one
fetch.master_.._.git_one_tag_tag-one_tag_tag-three-file fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_.._.git_one_two
fetch.master_.._.git_tag_tag-one_tag_tag-three fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_.._.git_tag_tag-one-tree_tag_tag-three-file fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_branches-default fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_branches-one fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_config-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_config-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_remote-explicit fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fetch.master_remote-glob fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
refs.br-branches-default
refs.br-branches-default_branches-default
refs.br-branches-default-merge
refs.br-branches-default-merge_branches-default
refs.br-branches-default-octopus
refs.br-branches-default-octopus_branches-default
refs.br-branches-one
refs.br-branches-one_branches-one
refs.br-branches-one-merge
refs.br-branches-one-merge_branches-one
refs.br-branches-one-octopus
refs.br-branches-one-octopus_branches-one
refs.br-config-explicit
refs.br-config-explicit_config-explicit
refs.br-config-explicit-merge
refs.br-config-explicit-merge_config-explicit
refs.br-config-explicit-octopus
refs.br-config-explicit-octopus_config-explicit
refs.br-config-glob
refs.br-config-glob_config-glob
refs.br-config-glob-merge
refs.br-config-glob-merge_config-glob
refs.br-config-glob-octopus
refs.br-config-glob-octopus_config-glob
refs.br-remote-explicit
refs.br-remote-explicit_remote-explicit
refs.br-remote-explicit-merge
refs.br-remote-explicit-merge_remote-explicit
refs.br-remote-explicit-octopus
refs.br-remote-explicit-octopus_remote-explicit
refs.br-remote-glob
refs.br-remote-glob_remote-glob
refs.br-remote-glob-merge
refs.br-remote-glob-merge_remote-glob
refs.br-remote-glob-octopus
refs.br-remote-glob-octopus_remote-glob
refs.br-unconfig
refs.br-unconfig_--tags_.._.git
refs.br-unconfig_.._.git
refs.br-unconfig_.._.git_one
refs.br-unconfig_.._.git_one_tag_tag-one_tag_tag-three-file
refs.br-unconfig_.._.git_one_two
refs.br-unconfig_.._.git_tag_tag-one_tag_tag-three
refs.br-unconfig_.._.git_tag_tag-one-tree_tag_tag-three-file
refs.br-unconfig_branches-default
refs.br-unconfig_branches-one
refs.br-unconfig_config-explicit
refs.br-unconfig_config-glob
refs.br-unconfig_remote-explicit
refs.br-unconfig_remote-glob
refs.master
refs.master_--tags_.._.git
refs.master_.._.git
refs.master_.._.git_one
refs.master_.._.git_one_tag_tag-one_tag_tag-three-file
refs.master_.._.git_one_two
refs.master_.._.git_tag_tag-one_tag_tag-three
refs.master_.._.git_tag_tag-one-tree_tag_tag-three-file
refs.master_branches-default
refs.master_branches-one
refs.master_config-explicit
refs.master_config-glob
refs.master_remote-explicit
refs.master_remote-glob