From c2d532057316f5581c3a9c7a4a2a0962f075f260 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 26 Apr 2010 09:03:46 +0200 Subject: Don't pull/push repos without origin --- bin/ct | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/ct b/bin/ct index 1d90f1d..0127c96 100755 --- a/bin/ct +++ b/bin/ct @@ -266,6 +266,10 @@ function vcs_branch_is_master ( } ) +function vcs_has_origin ( + [[ -e ${PKG_DIR}/${1}/.git/refs/remotes/origin ]] +) + function vcs_log ( vcs_setup $1 git log @@ -339,7 +343,9 @@ function list_get_version_remote { } function list_incoming { - [[ $(list_get_version_local $1) != $(list_get_version_remote $1) ]] + typeset local=$(list_get_version_local $1) + typeset remote=$(list_get_version_remote $1) + [[ -n ${local} && -n ${remote} && ${local} != ${remote} ]] } function list_is_installed { @@ -864,7 +870,7 @@ function pkg_log { function pkg_push { check_installed $1 - if list_incoming $1 || ! list_exists $1; then + if list_incoming $1 || ( vcs_has_origin $1 && ! list_exists $1 ); then clear_line info "Pushing $1\n" @@ -946,7 +952,7 @@ function pkg_upgrade { return 1 fi - if list_incoming $1 || ! list_exists $1; then + if list_incoming $1 || ( vcs_has_origin $1 && ! list_exists $1 ); then clear_line info "Updating $1 to $(list_get_version_remote $1)\n" global_hook $1 pre-update -- cgit v1.2.3