Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bin/benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ EOF

## Clean up after tests
#######################
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
_clean-up() {
find . -name "test_file.*" -delete
exit
Expand Down
2 changes: 1 addition & 1 deletion bin/test-dd-write
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ block_count_large=1024

## Clean up after tests
#######################
# shellcheck disable=SC2317
# shellcheck disable=SC2317,SC2329
_clean-up() {
rm -f "${test_file_name}"
exit
Expand Down
19 changes: 14 additions & 5 deletions lib/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
## then delete local and remote tracking branch
##
## @param $1 Branch to be merged
## @default current branch
## @param $2 Branch to merge into
## @default main
## @param $3 Remote
## @default origin
###############################################
ggit-merge() {
local branch="${1?:Source branch missing}"
local branch="${1:-}"
local into="${2:-main}"
local remote="${3:-origin}"

[[ -z "${branch}" ]] && branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)

print-header Pull remote changes for "${branch}" from "${remote}"
git checkout "${branch}" || return 1
git pull --stat "${remote}" "${branch}" || return 1
Expand Down Expand Up @@ -74,19 +77,22 @@ ggit-pull() {
## Update local branch from remote
##
## @param $1 Branch
## @default current branch
## @param $2 Remote
## @default origin
##################################
ggit-update() {
local branch="${1?:Branch missing}"
local branch="${1:-}"
local remote="${2:-origin}"

[[ -z "${branch}" ]] && branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)

print-header Fetch "${remote}"
git fetch --prune "${remote}" || return 1
print-header Delete old "${branch}"
print-header Delete old branch: "${branch}"
git checkout -b "${branch}-temp" "${branch}" || return 1
git branch -D "${branch}" || return 1
print-header Checkout new "${branch}" from "${remote}"
print-header Checkout new branch: "${branch}" from "${remote}"
git checkout -b "${branch}" --recurse-submodules --track "${remote}/${branch}" || return 1
git branch -D "${branch}-temp"
}
Expand All @@ -105,17 +111,20 @@ ggit-diff() {
## Rebase branch
##
## @param $1 Branch to rebase
## @default current branch
## @param $2 Rebase onto this branch
## @default main
## @param $3 Remote
## @default origin
########################################
ggit-base() {
local branch_src=("${1?:Branch to rebase missing}")
local branch_src=("${1:-}")
local branch_onto="${2:-main}"
local remote="${3:-origin}"
local branch

[[ -z "${branch_src[*]}" ]] && branch_src=("$(git rev-parse --abbrev-ref HEAD 2>/dev/null)")

# If more than 3 arguments supplied
# last 2 arguments are branch_onto and remote the rest are branch_src
if [[ $# -gt 3 ]]; then
Expand Down