builtin/rebase: compute checkout metadata for rebases
Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
dfc8cdc677
commit
3f26785624
|
@ -868,6 +868,7 @@ static int reset_head(struct object_id *oid, const char *action,
|
|||
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
|
||||
unpack_tree_opts.update = 1;
|
||||
unpack_tree_opts.merge = 1;
|
||||
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
|
||||
if (!detach_head)
|
||||
unpack_tree_opts.reset = 1;
|
||||
|
||||
|
|
|
@ -3288,6 +3288,7 @@ static int do_reset(struct repository *r,
|
|||
unpack_tree_opts.fn = oneway_merge;
|
||||
unpack_tree_opts.merge = 1;
|
||||
unpack_tree_opts.update = 1;
|
||||
init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
|
||||
|
||||
if (repo_read_index_unmerged(r)) {
|
||||
rollback_lock_file(&lock);
|
||||
|
|
|
@ -382,7 +382,8 @@ test_expect_success PERL 'required process filter should filter data' '
|
|||
test_cmp_count expected.log debug.log &&
|
||||
|
||||
git commit -m "test commit 2" &&
|
||||
META="ref=refs/heads/master treeish=$(git rev-parse --verify master)" &&
|
||||
MASTER=$(git rev-parse --verify master) &&
|
||||
META="ref=refs/heads/master treeish=$MASTER" &&
|
||||
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
|
||||
|
||||
filter_git checkout --quiet --no-progress . &&
|
||||
|
@ -425,6 +426,42 @@ test_expect_success PERL 'required process filter should filter data' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success PERL 'required process filter should filter data for various subcommands' '
|
||||
test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
|
||||
test_config_global filter.protocol.required true &&
|
||||
(
|
||||
cd repo &&
|
||||
|
||||
S=$(file_size test.r) &&
|
||||
S2=$(file_size test2.r) &&
|
||||
S3=$(file_size "testsubdir/test3 '\''sq'\'',\$x=.r") &&
|
||||
M=$(git hash-object test.r) &&
|
||||
M2=$(git hash-object test2.r) &&
|
||||
M3=$(git hash-object "testsubdir/test3 '\''sq'\'',\$x=.r") &&
|
||||
EMPTY=$(git hash-object /dev/null) &&
|
||||
|
||||
MASTER=$(git rev-parse --verify master) &&
|
||||
|
||||
cp "$TEST_ROOT/test.o" test5.r &&
|
||||
git add test5.r &&
|
||||
git commit -m "test commit 3" &&
|
||||
git checkout empty-branch &&
|
||||
filter_git rebase --onto empty-branch master^^ master &&
|
||||
META="ref=refs/heads/master treeish=$(git rev-parse --verify master)" &&
|
||||
cat >expected.log <<-EOF &&
|
||||
START
|
||||
init handshake complete
|
||||
IN: smudge test.r $META blob=$M $S [OK] -- OUT: $S . [OK]
|
||||
IN: smudge test2.r $META blob=$M2 $S2 [OK] -- OUT: $S2 . [OK]
|
||||
IN: smudge test4-empty.r $META blob=$EMPTY 0 [OK] -- OUT: 0 [OK]
|
||||
IN: smudge test5.r $META blob=$M $S [OK] -- OUT: $S . [OK]
|
||||
IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $META blob=$M3 $S3 [OK] -- OUT: $S3 . [OK]
|
||||
STOP
|
||||
EOF
|
||||
test_cmp_exclude_clean expected.log debug.log
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success PERL 'required process filter takes precedence' '
|
||||
test_config_global filter.protocol.clean false &&
|
||||
test_config_global filter.protocol.process "rot13-filter.pl debug.log clean" &&
|
||||
|
|
Loading…
Reference in New Issue