Skip to content

Windows fixes and annex v7 #250

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

Merged
merged 53 commits into from
Mar 19, 2019
Merged

Conversation

achilleas-k
Copy link
Member

This PR makes a lot of changes towards making the client more robust on Windows and the behaviour a lot more consistent across all platforms.

Repositories are now initialised in v7 mode. This changes a lot of the behaviour around locked and unlocked files. Files are added unlocked by default. We will probably move towards not supporting file locking at all, since on Windows locked files are unusable (they are just pointer files that don't link to the content like on Linux and macOS).

Some smaller changes are also included in the way merge conflicts are handled.

Also included in this PR is a few small Go tests. These are prototypes and will slowly become unit tests that cover most lower level functionality (git and git-annex calls and effects), while the Python tests remain as comprehensive integration tests.

The Go tests and some of the integration tests that don't require a server (they use local directories as "remotes") are now run on Appveyor for Windows testing.

Not required when working with directory remotes
For offline work, login is not required so as a workaround the
requirelogin() simply loads the token.

This will eventually be replaced by an explicit call to LoadToken()
where necessary.
Execution flow and variable names were getting confusing.  Using
'remote' type to carry all the info with documented fields should make
it easier to follow.
In some cases, a nil path can get through and break this
Specifying exclusion filters using the git config flag in combination
with annex v7 repositories automatically adds files annex-excluded files
to git.

We don't need to run `git add` anymore.
Typechange files don't appear modified to git, so we need to check
everything using git-annex status to detect unlocked files.
Changes in the way the annex path is written to the pointer files can
make the git diff appear different in different locations, resulting in
a synced annexed file showing Local Changes.

Swapping the order to git diff first then annex whereis second, the
annexed files overwrite the git diff results with the more accuracte
representation available through git-annex's content tracking.
Might revert later
With the shift to v7, the lock status of files is now a little
different:
The lock status of a file is tracked and files can be checked into
repositories in locked and unlocked states.  To handle this, we're
adding a proper lock command that handles the situation where a file is
modified and not saved before locking.  We also have an extra file
status, TC, for TypeChange.  The old UL (Unlocked) status will be slowly
deprecated.  TC is active for files that have been switched from Locked
to Unlocked or vice versa and have yet to be committed.
Forces consistent behaviour between all platforms
Set annex options before initialising
In unlocked mode, paths to the content don't begin with '.git/'
Git blogs are no longer links so we need to check the contents directly.
In the case of big binary files potentially checked into git, we don't
want to string search the whole content, so we limit our search to 255
bytes or the whole file (whichever is smaller).
- Use AnnexAdd to add git files.
- Unlock annexed files after recovering.
- Print more descriptive and helpful output messages.
In some situations, calling the git-annex binary directly doesn't work
as well (especially on Windows).  Adding a new config option for setting
the git-annex path.  If it's unset, it checks the old bin.gitannex
setting to infer the path from there, otherwise it relies on the system
path.
- Sync provides a way to do bidirectional synchronisation, which is
useful for resolving merge conflicts automatically.
- The download command now allows specifying a remote.
- Plain git pull command is also added, but is not used at this time
(could be useful for other functions).
Starting to write go tests for the client.  For now, the tests will use
a locally deployed server, the same one that the tests submodule uses.

Other subpackages that don't depend on a server will be able to run
locally.
In some situations, calling the git-annex binary directly doesn't work
as well (especially on Windows).  Adding a new config option for setting
the git-annex path.  If it's unset, it checks the old bin.gitannex
setting to infer the path from there, otherwise it relies on the system
path.
Sets a configuration key in the config file.
Was previously private to the config package.
When a user initialises a repository before logging in and there is no
global git user configuration, the local configuration stays empty.

Use the system user name instead.  Setting the email is not required.
- Now runs all tests marked with "directory" (tests that use directory
remotes and don't require a server).
- Downloads whole gin-cli-bundle and replaces the binary with the newly
built one.
- Keep gin log file as artifact
Required for file removal commit
On Windows, the default branch is not master but adjusted master.

This might change but for now this is a more general test anyway.
Switch to master on init.  This is needed on Windows where it defaults
to the adjusted branch.  Switching to master keeps the behaviour
consistent across platforms.  Since we're moving away from locked files,
the adjusted branch is likely unnecessary.
Moving the abortMerge() invocation to the download function instead of
the error parsing function.

Error parsing now happens on the combined stdout + stderr.  On Windows,
the merge conflict error messages appear on stdout, while on Linux
they're on stderr.
When the remote is not initialised, git files appear as synced because
the git diff with the remote fails (there are no remote refs).

We now explicitly mark all git files as "LC" (local changes, not
uploaded) if the remote is not initialised.
@mpsonntag mpsonntag merged commit 5c7d971 into G-Node:master Mar 19, 2019
@achilleas-k achilleas-k deleted the windows-fixes-v7 branch May 6, 2019 15:04
@achilleas-k achilleas-k mentioned this pull request May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants