fnc_mc_git.inc.sh 1.42 KB
#!/bin/bash

#
# @param string	$1	git dir
# @param string $2	logfile (FILE exists and is writable)
#

mc_git_pull() {
	gitdir=$1
	logfile=$2

	echo ''
	echo '' >> $logfile
	mc_log "git pull $gitdir" $logfile

	mc_bashsu "cd $gitdir" 1
	git branch | grep '*'
	git branch | grep '*' >> $logfile
	git status -s
	mc_log "git status -s" $logfile
	git status -s >> $logfile
	
	git pull
	
	git status -s | grep UU
	git status -s | grep UU  >> $logfile	

	git status | grep Version
	
	#mc_bashsu "git log | grep -m 1 commit" 1 
	git log | grep -m 1 commit >> $logfile	
	
	git log | grep -m 1 Date
	git log | grep -m 1 Date >> $logfile
	
	echo '----------------------------' >> $logfile	
	
}

mc_git_push() {
	gitdir=$1
	logfile=$2

	echo ''
	echo '' >> $logfile
	mc_log "git pull $gitdir" $logfile

	mc_bashsu "cd $gitdir" 1
	git branch | grep '*'
	git branch | grep '*' >> $logfile
	git status -s
	mc_log "git status -s" $logfile
	git status -s >> $logfile
	
	git push
	
	git status -s | grep UU
	git status -s | grep UU  >> $logfile	

	git status | grep Version
	
	#mc_bashsu "git log | grep -m 1 commit" 1 
	git log | grep -m 1 commit >> $logfile	
	
	git log | grep -m 1 Date
	git log | grep -m 1 Date >> $logfile
	
	echo '----------------------------' >> $logfile	
	
}


mc_git_status() {
	gitdir=$1
	cd $gitdir
	echo $gitdir
	git status -s
	git branch | grep '*'
	git status -s | grep UU
	git status | grep ersion
	echo '----------------------------'
}