Merge pull request #2 from pyr0ball/experiments
added function to validate a git repo directory
This commit is contained in:
commit
757a0b7cda
1 changed files with 20 additions and 3 deletions
17
functions
17
functions
|
|
@ -253,6 +253,7 @@ box-light(){
|
||||||
box-singlechar(){
|
box-singlechar(){
|
||||||
set_borders "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "-"
|
set_borders "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "$borderchar" "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
set-boxtype(){
|
set-boxtype(){
|
||||||
case $boxtype in
|
case $boxtype in
|
||||||
norm) box-norm ;;
|
norm) box-norm ;;
|
||||||
|
|
@ -602,6 +603,22 @@ run-from-url(){
|
||||||
return $ec
|
return $ec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check-git-repository(){
|
||||||
|
repodir=${1:-$rundir}
|
||||||
|
if [ -z $repodir ] ; then
|
||||||
|
warn "check-git-repository() Incorrect usage. Usage: check-git-repository </path/to/dir>"
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if git -C "$repodir" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
echo "Directory '$repodir' is a valid Git repository."
|
||||||
|
return 0
|
||||||
|
# Your script logic here
|
||||||
|
else
|
||||||
|
echo "Directory '$repodir' is not a valid Git repository"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# fancy script exits
|
# fancy script exits
|
||||||
|
|
||||||
ctrl_c(){
|
ctrl_c(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue