From 5ceca506182982aac6dbf1041b7e120dca00327a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 16 Oct 2010 10:19:19 +0200 Subject: Always use git origins, remove GIT_USE_ORIGIN setting --- bin/ct | 34 +++------------------------------- man/5/caretaker.conf.pod | 9 --------- man/7/caretaker.pod | 3 +-- test/main | 34 +++++++++++++++------------------- 4 files changed, 19 insertions(+), 61 deletions(-) diff --git a/bin/ct b/bin/ct index c5d102c..f4c78c6 100755 --- a/bin/ct +++ b/bin/ct @@ -103,7 +103,6 @@ if (( ${#PKG_ROOTS} == 0 )) { : ${CL_OPTIONS:=--quiet} : ${SILENT=0} : ${AUTOUPDATE=1} -: ${GIT_USE_ORIGIN=1} : ${HOOK_ON_PUSH=1} : ${COLOURS=1} : ${MAGIC_ETC=1} @@ -241,22 +240,6 @@ function vcs_add ( pkgroot_clean ) -function vcs_branch_is_master ( - vcs_setup ${1} - 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" \ - "With GIT_USE_ORIGIN=0, caretaker can only operate on the branch master\n" \ - "Skipping repo, please fix manually\n" - return 1 - } -) - function vcs_has_origin ( [[ -e ${PKG_DIR}/${1}/.git/refs/remotes/origin ]] ) @@ -272,28 +255,18 @@ function vcs_new ( git init mkdir etc - if ((GIT_USE_ORIGIN)) { - git remote add origin ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${1} - } + git remote add origin ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${1} ) function vcs_pull ( vcs_setup ${1} - if (( GIT_USE_ORIGIN )) { - git pull ${GIT_SILENT_ARG} - } else { - vcs_branch_is_master ${1} && git pull $(list_get_uri ${1}) master - } + git pull ${GIT_SILENT_ARG} vcs_update_submodules ) function vcs_push ( vcs_setup ${1} - if (( GIT_USE_ORIGIN )) { - git push - } else { - vcs_branch_is_master ${1} && git push $(list_get_uri ${1}) master - } + git push ) function vcs_setup { @@ -785,7 +758,6 @@ function pkg_debug { echo " PROGRESS ${PROGRESS}" echo " AUTOUPDATE ${AUTOUPDATE}" echo " MAGIC_ETC ${MAGIC_ETC}" - echo " GIT_USE_ORIGIN ${GIT_USE_ORIGIN}" } function pkg_help { diff --git a/man/5/caretaker.conf.pod b/man/5/caretaker.conf.pod index 5fbbc3a..c3c3614 100644 --- a/man/5/caretaker.conf.pod +++ b/man/5/caretaker.conf.pod @@ -64,15 +64,6 @@ Operate in silent mode. If B<1>, it also sets PROGRESS=0 If 1, automatically execute 'ct update' before 'ct push' and 'ct update remote' before 'ct upgrade' -=item B=I [1] - -By default, caretaker will simply issue a git push/pull, so that git will use the -repository's origin to determine where to push/pull. - -If you regularly change your PKG_ROOT, are too lazy to properly configure your -git repos or whatever, set this to 0. Then, caretaker will always call git pull/push -with both the remote repo and the branch as arguments. - =item BI {I} Define the global hook I, its I will be executed diff --git a/man/7/caretaker.pod b/man/7/caretaker.pod index 9146437..5b83658 100644 --- a/man/7/caretaker.pod +++ b/man/7/caretaker.pod @@ -268,8 +268,7 @@ provided by packages. B uses git(1) as backend for storing and syncing package information. It is not recommended to use branches other than "master". -While they should work if GIT_USE_ORIGIN is set to 1 (the default), they will -most likely confuse caretaker. +In theory they should work, but will likely cause major confusion. =head1 AUTHOR diff --git a/test/main b/test/main index f69f81f..317058a 100755 --- a/test/main +++ b/test/main @@ -62,26 +62,22 @@ echo "# ct add (no such repo)" echo "# ct add (already installed)" ! ct add caretaker -for conf_origin in 0 1; { - echo "## GIT_USE_ORIGIN=$conf_origin" - echo "GIT_USE_ORIGIN=$conf_origin" >> $test_home/.config/caretaker/caretaker.conf - for repo in ra ra-bare; { - file=${repo%-*} - if [[ $repo == *-bare ]] { - echo "## bare repository" - complement=$file - } else { - echo "## non-bare repository" - complement=${repo}-bare - } - source $tests/add - source $tests/prereqs - cd $test_pdir/$repo - source $tests/push - cd $test_pdir - source $tests/pull-prepare - source $tests/remove +for repo in ra ra-bare; { + file=${repo%-*} + if [[ $repo == *-bare ]] { + echo "## bare repository" + complement=$file + } else { + echo "## non-bare repository" + complement=${repo}-bare } + source $tests/add + source $tests/prereqs + cd $test_pdir/$repo + source $tests/push + cd $test_pdir + source $tests/pull-prepare + source $tests/remove } rm -rf $test_pdir $test_proot $test_home -- cgit v1.2.3