forked from toolshed/abra
		
	This simplifies the deploy overview, to only show 3 version fields: - CURRENT DEPLOYMENT - CURRENT ENV - NEW DEPLOYMENT It also fixes a few errors around version detection Reviewed-on: toolshed/abra#508 Co-authored-by: p4u1 <p4u1_f4u1@riseup.net> Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
		
			
				
	
	
		
			69 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| _checkout_recipe() {
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" checkout .
 | |
|   assert_success
 | |
| }
 | |
| 
 | |
| _remove_tags(){
 | |
|   run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
 | |
|   assert_success
 | |
|   refute_output '0'
 | |
| 
 | |
|   run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | \
 | |
|     xargs -I{} git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -d {}'
 | |
|   assert_success
 | |
|   assert_output --partial 'Deleted tag'
 | |
| 
 | |
|   run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
 | |
|   assert_success
 | |
|   assert_output '0'
 | |
| }
 | |
| 
 | |
| _reset_tags() {
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" fetch --all
 | |
|   assert_success
 | |
| 
 | |
|   run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
 | |
|   assert_success
 | |
|   refute_output '0'
 | |
| }
 | |
| 
 | |
| _set_git_author() {
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" config --local user.email test@example.com
 | |
|   assert_success
 | |
| 
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" config --local user.name test
 | |
|   assert_success
 | |
| }
 | |
| 
 | |
| _git_commit() {
 | |
|   _set_git_author
 | |
| 
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" add .
 | |
|   assert_success
 | |
| 
 | |
|   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" commit -m "test: helpers/git.bash: _git_commit"
 | |
|   assert_success
 | |
| }
 | |
| 
 | |
| _get_tag_hash() {
 | |
|   echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" rev-list -n 1 "$1")
 | |
| }
 | |
| 
 | |
| _get_head_hash() {
 | |
|   echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" HEAD)
 | |
| }
 | |
| 
 | |
| _get_current_hash() {
 | |
|   echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H")
 | |
| }
 | |
| 
 | |
| _get_n_hash() {
 | |
|   echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
 | |
| }
 | |
| 
 | |
| _git_status() {
 | |
|   echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status --porcelain)
 | |
| }
 |