commit c9eccc08cabb24150972c5966955ee0f0979a8cd
parent 3ae1d735fcac2e663e83f81df6d5de866d0ecb85
Author: Remy Noulin (Spartatek) <remy.noulin@spartatek.se>
Date: Thu, 24 Nov 2016 12:11:24 +0100
add offNoValue for pem and configAlways
To be able to set an empty value when there are multiple configs.
README.md | 4 +++-
src/gitoff.coffee | 24 ++++++++++++------------
2 files changed, 15 insertions(+), 13 deletions(-)
Diffstat:
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
@@ -124,6 +124,7 @@ git off integrity [thisrepo] [enable|disable]
git off pem [thisrepo] [pathToPrivateKey]
set/show git off pem.
off.pem is the private key for ssh and scp
+ set 'offNoValue' to set an empty value (useful when there are multiple configs)
git off sshoptions [thisrepo] [options]
set/show git off sshoptions
git off scpoptions [thisrepo] [options]
@@ -135,11 +136,12 @@ git off track
example: git off track '*.bin'
without parameter, list git off attributes
calls git off install
-git off configAlways [thisrepo] [''|GIT_OFF_CONFIG|repo|global]
+git off configAlways [''|GIT_OFF_CONFIG|repo|global]
'' disable configAlways
GIT_OFF_CONFIG load all configurations from $GIT_OFF_CONFIG
repo load all configurations from current git repo
global load all configurations from global git config
+ set 'offNoValue' to set an empty value
git off clean
internal filter
dont use directly
diff --git a/src/gitoff.coffee b/src/gitoff.coffee
@@ -129,12 +129,12 @@ offDEFAULTS =
'objectPath': '/.git/off/objects'
'mode': 'copy'
'integrity': 'disable'
- 'pem': ''
+ 'pem': 'offNoValue'
'sshOptions': '-C -o StrictHostKeyChecking=no -o ConnectTimeout=3'
'scpOptions': '-C -o StrictHostKeyChecking=no -o ConnectTimeout=3 -p'
'store': '~/.git-off/offStore'
'log': '~/.git-off/log'
- 'configAlways': ''
+ 'configAlways': 'offNoValue'
'prePush': '#!/bin/sh\ncommand -v git-off >/dev/null 2>&1 || { echo >&2 "\\nThis repository is configured for Git off but \'git-off\' was not found on your path. If you no longer wish to use git off, remove this hook by deleting .git/hooks/pre-push.\\n"; exit 2; }\ngit off pre-push "$@"'
'offSignature': '### git-off v1 sha:'
'shaLength': 40
@@ -389,7 +389,7 @@ offHelpers =
sshCmd += '"'
# setup ssh/scp private key
- if offHelpers.offPem() == ''
+ if offHelpers.offPem() == '' or offHelpers.offPem() == 'offNoValue'
pem = ''
else
pem = '-i ' + offHelpers.offPem()
@@ -405,7 +405,7 @@ offHelpers =
# rm in remote store
# setup ssh/scp private key
- if offHelpers.offPem() == ''
+ if offHelpers.offPem() == '' or offHelpers.offPem() == 'offNoValue'
pem = ''
else
pem = '-i ' + offHelpers.offPem()
@@ -471,7 +471,7 @@ offHelpers =
offHelpers.mkdirStore f_l[0] + '/' + f_l[1]
# setup ssh/scp private key
- if offHelpers.offPem() == ''
+ if offHelpers.offPem() == '' or offHelpers.offPem() == 'offNoValue'
pem = ''
else
pem = '-i ' + offHelpers.offPem()
@@ -489,7 +489,7 @@ offHelpers =
mkdirParents offHelpers.objectPath() + '/' + f_l[0] + '/' + f_l[1]
# setup ssh/scp private key
- if offHelpers.offPem() == ''
+ if offHelpers.offPem() == '' or offHelpers.offPem() == 'offNoValue'
pem = ''
else
pem = '-i ' + offHelpers.offPem()
@@ -681,11 +681,11 @@ offCommands =
console.log l
return
- 'configAlways': (setCfg) ->
+ 'configAlways': ->
len = process.argv.length
configAlways = process.argv[len-1]
- if configAlways != 'configAlways' and configAlways != 'thisrepo'
- setCfg('off.configAlways', configAlways)
+ if configAlways != 'configAlways'
+ gitConfig.set 'off.configAlways', configAlways
else
console.log 'off.configAlways '.blue.bold + offHelpers.offConfigAlways()
return
@@ -978,7 +978,7 @@ COMMAND_MAP =
f: ->
thisrepo offCommands['pem']
return
- h: 'git off pem [thisrepo] [pathToPrivateKey]\n set/show git off pem.\n off.pem is the private key for ssh and scp'
+ h: "git off pem [thisrepo] [pathToPrivateKey]\n set/show git off pem.\n off.pem is the private key for ssh and scp\n set 'offNoValue' to set an empty value (useful when there are multiple configs)"
'sshoptions':
f: ->
@@ -1006,9 +1006,9 @@ COMMAND_MAP =
'configAlways':
f: ->
- thisrepo offCommands['configAlways']
+ offCommands.configAlways()
return
- h: "git off configAlways [thisrepo] [''|GIT_OFF_CONFIG|repo|global]\n '' disable configAlways\n GIT_OFF_CONFIG load all configurations from $GIT_OFF_CONFIG\n repo load all configurations from current git repo\n global load all configurations from global git config"
+ h: "git off configAlways [''|GIT_OFF_CONFIG|repo|global]\n '' disable configAlways\n GIT_OFF_CONFIG load all configurations from $GIT_OFF_CONFIG\n repo load all configurations from current git repo\n global load all configurations from global git config\n set 'offNoValue' to set an empty value"
'clean':
f: ->