diff options
| author | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-25 15:48:16 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-25 15:48:16 +0100 | 
| commit | 453f8ffe1dc0100be890ea335f3f2a805e6f8d2e (patch) | |
| tree | e189bb8b4c811066488876d188913449849e6134 | |
| parent | 2ed367587f202bcb3e0567f3c7871880d1478fed (diff) | |
Added GIT_USE_ORIGIN config parameter to use the origin for push/pull or not
NOTE: This changes the default behaviour
You should either manually fix the origins of all your repos, or set GIT_USE_ORIGIN=0
| -rwxr-xr-x | bin/pkg | 22 | ||||
| -rw-r--r-- | man/5/pkg.conf | 9 | 
2 files changed, 24 insertions, 7 deletions
@@ -82,6 +82,7 @@ if [[ -f $HOME/.pkg.conf ]] {  : ${SILENT=0}  : ${DEBUG=0}  : ${AUTOUPDATE=1} +: ${GIT_USE_ORIGIN=1}  export PDIR  export PKG_ROOT @@ -251,13 +252,23 @@ function vcs_upgrade {  			" -> skipping repo, please fix manually or report a bug"  		return 1  	} -	git pull $PKG_ROOT/${PWD:t} master -	vcs_fix_origin +	if ((GIT_USE_ORIGIN)) { +		# the package might be newly created and not have an origin yet +		vcs_fix_origin +		git pull +	} else { +		git pull $PKG_ROOT/${PWD:t} master +	}  }  function vcs_push { -	git push $PKG_ROOT/${PWD:t} master -	vcs_fix_origin +	if ((GIT_USE_ORIGIN)) { +		# see above +		vcs_fix_origin +		git push +	} else { +		git push $PKG_ROOT/${PWD:t} master +	}  }  function vcs_status { @@ -266,12 +277,10 @@ function vcs_status {  # Set the correct origin  function vcs_fix_origin { -	[[ $1 == rewrite ]] && git remote rm origin  	if [[ ! -r .git/remotes/origin && ! -r .git/refs/remotes/origin/HEAD ]] {  		fgrep '[remote "origin"]' .git/config &> /dev/null ||  			git remote add origin $PKG_ROOT/${PWD:t}  	} -	git remote update &> /dev/null  } @@ -714,7 +723,6 @@ function pkg_refresh {  		info "Cleaning build diroctery\n"  		make clean  	} -	vcs_fix_origin  	global_hook $1 post-update  } diff --git a/man/5/pkg.conf b/man/5/pkg.conf index f3b4dbe..9394481 100644 --- a/man/5/pkg.conf +++ b/man/5/pkg.conf @@ -45,6 +45,15 @@ Operate in debug mode if 1  If 1, automatically execute 'pkg update' before 'pkg push'  and 'pkg remote-update' before 'pkg upgrade' +=item B<GIT_USE_ORIGIN>=I<boolean> (1) + +By default, pkg 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, pkg will always call git pull/push +with both the remote repo and the branch as arguments. +  =item B<function pkg_hook_>I<hook> {I<content>}  Define the global hook I<hook>, its I<content> will be executed  | 
