Skip to content
Snippets Groups Projects
Commit 1804c7dd authored by felmer's avatar felmer
Browse files

SSDM-10611: adapting in backward compatible way to work also with git-annex version 8

parent 51efb176
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,12 @@ class GitWrapper(object):
if self._git(['annex', 'help']).failure():
# git help should have a returncode of 0
return False
result = self._git(['annex', 'version'])
if result.success():
first_line = result.output.split("\n")[0].split(":")
if len(first_line) > 1:
self.annex_version = first_line[1].strip()
self.annex_major_version = int(self.version.split(".")[0])
return True
def git_init(self):
......@@ -72,7 +78,7 @@ class GitWrapper(object):
return result
# direct mode so annex uses hard links instead of soft links
cmd = ["annex", "direct"]
cmd = ["annex", "unlock" if self.annex_major_version >= 8 else "direct"]
result = self._git(cmd)
if result.failure():
return result
......@@ -112,7 +118,10 @@ class GitWrapper(object):
def git_add(self, path):
# git annex add to avoid out of memory error when adding files bigger than RAM
return self._git(["annex", "add", path, "--include-dotfiles"])
cmd = ["annex", "add", path]
if self.annex_major_version < 8:
cmd.append("--include-dotfiles")
return self._git(cmd)
def git_commit(self, msg):
return self._git(['commit', '--allow-empty', '-m', msg])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment