git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

commit 391af40500153f10c779a29266b577b62d96d065
parent c440dc53aa3768e69bb7e55880cb93dc11dc9d13
Author: Remy Noulin (Spartatek) <remy.noulin@spartatek.se>
Date:   Wed, 23 Nov 2016 20:34:50 +0100

add multiple configuration

The configuration is saved in 3 locations:

- $GIT_OFF_CONFIG
- repo config: .git-off file at the root of repo
- global git config

For each key:

- git off looks for the value in $GIT_OFF_CONFIG
- if the key is not found, git off looks for the value in repo config
- if the key is not found, git off looks for the value in the global git
  config

README.md         | 41 ++++++++++++++++++++++++++++++++++++++++-
package.json      |  2 +-
src/gitoff.coffee | 24 +++++++++++++++++++++---
3 files changed, 62 insertions(+), 5 deletions(-)

Diffstat:
MREADME.md | 41++++++++++++++++++++++++++++++++++++++++-
Mpackage.json | 2+-
Msrc/gitoff.coffee | 24+++++++++++++++++++++---
3 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -1,6 +1,6 @@ git-off handles large files in git repos. -This is a prototype inspired by git lfs and git fat. +This is a prototype inspired by [git lfs](https://github.com/git-lfs/git-lfs) and [git fat](https://github.com/jedbrown/git-fat). By default the files are stored in the home directory. @@ -59,6 +59,30 @@ git off defaults shows first time config ``` +# Configuration + +The configuration is saved in 3 locations: + +- $GIT_OFF_CONFIG +- repo config: .git-off file at the root of repo +- global git config + +For each key: + +- git off looks for the value in $GIT_OFF_CONFIG +- if the key is not found, git off looks for the value in repo config +- if the key is not found, git off looks for the value in the global git config + +Run: + +``` +git off env +``` + +to see the current configuration. + +The log file location is always configured in the global git config. + # SSH Setup Create an SSH key: @@ -170,3 +194,18 @@ git off help - nodejs - git - ssh and scp for scp transport + +# Platforms + +- Linux +- MacOS + +# Hacking + +Edit _src/gitoff.coffee_ and then run `./gen.sh` + +Alternatively, edit the generated javascript file directly (_src/git-off_) + +# Contributions + +I'm looking for someone who can contribute to the windows version. diff --git a/package.json b/package.json @@ -1,6 +1,6 @@ { "name": "git-off", - "version": "0.0.3", + "version": "0.0.4", "description": "large file handler for git", "bin": "./src/git-off", "scripts": { diff --git a/src/gitoff.coffee b/src/gitoff.coffee @@ -1,9 +1,7 @@ #! /usr/bin/env coffee # TODO -# add multiple config like our git fat # add help -# add rsync backend - change push and smudge # handle wrong config like getLog # add a command to copy stores # check parameters from CLI @@ -22,7 +20,13 @@ # update help # # How to add a new transport +# add transport functions in offHelpers.setTransport +# if needed, add store creation in offCommands.install +# # How to add a new command +# add command in offCommands +# add command in CLI parser +# update help ### # CODE @@ -155,12 +159,25 @@ gitConfig = return 'get': (key) -> + # return value from + # GIT_OFF_CONFIG if found + # repo config if found + # global config + if process.env.GIT_OFF_CONFIG != undefined and fs.existsSync(process.env.GIT_OFF_CONFIG) == true + r = exec('gitConfig', ['--file ' + process.env.GIT_OFF_CONFIG, key]).stdout.trim() + if r != '' + return r if fs.existsSync(offHelpers.gitRepoRoot(true) + '/.git-off') == false exec('gitConfig', [key]).stdout.trim() else - exec('gitConfig', ['--file ' + offHelpers.gitRepoRoot() + '/.git-off', key]).stdout.trim() + r = exec('gitConfig', ['--file ' + offHelpers.gitRepoRoot() + '/.git-off', key]).stdout.trim() + if r != '' + return r + exec('gitConfig', [key]).stdout.trim() + 'getSyncexec': (key) -> + # always global git config syncexec externalHelpers.gitConfig + ' ' + key # appends log to git config off.log @@ -945,6 +962,7 @@ if process.argv[2] == 'help' or process.argv[2] == undefined console.log ' shows current config'.green console.log 'git off defaults' console.log ' shows first time config'.green + console.log '\nGo to https://github.com/RemyNoulin/git-off for more information'.green.bold else console.log 'Command help TODO' # TODO option: thisrepo for local config