diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2020-02-22 20:17:49 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-28 09:53:41 -0800 |
commit | 1bdca816412910e1206c15ef47f2a8a6b369b831 (patch) | |
tree | e725694e6add4e43c656a16a196d9cef11bd9a6e /gitweb/static | |
parent | fast-import: add a generic function to iterate over marks (diff) | |
download | tgif-1bdca816412910e1206c15ef47f2a8a6b369b831.tar.xz |
fast-import: add options for rewriting submodules
When converting a repository using submodules from one hash algorithm to
another, it is necessary to rewrite the submodules from the old
algorithm to the new algorithm, since only references to submodules, not
their contents, are written to the fast-export stream. Without rewriting
the submodules, fast-import fails with an "Invalid dataref" error when
encountering a submodule in another algorithm.
Add a pair of options, --rewrite-submodules-from and
--rewrite-submodules-to, that take a list of marks produced by
fast-export and fast-import, respectively, when processing the
submodule. Use these marks to map the submodule commits from the old
algorithm to the new algorithm.
We read marks into two corresponding struct mark_set objects and then
perform a mapping from the old to the new using a hash table. This lets
us reuse the same mark parsing code that is used elsewhere and allows us
to efficiently read and match marks based on their ID, since mark files
need not be sorted.
Note that because we're using a khash table for the object IDs, and this
table copies values of struct object_id instead of taking references to
them, it's necessary to zero the struct object_id values that we use to
insert and look up in the table. Otherwise, we would end up with SHA-1
values that don't match because of whatever stack garbage might be left
in the unused area.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/static')
0 files changed, 0 insertions, 0 deletions