diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2014-11-01 15:09:44 +0100 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2014-11-01 15:17:11 +0100 |
commit | faaa8a6acf1523c09cbc40c93efde6c9ce745711 (patch) | |
tree | 16551a513e85116166f300033d646d832b8430c0 /pkgs/build-support/fetchgit/nix-prefetch-git | |
parent | 754878afcc1755334283e853650c9935b980a6b3 (diff) |
nix-prefetch-git: remove unneeded semicolons
Shell isn't Perl ;-)
Diffstat (limited to 'pkgs/build-support/fetchgit/nix-prefetch-git')
-rwxr-xr-x | pkgs/build-support/fetchgit/nix-prefetch-git | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index de96fc96a594..0a01794f4665 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -80,14 +80,14 @@ fi init_remote(){ - local url=$1; - git init; - git remote add origin $url; + local url=$1 + git init + git remote add origin $url } # Return the reference of an hash if it exists on the remote repository. ref_from_hash(){ - local hash=$1; + local hash=$1 git ls-remote origin | sed -n "\,$hash\t, { s,\(.*\)\t\(.*\),\2,; p; q}" } @@ -99,12 +99,12 @@ hash_from_ref(){ # Fetch everything and checkout the right sha1 checkout_hash(){ - local hash="$1"; - local ref="$2"; + local hash="$1" + local ref="$2" if test -z "$hash"; then - hash=$(hash_from_ref $ref); - fi; + hash=$(hash_from_ref $ref) + fi git fetch ${builder:+--progress} origin || return 1 git checkout -b fetchgit $hash || return 1 @@ -112,8 +112,8 @@ checkout_hash(){ # Fetch only a branch/tag and checkout it. checkout_ref(){ - local hash="$1"; - local ref="$2"; + local hash="$1" + local ref="$2" if "$deepClone"; then # The caller explicitly asked for a deep clone. Deep clones @@ -124,16 +124,16 @@ checkout_ref(){ fi if test -z "$ref"; then - ref=$(ref_from_hash $hash); - fi; + ref=$(ref_from_hash $hash) + fi if test -n "$ref"; then # --depth option is ignored on http repository. git fetch ${builder:+--progress} --depth 1 origin +"$ref" || return 1 git checkout -b fetchgit FETCH_HEAD || return 1 else - return 1; - fi; + return 1 + fi } # Update submodules @@ -145,20 +145,20 @@ init_submodules(){ git submodule status | while read l; do # checkout each submodule - local hash=$(echo $l | awk '{print substr($1,2)}'); - local dir=$(echo $l | awk '{print $2}'); + local hash=$(echo $l | awk '{print substr($1,2)}') + local dir=$(echo $l | awk '{print $2}') local name=$( git config -f .gitmodules --get-regexp submodule\.[^.]*\.path | sed -n "s,^\(.*\)\.path $dir\$,\\1,p") - local url=$(git config -f .gitmodules --get ${name}.url); + local url=$(git config -f .gitmodules --get ${name}.url) # Get Absolute URL if we have a relative URL if ! echo "$url" | grep '^[a-zA-Z]\+://' >/dev/null 2>&1; then url="$(git config --get remote.origin.url)/$url" fi - clone "$dir" "$url" "$hash" ""; - done; + clone "$dir" "$url" "$hash" "" + done } clone(){ @@ -168,21 +168,21 @@ clone(){ local hash="$3" local ref="$4" - cd $dir; + cd $dir # Initialize the repository. - init_remote "$url"; + init_remote "$url" # Download data from the repository. checkout_ref "$hash" "$ref" || checkout_hash "$hash" "$ref" || ( - echo 1>&2 "Unable to checkout $hash$ref from $url."; - exit 1; + echo 1>&2 "Unable to checkout $hash$ref from $url." + exit 1 ) # Checkout linked sources. if test -n "$fetchSubmodules"; then - init_submodules; + init_submodules fi if [ -z "$builder" -a -f .topdeps ]; then @@ -196,7 +196,7 @@ clone(){ fi fi - cd $top; + cd $top } clone_user_rev() { @@ -210,10 +210,10 @@ clone_user_rev() { clone "$dir" "$url" "" "$rev" 1>&2;; *) if test -z "$(echo $rev | tr -d 0123456789abcdef)"; then - clone "$dir" "$url" "$rev" "" 1>&2; + clone "$dir" "$url" "$rev" "" 1>&2 else - echo 1>&2 "Bad commit hash or bad reference."; - exit 1; + echo 1>&2 "Bad commit hash or bad reference." + exit 1 fi;; esac |