Skip to content

Conversation

@icco
Copy link
Contributor

@icco icco commented Oct 15, 2024

Description

Close #573

Correct way to handle bash arguments is using bash array.

Tested with following script

#!/bin/bash
set -ex

function push () {
  local branch=$1
  local is_force=$2
  local is_with_tags=$3

  args=(--set-upstream origin "${branch}")

  if [ "$is_force" == true ] ; then
    args+=(--force)
  fi

  if [ "$is_with_tags" == true ] ; then
    args+=(--tags)
  fi

  git push "${args[@]}"
}

push "main" false false
push "main" true false
push "main" false true
push "main" true true

Remark

For automation please see closing-issues-using-keywords

@icco icco requested a review from AndreasAugustin as a code owner October 15, 2024 16:51
@AndreasAugustin AndreasAugustin added the bug Something isn't working label Oct 15, 2024
@AndreasAugustin AndreasAugustin self-assigned this Oct 15, 2024
@AndreasAugustin
Copy link
Owner

@all-contributors please add @icco for bug and code

@allcontributors
Copy link
Contributor

@AndreasAugustin

I've put up a pull request to add @icco! 🎉

@AndreasAugustin AndreasAugustin merged commit 44e59ba into AndreasAugustin:main Oct 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

[Bug]: No longer works with default push settings

2 participants