Skip to content

Commit 00ffb0d

Browse files
committed
Merge branch 'ggit-default' into main
2 parents 205cabb + 4108ebe commit 00ffb0d

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

bin/benchmark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ EOF
135135

136136
## Clean up after tests
137137
#######################
138-
# shellcheck disable=SC2317
138+
# shellcheck disable=SC2317,SC2329
139139
_clean-up() {
140140
find . -name "test_file.*" -delete
141141
exit

bin/test-dd-write

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ block_count_large=1024
2323

2424
## Clean up after tests
2525
#######################
26-
# shellcheck disable=SC2317
26+
# shellcheck disable=SC2317,SC2329
2727
_clean-up() {
2828
rm -f "${test_file_name}"
2929
exit

lib/git.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
## then delete local and remote tracking branch
1010
##
1111
## @param $1 Branch to be merged
12+
## @default current branch
1213
## @param $2 Branch to merge into
1314
## @default main
1415
## @param $3 Remote
1516
## @default origin
1617
###############################################
1718
ggit-merge() {
18-
local branch="${1?:Source branch missing}"
19+
local branch="${1:-}"
1920
local into="${2:-main}"
2021
local remote="${3:-origin}"
2122

23+
[[ -z "${branch}" ]] && branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
24+
2225
print-header Pull remote changes for "${branch}" from "${remote}"
2326
git checkout "${branch}" || return 1
2427
git pull --stat "${remote}" "${branch}" || return 1
@@ -74,19 +77,22 @@ ggit-pull() {
7477
## Update local branch from remote
7578
##
7679
## @param $1 Branch
80+
## @default current branch
7781
## @param $2 Remote
7882
## @default origin
7983
##################################
8084
ggit-update() {
81-
local branch="${1?:Branch missing}"
85+
local branch="${1:-}"
8286
local remote="${2:-origin}"
8387

88+
[[ -z "${branch}" ]] && branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
89+
8490
print-header Fetch "${remote}"
8591
git fetch --prune "${remote}" || return 1
86-
print-header Delete old "${branch}"
92+
print-header Delete old branch: "${branch}"
8793
git checkout -b "${branch}-temp" "${branch}" || return 1
8894
git branch -D "${branch}" || return 1
89-
print-header Checkout new "${branch}" from "${remote}"
95+
print-header Checkout new branch: "${branch}" from "${remote}"
9096
git checkout -b "${branch}" --recurse-submodules --track "${remote}/${branch}" || return 1
9197
git branch -D "${branch}-temp"
9298
}
@@ -105,17 +111,20 @@ ggit-diff() {
105111
## Rebase branch
106112
##
107113
## @param $1 Branch to rebase
114+
## @default current branch
108115
## @param $2 Rebase onto this branch
109116
## @default main
110117
## @param $3 Remote
111118
## @default origin
112119
########################################
113120
ggit-base() {
114-
local branch_src=("${1?:Branch to rebase missing}")
121+
local branch_src=("${1:-}")
115122
local branch_onto="${2:-main}"
116123
local remote="${3:-origin}"
117124
local branch
118125

126+
[[ -z "${branch_src[*]}" ]] && branch_src=("$(git rev-parse --abbrev-ref HEAD 2>/dev/null)")
127+
119128
# If more than 3 arguments supplied
120129
# last 2 arguments are branch_onto and remote the rest are branch_src
121130
if [[ $# -gt 3 ]]; then

0 commit comments

Comments
 (0)