datopian / ckanext-gitdatahub

A CKAN extension to use a git based storage for dataset's metadata that supports versioning.
GNU Affero General Public License v3.0
2 stars 2 forks source link

Commit .lfsconfig file when creating a dataset #5

Closed pdelboca closed 4 years ago

pdelboca commented 4 years ago

When creating a dataset (and a repository) add and commit the .lfsconfig file with the url to the git lfs server.

The content of the file should be:

[remote "origin"]
    lfsurl = <url_to_the_git_lfs_server>/<org_name>/<repo_name>

Here is a code implementation in JS we can use as guideline:

getRepoConfigFiles(repoName)
  {
    const repoUrl = `${this.serverUrl}/${this.user}/${repoName}`

    return [
      new GitFile('.gitattributes', 'data/* filter=lfs diff=lfs merge=lfs -text'),
      new GitFile('.lfsconfig', '[remote "origin"]\n\tlfsurl = ' + repoUrl)
    ]
  }

Tasks: