Skip to content

Commit 3f26785

Browse files
bk2204gitster
authored andcommitted
builtin/rebase: compute checkout metadata for rebases
Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dfc8cdc commit 3f26785

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

builtin/rebase.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ static int reset_head(struct object_id *oid, const char *action,
868868
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
869869
unpack_tree_opts.update = 1;
870870
unpack_tree_opts.merge = 1;
871+
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
871872
if (!detach_head)
872873
unpack_tree_opts.reset = 1;
873874

sequencer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,6 +3288,7 @@ static int do_reset(struct repository *r,
32883288
unpack_tree_opts.fn = oneway_merge;
32893289
unpack_tree_opts.merge = 1;
32903290
unpack_tree_opts.update = 1;
3291+
init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
32913292

32923293
if (repo_read_index_unmerged(r)) {
32933294
rollback_lock_file(&lock);

t/t0021-conversion.sh

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ test_expect_success PERL 'required process filter should filter data' '
382382
test_cmp_count expected.log debug.log &&
383383
384384
git commit -m "test commit 2" &&
385-
META="ref=refs/heads/master treeish=$(git rev-parse --verify master)" &&
385+
MASTER=$(git rev-parse --verify master) &&
386+
META="ref=refs/heads/master treeish=$MASTER" &&
386387
rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
387388
388389
filter_git checkout --quiet --no-progress . &&
@@ -425,6 +426,42 @@ test_expect_success PERL 'required process filter should filter data' '
425426
)
426427
'
427428

429+
test_expect_success PERL 'required process filter should filter data for various subcommands' '
430+
test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
431+
test_config_global filter.protocol.required true &&
432+
(
433+
cd repo &&
434+
435+
S=$(file_size test.r) &&
436+
S2=$(file_size test2.r) &&
437+
S3=$(file_size "testsubdir/test3 '\''sq'\'',\$x=.r") &&
438+
M=$(git hash-object test.r) &&
439+
M2=$(git hash-object test2.r) &&
440+
M3=$(git hash-object "testsubdir/test3 '\''sq'\'',\$x=.r") &&
441+
EMPTY=$(git hash-object /dev/null) &&
442+
443+
MASTER=$(git rev-parse --verify master) &&
444+
445+
cp "$TEST_ROOT/test.o" test5.r &&
446+
git add test5.r &&
447+
git commit -m "test commit 3" &&
448+
git checkout empty-branch &&
449+
filter_git rebase --onto empty-branch master^^ master &&
450+
META="ref=refs/heads/master treeish=$(git rev-parse --verify master)" &&
451+
cat >expected.log <<-EOF &&
452+
START
453+
init handshake complete
454+
IN: smudge test.r $META blob=$M $S [OK] -- OUT: $S . [OK]
455+
IN: smudge test2.r $META blob=$M2 $S2 [OK] -- OUT: $S2 . [OK]
456+
IN: smudge test4-empty.r $META blob=$EMPTY 0 [OK] -- OUT: 0 [OK]
457+
IN: smudge test5.r $META blob=$M $S [OK] -- OUT: $S . [OK]
458+
IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $META blob=$M3 $S3 [OK] -- OUT: $S3 . [OK]
459+
STOP
460+
EOF
461+
test_cmp_exclude_clean expected.log debug.log
462+
)
463+
'
464+
428465
test_expect_success PERL 'required process filter takes precedence' '
429466
test_config_global filter.protocol.clean false &&
430467
test_config_global filter.protocol.process "rot13-filter.pl debug.log clean" &&

0 commit comments

Comments
 (0)