aboutsummaryrefslogtreecommitdiff
path: root/libs/git
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2017-10-26 02:57:32 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2017-10-28 23:30:02 -0400
commitc7377e3eb74a73874f9d2253083b3ae952156ac8 (patch)
tree2958d720389814a0640a61625705cb6a72a9f4a9 /libs/git
parent85934d62d767a484fa560066b6edb69a18145690 (diff)
downloadlibrebootfr-c7377e3eb74a73874f9d2253083b3ae952156ac8.tar.gz
librebootfr-c7377e3eb74a73874f9d2253083b3ae952156ac8.zip
Make use of Bash's '-n' operator for tests
As an example, do this: [[ -n $revision ]] instead of this: ! [[ -z $revision ]] Makes the code easier to read.
Diffstat (limited to 'libs/git')
-rwxr-xr-xlibs/git32
1 files changed, 16 insertions, 16 deletions
diff --git a/libs/git b/libs/git
index fdf4d753..7ede82b4 100755
--- a/libs/git
+++ b/libs/git
@@ -63,7 +63,7 @@ git_branch_create() {
cd "$repository_path"
git checkout -B "$branch"
- if ! [[ -z "$revision" ]]
+ if [[ -n "$revision" ]]
then
git reset --hard "$revision"
fi
@@ -129,7 +129,7 @@ git_fetch_check() {
fi
local output=$( git fetch --dry-run origin 2>&1 )
- if ! [[ -z "$output" ]]
+ if [[ -n "$output" ]]
then
return 1
fi
@@ -330,7 +330,7 @@ git_project_prepare_patch() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
if [[ -z "$path" ]]
then
@@ -353,7 +353,7 @@ git_project_prepare_patch() {
prepare_path=$path
done
- if ! [[ -z "$prepare_branch" ]]
+ if [[ -n "$prepare_branch" ]]
then
git_project_patch_recursive "$project" "$repository" "$prepare_branch" "$prepare_path"
fi
@@ -376,7 +376,7 @@ git_project_prepare_revision() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
if [[ -z "$path" ]]
then
@@ -399,7 +399,7 @@ git_project_prepare_revision() {
prepare_revision=$( cat "$revision_path" )
done
- if ! [[ -z "$prepare_branch" ]]
+ if [[ -n "$prepare_branch" ]]
then
git_branch_create "$repository_path" "$prepare_branch" "$prepare_revision"
fi
@@ -421,7 +421,7 @@ git_project_prepare_check() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
if [[ -z "$path" ]]
then
@@ -443,7 +443,7 @@ git_project_prepare_check() {
prepare_branch=$branch
done
- if ! [[ -z "$prepare_branch" ]]
+ if [[ -n "$prepare_branch" ]]
then
git_branch_check "$repository_path" "$prepare_branch"
fi
@@ -462,7 +462,7 @@ git_project_prepare_clean() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
branch="$branch-$argument"
fi
@@ -475,7 +475,7 @@ git_project_prepare_clean() {
prepare_branch=$branch
done
- if ! [[ -z "$prepare_branch" ]]
+ if [[ -n "$prepare_branch" ]]
then
# Let's not worry about missing branches.
(
@@ -504,7 +504,7 @@ git_project_checkout() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
branch="$branch-$argument"
fi
@@ -517,7 +517,7 @@ git_project_checkout() {
checkout_branch=$branch
done
- if ! [[ -z "$checkout_branch" ]]
+ if [[ -n "$checkout_branch" ]]
then
git_branch_checkout "$repository_path" "$checkout_branch"
git_submodule_update "$repository_path"
@@ -564,7 +564,7 @@ git_project_release() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
branch="$branch-$argument"
fi
@@ -577,7 +577,7 @@ git_project_release() {
release_branch=$branch
done
- if ! [[ -z "$release_branch" ]]
+ if [[ -n "$release_branch" ]]
then
local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE"
local sources_path="$root/$SOURCES/$repository"
@@ -605,7 +605,7 @@ git_project_release_check() {
for argument in "" "$@"
do
- if ! [[ -z "$argument" ]]
+ if [[ -n "$argument" ]]
then
branch="$branch-$argument"
fi
@@ -618,7 +618,7 @@ git_project_release_check() {
release_branch=$branch
done
- if ! [[ -z "$release_branch" ]]
+ if [[ -n "$release_branch" ]]
then
local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE"