summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-04-12 12:09:33 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-04-12 12:09:33 +0200
commit39a710acf2b233014aafc438fbd7a67721ed134e (patch)
tree4b550fafa53f8e9eff27293505681ff16ced7d08
parente5338871bb0c169efd7e1b91fd07790c902a91bf (diff)
pkg: vcs_push: Check if we're on branch master if !GIT_USE_ORIGIN
-rwxr-xr-xbin/pkg24
1 files 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
}
}