SHA comparison in parse_file
Berthold Stoeger
bstoeger at mail.tuwien.ac.at
Sat Dec 9 06:44:00 PST 2017
Dear all,
While trying to understand/simplify the cloud code I noticed that in
parse_file() there is code to check if the currently loaded data is the same
data as in the git repository. It does this by comparing SHAs. If they are the
same, no loading of data is performed.
But, at least on the desktop version, this code seems to be unused: There are
three calls to parse_file() in mainwindow.cpp.
1) MainWindow::on_actionCloudstorageopen_triggered():
Before calling parse_file() this calls closeCurrentFile(), which clears the
saved SHA.
2) MainWindow::importFiles():
This seems to be a different use case of parse_file(). To me it doesn't make
sense to compare SHAs for imported and current file.
3) MainWindow::loadFiles():
loadFiles() is called twice from MainWindow and in each case
closeCurrentFile() is called before, which clears the saved SHA.
loadFiles() is also called from main(), where the SHA isn't yet set.
Therefore, at least on desktop this seems to be dead code. On mobile it's hard
to tell for me. But it seems to me that SHA comparison is handled in
check_git_sha() anyway. The code in mergeLocalRepo() could be a valid use, but
I'm not sure.
So the question is: remove this code [with potential adaption of
QMLManager::mergeLocalRepo()] or make it functional on the desktop version?
Thank you,
Berthold
More information about the subsurface
mailing list