Namespace src/Git

src/Git

Overview

Directory src/Git

file source src/Git/cloneOrPullIfNoChanges.sh

Git::cloneOrPullIfNoChanges

clone the repository if not done yet, else pull it if no change in it

Arguments
  • $1 (dir:String): directory in which repository is installed or will be cloned
  • $2 (repo:String): repository url
  • $3 (cloneCallback:Function): callback on successful clone
  • $4 (pullCallback:Function): callback on successful pull
Environment variables
  • GIT_CLONE_OPTIONS:String (additional): options to pass to git clone command
  • SUDO (String): allows to use custom sudo prefix command
Exit codes
  • 0: on successful pulling/cloning, 1 on failure

src/Git/pullIfNoChanges.sh

file source src/Git/pullIfNoChanges.sh

Git::pullIfNoChanges

pull git directory only if no change has been detected

Arguments
  • $1 (dir:String): the git directory to pull
Environment variables
  • SUDO (String): allows to use custom sudo prefix command
Exit codes
  • 0: on successful pulling
  • 1: on any other failure
  • 2: changes detected, pull avoided
  • 3: not a git directory
  • 4: not able to update index
  • 5: not a branch, pull avoided
Output on stderr
  • diagnostics information is displayed
Requires
  • Git::requireGitCommand

src/Git/requireGitCommand.sh

file source src/Git/requireGitCommand.sh

Git::requireGitCommand

ensure command git is available

Exit codes
  • 1: if git command not available
Output on stderr
  • diagnostics information is displayed

src/Git/shallowClone.sh

file source src/Git/shallowClone.sh

Git::shallowClone

1 Warning(s)

shallow clone a repository at specific commit sha, tag or branch or update repo if already exists

Arguments
  • $1 repository:String
  • $2 (installDir:String): Install dir
  • $3 (revision:String): commit sha, tag or branch
  • $4 (forceDeletion:Boolean): (optional) put “FORCE_DELETION” to force directory deletion if directory exists and it’s not a git repository (default: 0)
Exit codes
  • !=0: if git failure or directory not writable
  • 1: if destination dir already exists and force option is not 1
Output on stderr
  • display verbose status of the command execution
Warnings
  • USE THIS FORCE_DELETION ARGUMENT WITH CAUTION !!! as the directory will be deleted without any prompt
Or, if you want, you can alternatively use the GitHub discussion Q&A for feedback and questions.