Commits

Brendan Patterson committed 1aa95fa

added to git-prime.sh some code for a startup scenario where gitPrime files don't yet exist

  • Participants
  • Parent commits e2ded68

Comments (0)

Files changed (1)

File git-prime.sh

 gitPrimeHEADHash=$(git rev-parse HEAD) ;
 gitPrimeLastStash=".git/gitPrimeLast.log";
 
-message=$(date; echo "  branch: $branchName   -- stash object created by git-prime") ;
+touch $gitPrimeLastStash
+touch $gitPrimeFile
+
+message=$(date; echo "  branch: $branchName   -- stash object created by git-prime (DIRTY Working Directory)") ;
 
 echo $message
 # check if there is a stashable hash
 #		echo $gitPrimeStashHash  $message  >> $gitPrimeFile;
 		echo "writing stash"
 		echo $gitPrimeStashHash  $message  >> $gitPrimeFile;
-		echo $gitPrimeStashHash > $gitPrimeLastStash
 	else
 		echo "last stash obj has no differences with current. not writing stash hash"
 	fi	
+	echo $gitPrimeStashHash > $gitPrimeLastStash
+	if [ -s !$gitPrimeFile ]; then
+		echo $gitPrimeStashHash  $message  >> $gitPrimeFile;
+	fi		
 else
 	echo "no dirty working dir. so might write HEAD hash"
 	
 	echo "foo1 $foo"
 	if [ -z "$foo" ]; then
 		echo "writing HEAD hash"
-		message=$(date; echo "  branch: $branchName   -- HEAD hash captured by git-prime") ;	
+		message=$(date; echo "  branch: $branchName   -- HEAD hash captured by git-prime (CLEAN Working Directory)") ;	
 		echo $gitPrimeHEADHash  $message  >> $gitPrimeFile;
 	else
 		echo "NOT writing HEAD hash because it was found in the gitPrime log file"