fast-import: add support for new 'alias' command

fast-export and fast-import have nice --import-marks flags which allow
for incremental migrations.  However, if there is a mark in
fast-export's file of marks without a corresponding mark in the one for
fast-import, then we run the risk that fast-export tries to send new
objects relative to the mark it knows which fast-import does not,
causing fast-import to fail.

This arises in practice when there is a filter of some sort running
between the fast-export and fast-import processes which prunes some
commits programmatically.  Provide such a filter with the ability to
alias pruned commits to their most recent non-pruned ancestor.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2019-10-03 13:27:05 -07:00
committed by Junio C Hamano
parent f73b2aba05
commit b8f50e5b60
3 changed files with 79 additions and 10 deletions

View File

@@ -111,6 +111,10 @@ test_expect_success 'A: create pack from stdin' '
Tag of tag of our lovely commit
EOF
alias
mark :8
to :5
INPUT_END
git fast-import --export-marks=marks.out <input &&
git whatchanged master
@@ -195,6 +199,7 @@ test_expect_success 'A: verify marks output' '
:5 $(git rev-parse --verify master^0)
:6 $(git cat-file tag nested | grep object | cut -d" " -f 2)
:7 $(git rev-parse --verify nested)
:8 $(git rev-parse --verify master^0)
EOF
test_cmp expect marks.out
'