Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Dumper/gitdumper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ function init_header() {
EOF
}

# get_arg "--git-dir=" ".git" "GITDIR" "$@" for "--git-dir=asd"
# get_git_dir "$@" for "--git-dir=asd"
# returns asd in GITDIR
function get_arg() {
local KEY=$1
local DEFAULT=$2
declare -n ret=$3
local ARGS=${@:4}
function get_git_dir() {
local FLAG="--git-dir="
local ARGS=${@}

for arg in $ARGS
do
if [[ $arg == $KEY* ]]; then
ret="${arg#$KEY}"
if [[ $arg == $FLAG* ]]; then
echo "${arg#$FLAG}"
return
fi
done

ret="$DEFAULT"
echo ".git"
}

init_header
Expand All @@ -43,7 +41,7 @@ QUEUE=();
DOWNLOADED=();
BASEURL="$1";
BASEDIR="$2";
get_arg "--git-dir=" ".git" "GITDIR" "$@"
GITDIR=$(get_git_dir "$@")
BASEGITDIR="$BASEDIR/$GITDIR/";

if [ $# -lt 2 ]; then
Expand Down