mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
Merge branch 'bc/filter-process'
Code simplification and test coverage enhancement. * bc/filter-process: t2060: add a test for switch with --orphan and --discard-changes builtin/checkout: simplify metadata initialization
This commit is contained in:
commit
ded44afa02
|
@ -621,9 +621,7 @@ static int reset_tree(struct tree *tree, const struct checkout_opts *o,
|
|||
opts.src_index = &the_index;
|
||||
opts.dst_index = &the_index;
|
||||
init_checkout_metadata(&opts.meta, info->refname,
|
||||
info->commit ? &info->commit->object.oid :
|
||||
is_null_oid(&info->oid) ? &tree->object.oid :
|
||||
&info->oid,
|
||||
info->commit ? &info->commit->object.oid : &null_oid,
|
||||
NULL);
|
||||
parse_tree(tree);
|
||||
init_tree_desc(&tree_desc, tree->buffer, tree->size);
|
||||
|
|
|
@ -68,6 +68,14 @@ test_expect_success 'new orphan branch from empty' '
|
|||
test_cmp expected tracked-files
|
||||
'
|
||||
|
||||
test_expect_success 'orphan branch works with --discard-changes' '
|
||||
test_when_finished git switch master &&
|
||||
echo foo >foo.txt &&
|
||||
git switch --discard-changes --orphan new-orphan2 &&
|
||||
git ls-files >tracked-files &&
|
||||
test_must_be_empty tracked-files
|
||||
'
|
||||
|
||||
test_expect_success 'switching ignores file of same branch name' '
|
||||
test_when_finished git switch master &&
|
||||
: >first-branch &&
|
||||
|
|
Loading…
Reference in a new issue