diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-12 12:09:33 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-12 12:09:33 +0200 |
commit | 39a710acf2b233014aafc438fbd7a67721ed134e (patch) | |
tree | 4b550fafa53f8e9eff27293505681ff16ced7d08 | |
parent | e5338871bb0c169efd7e1b91fd07790c902a91bf (diff) |
pkg: vcs_push: Check if we're on branch master if !GIT_USE_ORIGIN
-rwxr-xr-x | bin/pkg | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -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 } } |