Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: message log of commands #118

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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/git-delete-local-merged
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Created: 2020

_log() {
echo "-----> $*"
echo "==> $*"
}


Expand Down
26 changes: 20 additions & 6 deletions internal/helper.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ function git::internal::git::branch::name {
git symbolic-ref --short HEAD
}

#
# return name branch develop
#
function git::internal::gitflow::branch::develop {
git config --local gitflow.branch.develop || echo 'develop'
}

#
# return name branch main
#
function git::internal::gitflow::branch::base {
git config --local gitflow.branch.master || echo 'main'
}

#
# Bool validate if exist branch develop
#
Expand Down Expand Up @@ -96,7 +110,7 @@ function git::internal::branch::task_name {
}

function git::internal::branch::is_develop {
if [ "$(git::internal::git::branch::name)" = "develop" ]; then
if [ "$(git::internal::git::branch::name)" = "$(git::internal::gitflow::branch::develop)" ]; then
echo 1
return
fi
Expand All @@ -116,8 +130,8 @@ function git::internal::repository::remote::url {
# return true when origign is different to upstream
function git::internal::repository::fork::private {
local domain_origin domain_upstream
domain_origin=$(echo "$(git::internal::repository::remote::url origin)" | grep -Eo "${ZSH_GIT_REGEX_DOMAIN_ENABLED}")
domain_upstream=$(echo "$(git::internal::repository::remote::url upstream)" | grep -Eo "${ZSH_GIT_REGEX_DOMAIN_ENABLED}")
domain_origin=$("$(git::internal::repository::remote::url origin)" | grep -Eo "${ZSH_GIT_REGEX_DOMAIN_ENABLED}")
domain_upstream=$("$(git::internal::repository::remote::url upstream)" | grep -Eo "${ZSH_GIT_REGEX_DOMAIN_ENABLED}")
if [ -z "${domain_upstream}" ]; then
echo 0
return
Expand All @@ -144,10 +158,10 @@ function git::internal::gff::sync {
if [ -z "$(git::internal::repository::remote::url origin)" ]; then
return
fi
message_info "starting sync branchs"
message_info "starting sync branches"
if [ "$(git::internal::branch::is_develop)" -eq 0 ]; then
git checkout develop
git checkout "$(git::internal::gitflow::branch::develop)"
fi
git-sync
message_success "finish sync branchs"
message_success "finish sync branches"
}
2 changes: 1 addition & 1 deletion template/git/hooks/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# so that jira, github, gitlab can associate it with a ticket

if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(main master develop test)
BRANCHES_TO_SKIP=(main master develop dev test)
fi

REGEX_VALIDATION="^[0-9]+$"
Expand Down