Skip to content

Commit b775887

Browse files
Deal with no-name-change edge case
When files are moved to the exact same location in the framework repo as they were in Mbed TLS, there is a problem. Since no git change has taken place on the Mbed TLS side, the most recent change to the file is its deletion when a previous set of files were moved to the framework (since all other files are deleted in this kind of move). As a result the moved files are deleted and do not appear in the final branch. Deal with this edge case explicitly by taking files which are not renamed from the file map and checking them out to the state in the temporary branch, before amending the resulting commit. Signed-off-by: David Horstmann <david.horstmann@arm.com>
1 parent 02e7a14 commit b775887

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/bin/mbedtls-move-to-framework

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ class RepoFileMover:
237237
self.run_git(['-c', 'core.editor=/bin/true',
238238
'merge', '--continue'])
239239

240+
# Edge case: when we are not renaming the files, their deletion in
241+
# previous branches moved to the framework will take precedence without
242+
# merge conficts. Treat these files specially and restore them.
243+
for f in self._file_map:
244+
if self._file_map[f] == f:
245+
self.run_git(['checkout', self._tmp_framework_branch_name, '--', f])
246+
self.run_git(['add', f])
247+
self.run_git(['-c', 'core.editor=/bin/true',
248+
'commit', '--amend'])
249+
240250
def move_files(self):
241251
os.chdir(self._source_repo)
242252

0 commit comments

Comments
 (0)