From 39a710acf2b233014aafc438fbd7a67721ed134e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 12 Apr 2009 12:09:33 +0200 Subject: pkg: vcs_push: Check if we're on branch master if !GIT_USE_ORIGIN --- bin/pkg | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/pkg b/bin/pkg index 95a2a08..7c1e871 100755 --- a/bin/pkg +++ b/bin/pkg @@ -241,24 +241,26 @@ function vcs_log { git log } -function vcs_pull { - typeset IFS=$'\n' line - typeset branch +function vcs_branch_master { + typeset IFS=$'\n' branch line for line in $(git branch); { [[ $line == \*\ * ]] && branch=${line#* } } + if [[ $branch != master ]] { + warn "$1: The currently checked out branch is not master, but '$branch'\n" \ + "Currently, pkg can only operate on the branch master\n" \ + " -> skipping repo, please fix manually or report a bug\n" + return 1 + } +} + +function vcs_pull { if ((GIT_USE_ORIGIN)) { # the package might be newly created and not have an origin yet vcs_fix_origin git pull } else { - if [[ $branch != master ]] { - warn "$1: The currently checked out branch is not master, but '$branch'\n" \ - "Currently, pkg can only operate on the branch master\n" \ - " -> skipping repo, please fix manually or report a bug\n" - return 1 - } - git pull $PKG_ROOT/${PWD:t} master + vcs_branch_master && git pull $PKG_ROOT/${PWD:t} master } } @@ -268,7 +270,7 @@ function vcs_push { vcs_fix_origin git push } else { - git push $PKG_ROOT/${PWD:t} master + vcs_branch_master && git push $PKG_ROOT/${PWD:t} master } } -- cgit v1.2.3