git-off

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

commit ea286a8ea769650e74ee2cd2a8ae56ac17a217f7
parent 8a29f54374fe5a1df4911c2e2ba59c94335693a5
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed, 21 Dec 2016 20:09:36 +0100

add ct command to clear tmp used by transform

README.md         | 14 ++++++++++++++
c/git-off.c       | 45 ++++++++++++++++++++++++++++++++++++---------
c/gitoff.c        | 45 ++++++++++++++++++++++++++++++++++++---------
package.json      |  2 +-
src/git-off       | 17 ++++++++++++++++-
src/gitoff.coffee | 19 ++++++++++++++++++-
6 files changed, 121 insertions(+), 21 deletions(-)

Diffstat:
MREADME.md | 14++++++++++++++
Mc/git-off.c | 45++++++++++++++++++++++++++++++++++++---------
Mc/gitoff.c | 45++++++++++++++++++++++++++++++++++++---------
Mpackage.json | 2+-
Msrc/git-off | 17++++++++++++++++-
Msrc/gitoff.coffee | 19++++++++++++++++++-
6 files changed, 121 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md @@ -31,12 +31,20 @@ for help. There is a git-off written in C in the c directory. To use it do the following step: +In Debian: ``` apt-get install tcc cd /usr/local/bin ln -s $PATH_TO_GITOFF_GIT/c/gitoff git-off.c ``` +In MacOS: +``` +cd /usr/local/bin +clang -o git-off $PATH_TO_GITOFF_GIT/c/gitoff.c +``` + + # Quick Start Setup: @@ -292,6 +300,12 @@ git off clearStore delete store git off cs delete store +git off clearTmp + delete tmp in git off cache + Useful when transform is enabled +git off ct + delete tmp in git off cache + Useful when transform is enabled git off defaults shows first time config git off env diff --git a/c/git-off.c b/c/git-off.c @@ -161,6 +161,7 @@ void offCommands_copyTo(); void offCommands_clearAll(); void offCommands_clearCache(); void offCommands_clearStore(); +void offCommands_clearTmp(); void offCommands_defaults(); void offCommands_env(); void offCommands_help(); @@ -192,6 +193,8 @@ void clearCacheF(); void ccF(); void clearStoreF(); void csF(); +void clearTmpF(); +void ctF(); void defaultsF(); void envF(); void helpF(); @@ -1504,14 +1507,14 @@ void thisrepo(cmdSetF_t cmd) { -enum { installH, modeH, storeH, scpH, httpH, curlH, integrityH, pemH, sshoptionsH, scpoptionsH, scpuserH, trackH, configAlwaysH, s3regionH, s3bucketH, transformH, transformToH, transformFromH, cleanH, prepushH, smudgeH, copyToH, clearAllH, caH, clearCacheH, ccH, clearStoreH, csH, defaultsH, envH, helpH, lastH }; -char* COMMAND_HELP[32] = { "git off install [thisrepo]\n setup git config (default global)\n thisrepo sets up config in current repo", "git off mode [thisrepo] [copy|scp|http|s3]\n set/show git off mode", "git off store [thisrepo] [path]\n set/show git off store path for copy mode", "git off scp [thisrepo] [host]\n setup scp config\n host has format host:path, user@host:path, user@host:port/path\n Example: localhost:/tmp/offStore", "git off http [thisrepo] [host]\n setup http config\n host has format http host/path\n Example http localhost/offStore", "git off curl [thisrepo] [options]\n setup curl config", "git off integrity [thisrepo] [enable|disable]\n set/show git off integrity.\n when enabled, the SHA of the file received from the store is\n checked again the SHA of the original file", "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)", "git off sshoptions [thisrepo] [options]\n set/show git off sshoptions", "git off scpoptions [thisrepo] [options]\n set/show git off scpoptions", "git off scpuser [thisrepo] [username]\n setup scp username config", "git off track\n setup gitattribute filters\n example: git off track \"*.bin\"\n without parameter, list git off attributes\n calls git off install", "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", "git off s3region [thisrepo] [region]\n setup amazon s3 region for the bucket", "git off s3bucket [thisrepo] [bucket]\n setup amazon s3 bucket", "git off transform [thisrepo] [enable|disable]\n enable transform in clean and smudge filters", "git off transformTo [thisrepo] [\"cmd _1 _2\"]\n setup transform command for clear filter\n When the command is empty the regular transport is performed", "git off transformFrom [thisrepo] [\"cmd _1 _2\"]\n setup transform command for smudge filter\n When the command is empty the regular transport is performed", "git off clean\n internal filter\n dont use directly", "git off pre-push\n internal filter\n dont use directly", "git off smudge\n internal filter\n dont use directly", "git off copyTo [copy|scp|s3]\n copy cache to store for specified mode", "git off clearAll\n delete store, cache and log", "git off ca\n delete store, cache and log", "git off clearCache\n delete cache in current git", "git off cc\n delete cache in current git", "git off clearStore\n delete store", "git off cs\n delete store", "git off defaults\n shows first time config", "git off env\n shows config", "git off help [cmd]\n git off help. Run git off help command to get help for a specific command.", "not a command" }; +enum { installH, modeH, storeH, scpH, httpH, curlH, integrityH, pemH, sshoptionsH, scpoptionsH, scpuserH, trackH, configAlwaysH, s3regionH, s3bucketH, transformH, transformToH, transformFromH, cleanH, prepushH, smudgeH, copyToH, clearAllH, caH, clearCacheH, ccH, clearStoreH, csH, clearTmpH, ctH, defaultsH, envH, helpH, lastH }; +char* COMMAND_HELP[34] = { "git off install [thisrepo]\n setup git config (default global)\n thisrepo sets up config in current repo", "git off mode [thisrepo] [copy|scp|http|s3]\n set/show git off mode", "git off store [thisrepo] [path]\n set/show git off store path for copy mode", "git off scp [thisrepo] [host]\n setup scp config\n host has format host:path, user@host:path, user@host:port/path\n Example: localhost:/tmp/offStore", "git off http [thisrepo] [host]\n setup http config\n host has format http host/path\n Example http localhost/offStore", "git off curl [thisrepo] [options]\n setup curl config", "git off integrity [thisrepo] [enable|disable]\n set/show git off integrity.\n when enabled, the SHA of the file received from the store is\n checked again the SHA of the original file", "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)", "git off sshoptions [thisrepo] [options]\n set/show git off sshoptions", "git off scpoptions [thisrepo] [options]\n set/show git off scpoptions", "git off scpuser [thisrepo] [username]\n setup scp username config", "git off track\n setup gitattribute filters\n example: git off track \"*.bin\"\n without parameter, list git off attributes\n calls git off install", "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", "git off s3region [thisrepo] [region]\n setup amazon s3 region for the bucket", "git off s3bucket [thisrepo] [bucket]\n setup amazon s3 bucket", "git off transform [thisrepo] [enable|disable]\n enable transform in clean and smudge filters", "git off transformTo [thisrepo] [\"cmd _1 _2\"]\n setup transform command for clear filter\n When the command is empty the regular transport is performed", "git off transformFrom [thisrepo] [\"cmd _1 _2\"]\n setup transform command for smudge filter\n When the command is empty the regular transport is performed", "git off clean\n internal filter\n dont use directly", "git off pre-push\n internal filter\n dont use directly", "git off smudge\n internal filter\n dont use directly", "git off copyTo [copy|scp|s3]\n copy cache to store for specified mode", "git off clearAll\n delete store, cache and log", "git off ca\n delete store, cache and log", "git off clearCache\n delete cache in current git", "git off cc\n delete cache in current git", "git off clearStore\n delete store", "git off cs\n delete store", "git off clearTmp\n delete tmp in git off cache\n Useful when transform is enabled", "git off ct\n delete tmp in git off cache\n Useful when transform is enabled", "git off defaults\n shows first time config", "git off env\n shows config", "git off help [cmd]\n git off help. Run git off help command to get help for a specific command.", "not a command" }; -enum { installC, modeC, storeC, scpC, httpC, curlC, integrityC, pemC, sshoptionsC, scpoptionsC, scpuserC, trackC, configAlwaysC, s3regionC, s3bucketC, transformC, transformToC, transformFromC, cleanC, prepushC, smudgeC, copyToC, clearAllC, caC, clearCacheC, ccC, clearStoreC, csC, defaultsC, envC, helpC, lastC }; -char* COMMAND_MAP[32] = { "install", "mode", "store", "scp", "http", "curl", "integrity", "pem", "sshoptions", "scpoptions", "scpuser", "track", "configAlways", "s3region", "s3bucket", "transform", "transformTo", "transformFrom", "clean", "pre-push", "smudge", "copyTo", "clearAll", "ca", "clearCache", "cc", "clearStore", "cs", "defaults", "env", "help", "not a command" }; +enum { installC, modeC, storeC, scpC, httpC, curlC, integrityC, pemC, sshoptionsC, scpoptionsC, scpuserC, trackC, configAlwaysC, s3regionC, s3bucketC, transformC, transformToC, transformFromC, cleanC, prepushC, smudgeC, copyToC, clearAllC, caC, clearCacheC, ccC, clearStoreC, csC, clearTmpC, ctC, defaultsC, envC, helpC, lastC }; +char* COMMAND_MAP[34] = { "install", "mode", "store", "scp", "http", "curl", "integrity", "pem", "sshoptions", "scpoptions", "scpuser", "track", "configAlways", "s3region", "s3bucket", "transform", "transformTo", "transformFrom", "clean", "pre-push", "smudge", "copyTo", "clearAll", "ca", "clearCache", "cc", "clearStore", "cs", "clearTmp", "ct", "defaults", "env", "help", "not a command" }; -enum { installG, modeG, storeG, scpG, httpG, curlG, integrityG, pemG, sshoptionsG, scpoptionsG, scpuserG, trackG, configAlwaysG, s3regionG, s3bucketG, transformG, transformToG, transformFromG, cleanG, prepushG, smudgeG, copyToG, clearAllG, caG, clearCacheG, ccG, clearStoreG, csG, defaultsG, envG, helpG, lastG }; -char* COMMAND_GITCONFIG[32] = { "empty", "off.mode", "off.store", "off.scp", "off.http", "off.curloptions", "off.integrity", "off.pem", "off.sshoptions", "off.scpoptions", "off.scpuser", "empty", "off.configAlways", "off.s3region", "off.s3bucket", "off.transform", "off.transformTo", "off.transformFrom", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "not a command" }; +enum { installG, modeG, storeG, scpG, httpG, curlG, integrityG, pemG, sshoptionsG, scpoptionsG, scpuserG, trackG, configAlwaysG, s3regionG, s3bucketG, transformG, transformToG, transformFromG, cleanG, prepushG, smudgeG, copyToG, clearAllG, caG, clearCacheG, ccG, clearStoreG, csG, clearTmpG, ctG, defaultsG, envG, helpG, lastG }; +char* COMMAND_GITCONFIG[34] = { "empty", "off.mode", "off.store", "off.scp", "off.http", "off.curloptions", "off.integrity", "off.pem", "off.sshoptions", "off.scpoptions", "off.scpuser", "empty", "off.configAlways", "off.s3region", "off.s3bucket", "off.transform", "off.transformTo", "off.transformFrom", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "not a command" }; // functions called for commands typedef void (*cmdF_t)(); @@ -2160,6 +2163,16 @@ void offCommands_clearStore() { } } +void offCommands_clearTmp() { + char *p = NULL; + + // delete tmp in cache in current git + p = malloc(strlen(offHelpers_gitRepoRoot()) + 1 + 13); + sprintf(p, "%s/.git/off/tmp", offHelpers_gitRepoRoot()); + rmAll(p); + free(p); +} + void offCommands_defaults() { int i; @@ -2407,6 +2420,16 @@ void csF() { offCommands_clearStore(); } +void clearTmpF() { + + offCommands_clearTmp(); +} + +void ctF() { + + offCommands_clearTmp(); +} + void defaultsF() { offCommands_defaults(); @@ -2453,9 +2476,11 @@ void initCOMMAND_FUNC() { COMMAND_FUNC[25] = ccF; COMMAND_FUNC[26] = clearStoreF; COMMAND_FUNC[27] = csF; - COMMAND_FUNC[28] = defaultsF; - COMMAND_FUNC[29] = envF; - COMMAND_FUNC[30] = helpF; + COMMAND_FUNC[28] = clearTmpF; + COMMAND_FUNC[29] = ctF; + COMMAND_FUNC[30] = defaultsF; + COMMAND_FUNC[31] = envF; + COMMAND_FUNC[32] = helpF; COMMAND_FUNC[lastC] = NULL; COMMAND_HELPERS[0] = NULL; @@ -2489,6 +2514,8 @@ void initCOMMAND_FUNC() { COMMAND_HELPERS[28] = NULL; COMMAND_HELPERS[29] = NULL; COMMAND_HELPERS[30] = NULL; + COMMAND_HELPERS[31] = NULL; + COMMAND_HELPERS[32] = NULL; COMMAND_HELPERS[lastC] = NULL; } diff --git a/c/gitoff.c b/c/gitoff.c @@ -160,6 +160,7 @@ void offCommands_copyTo(); void offCommands_clearAll(); void offCommands_clearCache(); void offCommands_clearStore(); +void offCommands_clearTmp(); void offCommands_defaults(); void offCommands_env(); void offCommands_help(); @@ -191,6 +192,8 @@ void clearCacheF(); void ccF(); void clearStoreF(); void csF(); +void clearTmpF(); +void ctF(); void defaultsF(); void envF(); void helpF(); @@ -1503,14 +1506,14 @@ void thisrepo(cmdSetF_t cmd) { -enum { installH, modeH, storeH, scpH, httpH, curlH, integrityH, pemH, sshoptionsH, scpoptionsH, scpuserH, trackH, configAlwaysH, s3regionH, s3bucketH, transformH, transformToH, transformFromH, cleanH, prepushH, smudgeH, copyToH, clearAllH, caH, clearCacheH, ccH, clearStoreH, csH, defaultsH, envH, helpH, lastH }; -char* COMMAND_HELP[32] = { "git off install [thisrepo]\n setup git config (default global)\n thisrepo sets up config in current repo", "git off mode [thisrepo] [copy|scp|http|s3]\n set/show git off mode", "git off store [thisrepo] [path]\n set/show git off store path for copy mode", "git off scp [thisrepo] [host]\n setup scp config\n host has format host:path, user@host:path, user@host:port/path\n Example: localhost:/tmp/offStore", "git off http [thisrepo] [host]\n setup http config\n host has format http host/path\n Example http localhost/offStore", "git off curl [thisrepo] [options]\n setup curl config", "git off integrity [thisrepo] [enable|disable]\n set/show git off integrity.\n when enabled, the SHA of the file received from the store is\n checked again the SHA of the original file", "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)", "git off sshoptions [thisrepo] [options]\n set/show git off sshoptions", "git off scpoptions [thisrepo] [options]\n set/show git off scpoptions", "git off scpuser [thisrepo] [username]\n setup scp username config", "git off track\n setup gitattribute filters\n example: git off track \"*.bin\"\n without parameter, list git off attributes\n calls git off install", "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", "git off s3region [thisrepo] [region]\n setup amazon s3 region for the bucket", "git off s3bucket [thisrepo] [bucket]\n setup amazon s3 bucket", "git off transform [thisrepo] [enable|disable]\n enable transform in clean and smudge filters", "git off transformTo [thisrepo] [\"cmd _1 _2\"]\n setup transform command for clear filter\n When the command is empty the regular transport is performed", "git off transformFrom [thisrepo] [\"cmd _1 _2\"]\n setup transform command for smudge filter\n When the command is empty the regular transport is performed", "git off clean\n internal filter\n dont use directly", "git off pre-push\n internal filter\n dont use directly", "git off smudge\n internal filter\n dont use directly", "git off copyTo [copy|scp|s3]\n copy cache to store for specified mode", "git off clearAll\n delete store, cache and log", "git off ca\n delete store, cache and log", "git off clearCache\n delete cache in current git", "git off cc\n delete cache in current git", "git off clearStore\n delete store", "git off cs\n delete store", "git off defaults\n shows first time config", "git off env\n shows config", "git off help [cmd]\n git off help. Run git off help command to get help for a specific command.", "not a command" }; +enum { installH, modeH, storeH, scpH, httpH, curlH, integrityH, pemH, sshoptionsH, scpoptionsH, scpuserH, trackH, configAlwaysH, s3regionH, s3bucketH, transformH, transformToH, transformFromH, cleanH, prepushH, smudgeH, copyToH, clearAllH, caH, clearCacheH, ccH, clearStoreH, csH, clearTmpH, ctH, defaultsH, envH, helpH, lastH }; +char* COMMAND_HELP[34] = { "git off install [thisrepo]\n setup git config (default global)\n thisrepo sets up config in current repo", "git off mode [thisrepo] [copy|scp|http|s3]\n set/show git off mode", "git off store [thisrepo] [path]\n set/show git off store path for copy mode", "git off scp [thisrepo] [host]\n setup scp config\n host has format host:path, user@host:path, user@host:port/path\n Example: localhost:/tmp/offStore", "git off http [thisrepo] [host]\n setup http config\n host has format http host/path\n Example http localhost/offStore", "git off curl [thisrepo] [options]\n setup curl config", "git off integrity [thisrepo] [enable|disable]\n set/show git off integrity.\n when enabled, the SHA of the file received from the store is\n checked again the SHA of the original file", "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)", "git off sshoptions [thisrepo] [options]\n set/show git off sshoptions", "git off scpoptions [thisrepo] [options]\n set/show git off scpoptions", "git off scpuser [thisrepo] [username]\n setup scp username config", "git off track\n setup gitattribute filters\n example: git off track \"*.bin\"\n without parameter, list git off attributes\n calls git off install", "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", "git off s3region [thisrepo] [region]\n setup amazon s3 region for the bucket", "git off s3bucket [thisrepo] [bucket]\n setup amazon s3 bucket", "git off transform [thisrepo] [enable|disable]\n enable transform in clean and smudge filters", "git off transformTo [thisrepo] [\"cmd _1 _2\"]\n setup transform command for clear filter\n When the command is empty the regular transport is performed", "git off transformFrom [thisrepo] [\"cmd _1 _2\"]\n setup transform command for smudge filter\n When the command is empty the regular transport is performed", "git off clean\n internal filter\n dont use directly", "git off pre-push\n internal filter\n dont use directly", "git off smudge\n internal filter\n dont use directly", "git off copyTo [copy|scp|s3]\n copy cache to store for specified mode", "git off clearAll\n delete store, cache and log", "git off ca\n delete store, cache and log", "git off clearCache\n delete cache in current git", "git off cc\n delete cache in current git", "git off clearStore\n delete store", "git off cs\n delete store", "git off clearTmp\n delete tmp in git off cache\n Useful when transform is enabled", "git off ct\n delete tmp in git off cache\n Useful when transform is enabled", "git off defaults\n shows first time config", "git off env\n shows config", "git off help [cmd]\n git off help. Run git off help command to get help for a specific command.", "not a command" }; -enum { installC, modeC, storeC, scpC, httpC, curlC, integrityC, pemC, sshoptionsC, scpoptionsC, scpuserC, trackC, configAlwaysC, s3regionC, s3bucketC, transformC, transformToC, transformFromC, cleanC, prepushC, smudgeC, copyToC, clearAllC, caC, clearCacheC, ccC, clearStoreC, csC, defaultsC, envC, helpC, lastC }; -char* COMMAND_MAP[32] = { "install", "mode", "store", "scp", "http", "curl", "integrity", "pem", "sshoptions", "scpoptions", "scpuser", "track", "configAlways", "s3region", "s3bucket", "transform", "transformTo", "transformFrom", "clean", "pre-push", "smudge", "copyTo", "clearAll", "ca", "clearCache", "cc", "clearStore", "cs", "defaults", "env", "help", "not a command" }; +enum { installC, modeC, storeC, scpC, httpC, curlC, integrityC, pemC, sshoptionsC, scpoptionsC, scpuserC, trackC, configAlwaysC, s3regionC, s3bucketC, transformC, transformToC, transformFromC, cleanC, prepushC, smudgeC, copyToC, clearAllC, caC, clearCacheC, ccC, clearStoreC, csC, clearTmpC, ctC, defaultsC, envC, helpC, lastC }; +char* COMMAND_MAP[34] = { "install", "mode", "store", "scp", "http", "curl", "integrity", "pem", "sshoptions", "scpoptions", "scpuser", "track", "configAlways", "s3region", "s3bucket", "transform", "transformTo", "transformFrom", "clean", "pre-push", "smudge", "copyTo", "clearAll", "ca", "clearCache", "cc", "clearStore", "cs", "clearTmp", "ct", "defaults", "env", "help", "not a command" }; -enum { installG, modeG, storeG, scpG, httpG, curlG, integrityG, pemG, sshoptionsG, scpoptionsG, scpuserG, trackG, configAlwaysG, s3regionG, s3bucketG, transformG, transformToG, transformFromG, cleanG, prepushG, smudgeG, copyToG, clearAllG, caG, clearCacheG, ccG, clearStoreG, csG, defaultsG, envG, helpG, lastG }; -char* COMMAND_GITCONFIG[32] = { "empty", "off.mode", "off.store", "off.scp", "off.http", "off.curloptions", "off.integrity", "off.pem", "off.sshoptions", "off.scpoptions", "off.scpuser", "empty", "off.configAlways", "off.s3region", "off.s3bucket", "off.transform", "off.transformTo", "off.transformFrom", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "not a command" }; +enum { installG, modeG, storeG, scpG, httpG, curlG, integrityG, pemG, sshoptionsG, scpoptionsG, scpuserG, trackG, configAlwaysG, s3regionG, s3bucketG, transformG, transformToG, transformFromG, cleanG, prepushG, smudgeG, copyToG, clearAllG, caG, clearCacheG, ccG, clearStoreG, csG, clearTmpG, ctG, defaultsG, envG, helpG, lastG }; +char* COMMAND_GITCONFIG[34] = { "empty", "off.mode", "off.store", "off.scp", "off.http", "off.curloptions", "off.integrity", "off.pem", "off.sshoptions", "off.scpoptions", "off.scpuser", "empty", "off.configAlways", "off.s3region", "off.s3bucket", "off.transform", "off.transformTo", "off.transformFrom", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "empty", "not a command" }; // functions called for commands typedef void (*cmdF_t)(); @@ -2159,6 +2162,16 @@ void offCommands_clearStore() { } } +void offCommands_clearTmp() { + char *p = NULL; + + // delete tmp in cache in current git + p = malloc(strlen(offHelpers_gitRepoRoot()) + 1 + 13); + sprintf(p, "%s/.git/off/tmp", offHelpers_gitRepoRoot()); + rmAll(p); + free(p); +} + void offCommands_defaults() { int i; @@ -2406,6 +2419,16 @@ void csF() { offCommands_clearStore(); } +void clearTmpF() { + + offCommands_clearTmp(); +} + +void ctF() { + + offCommands_clearTmp(); +} + void defaultsF() { offCommands_defaults(); @@ -2452,9 +2475,11 @@ void initCOMMAND_FUNC() { COMMAND_FUNC[25] = ccF; COMMAND_FUNC[26] = clearStoreF; COMMAND_FUNC[27] = csF; - COMMAND_FUNC[28] = defaultsF; - COMMAND_FUNC[29] = envF; - COMMAND_FUNC[30] = helpF; + COMMAND_FUNC[28] = clearTmpF; + COMMAND_FUNC[29] = ctF; + COMMAND_FUNC[30] = defaultsF; + COMMAND_FUNC[31] = envF; + COMMAND_FUNC[32] = helpF; COMMAND_FUNC[lastC] = NULL; COMMAND_HELPERS[0] = NULL; @@ -2488,6 +2513,8 @@ void initCOMMAND_FUNC() { COMMAND_HELPERS[28] = NULL; COMMAND_HELPERS[29] = NULL; COMMAND_HELPERS[30] = NULL; + COMMAND_HELPERS[31] = NULL; + COMMAND_HELPERS[32] = NULL; COMMAND_HELPERS[lastC] = NULL; } diff --git a/package.json b/package.json @@ -1,6 +1,6 @@ { "name": "git-off", - "version": "0.0.11", + "version": "0.0.12", "description": "large file handler for git", "bin": "./src/git-off", "scripts": { diff --git a/src/git-off b/src/git-off @@ -1096,6 +1096,9 @@ offCommands = { offHelpers.rmAllStore(''); } }, + 'clearTmp': function() { + rmAll(offHelpers.gitRepoRoot() + '/.git/off/tmp'); + }, 'defaults': function() { var i, k, len1, ref; ref = Object.keys(offDEFAULTS); @@ -1347,7 +1350,19 @@ COMMAND_MAP = { f: function() { offCommands.clearStore(); }, - h: 'git off cs\n delete store' + h: 'git off ct\n delete store' + }, + 'clearTmp': { + f: function() { + offCommands.clearTmp(); + }, + h: 'git off clearTmp\n delete tmp in git off cache\n Useful when transform is enabled' + }, + 'ct': { + f: function() { + offCommands.clearTmp(); + }, + h: 'git off cs\n delete tmp in git off cache\n Useful when transform is enabled' }, 'defaults': { f: function() { diff --git a/src/gitoff.coffee b/src/gitoff.coffee @@ -1219,6 +1219,11 @@ offCommands = offHelpers.rmAllStore '' return + 'clearTmp': -> + # delete cache in current git + rmAll offHelpers.gitRepoRoot()+'/.git/off/tmp' + return + 'defaults': -> # show first time config (offDEFAULTS) for k in Object.keys(offDEFAULTS) @@ -1467,7 +1472,19 @@ COMMAND_MAP = f: -> offCommands.clearStore() return - h: 'git off cs\n delete store' + h: 'git off ct\n delete store' + + 'clearTmp': + f: -> + offCommands.clearTmp() + return + h: 'git off clearTmp\n delete tmp in git off cache\n Useful when transform is enabled' + + 'ct': + f: -> + offCommands.clearTmp() + return + h: 'git off cs\n delete tmp in git off cache\n Useful when transform is enabled' 'defaults': f: ->