summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-02-22 20:17:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-28 17:53:41 (GMT)
commit1bdca816412910e1206c15ef47f2a8a6b369b831 (patch)
treee725694e6add4e43c656a16a196d9cef11bd9a6e /path.c
parentd9db599ca85b008faedc1d5e771e28b6fb648c4e (diff)
downloadgit-1bdca816412910e1206c15ef47f2a8a6b369b831.zip
git-1bdca816412910e1206c15ef47f2a8a6b369b831.tar.gz
git-1bdca816412910e1206c15ef47f2a8a6b369b831.tar.bz2
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 'path.c')
0 files changed, 0 insertions, 0 deletions