-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "There are uncommitted changes" error messages when using mastodon-git with maston (core) 1.0.0-SNAPSHOT-31 #23
Conversation
The way Mastodon save its projects/datasets has been changed, and mastodon-git needs to adapt. If mastodon save into a folder now the entire old folder is removed. Which resulted in files "project.xml_remote" which are used by the mastodon git implementation to always be removed. The problem is solved by no longer storing these files in the mastodon.project folder. They are now stored in a mastodon.remote_data folder instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is difficult to test, if this PR improves the user experience, since it is not described, how the error messages that the user receives can be reproduced. I was not able to test, if the intended changes work as expected.
In the javadoc, it is mentioned that the files gui.xml, project.xml and dataset.xml.backup are treated specially. It would be good if the reasoning of this special treatment is mentioned. Also, it is unclear, why the "*_remote" files are needed. Some short explanation in the source code would help.
When trying to download a Shared Project with this version of the code, I am getting this error message:
When trying to do the same with the 0.0.1 release of mastodon-git the same error message does not occur.
With both version 0.0.1 and 0.0.2-SNAPSHOT, I am getting this error message when trying to Download changes (i.e. pull), even though I have not made local changes before:
|
||
Path remoteFolder = directory.toPath().resolve( MASTODON_REMOTE_DATA_FOLDER ); | ||
if ( Files.exists( remoteFolder ) ) | ||
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL ); | |
throw new MastodonGitException( "The specified directory already contains a shared mastodon project: " + repositoryURL + ". Please specify an empty directory."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You misunderstood the code here. The user has to select an empty directory and an empty git repository in order to share a project. This message is shown if the repository is not empty. I will change the text to:
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL ); | |
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL | |
+ "\nPlease specify an empty git repository." ); |
@@ -114,21 +117,26 @@ public static MastodonGitRepository shareProject( | |||
.setCredentialsProvider( credentials.getSingleUseCredentialsProvider() ) | |||
.setDirectory( directory ) | |||
.call(); | |||
final Path mastodonProjectPath = directory.toPath().resolve( "mastodon.project" ); | |||
final Path mastodonProjectPath = directory.toPath().resolve( MASTODON_PROJECT_FOLDER ); | |||
if ( Files.exists( mastodonProjectPath ) ) | |||
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new MastodonGitException( "The repository already contains a shared mastodon project: " + repositoryURL ); | |
throw new MastodonGitException( "The specified directory already contains a mastodon project: " + repositoryURL + ". Please specify an empty directory."); |
The previous name was "mastodon.remote" which can be considered confusing. A copy of that folder is in every locally cloned repository. The new name reflects that fact that the files are copied to initialize a working Mastodon project after cloning a repository.
Minor refactoring use try with resource. Extract a private method. Reduce code duplication.
cafb617
to
4905225
Compare
This PR fixes a bug that only appears when linked with mastodon core version 1.0.0-beta-31-SNAPSHOT. However the fixed mastodon-git works with both beta-30 and the latest snapshot. Not having a snapshot release is better for being able to cut a release.
We did a successful functional test yesterday. And the error message "FileNotFoundException" were due to the usage of a outdated matodon-git data repository. This change is backwards compatible. But I think we don't need to be backwards compatible yet. I will delete all outdated repositories. And merge this PR. |
While using mastodon-git with the latest mastodon 1.0.0-SNAPSHOT-31, a user would often get error messages:
that the repository is not clean"There are uncommitted changes. Please add a save point before pulling":The problem also causes the unit tests to fail when using the latest mastodon core dependency.
In version 1.0.0-SNAPSHOT-31 the way Mastodon saves its projects/datasets has been changed, and mastodon-git needs to adapt. If mastodon saves into a folder now the entire old folder is removed. Which resulted in files
project.xml_remote
and other files that where created by mastodon-git in themastodon.project
folder are always be removed. Git notices these missing files and reports that as a "repository is not clean" error.The problem is solved by no longer storing the files "project.xml_remote" etc. in the "mastodon.project/" folder. They are now stored in separate folder "mastodon.remote_data/".
With this changes user should again be able to do all operations mastodon-git provides.
TODOs