diff options
author | brian m. carlson <bk2204@github.com> | 2020-03-16 21:05:06 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-16 21:37:02 +0300 |
commit | 3f267856243693676c04b4d6dfa1e22de62e407a (patch) | |
tree | 67dcfa20f2fcd3f7a06f9db0a2763d967328fca2 | |
parent | dfc8cdc6772a05db4ed64c45df3fe2defdae7eb3 (diff) |
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>
-rw-r--r-- | builtin/rebase.c | 1 | ||||
-rw-r--r-- | sequencer.c | 1 | ||||
-rwxr-xr-x | t/t0021-conversion.sh | 39 |
3 files changed, 40 insertions, 1 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index cb7aeae597..903267fff9 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -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; diff --git a/sequencer.c b/sequencer.c index 7477b15422..b05a010c0c 100644 --- a/sequencer.c +++ b/sequencer.c @@ -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); diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index ad329044a3..3efb0dad20 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -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" && |