🢀 stagit :: 7d3da0a


commit 7d3da0a310309fea643b0c65dba2515ddecb6d5f
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Wed Jun 19 00:55:37 2019 -0400

    Added support for displaying signed commits and key information

diff --git a/README.md b/README.md
index d0e76b2..030a63b 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,6 @@ Lastly, the `CNAME` option is required if you are using a custom domain with Git
 * Remove default settings & parse command line arguments instead.
 * Parse repository owner in a better way & add support for detecting organization names.
 * Create an index per-user to view specific users repos & key information.
-* Use 🔒 to show if a commit was signed.
 * Pagination support.
 * Option to minify HTML & CSS.
 * Create a local preview *(of both themes)* using the docs directory.
\ No newline at end of file
diff --git a/stagit b/stagit
index c07fb10..3db23ed 100755
--- a/stagit
+++ b/stagit
@@ -77,7 +77,7 @@ generate_repository_index() {
 			"<h5>git clone <a href=\"$REPO_URL\">$REPO_URL</a></h5>\n"\
 			"<hr>\n"\
 			"<table id=\"main\" cellpadding=\"0\" cellspacing=\"0\">\n"\
-			"<tr id=\"navigation\"><td>Hash</td><td>Commit message</td><td>Author</td><td>Date</td></tr>" >> $WWW_DIR/$REPO_NAME$EX
+			"<tr id=\"navigation\"><td>&nbps; Hash</td><td>Commit message</td><td>Author</td><td>Date</td></tr>" >> $WWW_DIR/$REPO_NAME$EX
 }
 
 mkdir -p $WWW_DIR && rm -rf $WWW_DIR/*
@@ -96,7 +96,7 @@ for d in $(find $REPO_DIR -name .git -type d -prune | sort); do
 		echo "missing description file for $REPO_NAME ($d/description)"
 		REPO_DESC="no description available"
 	fi
-	REPO_OWNER=$(git --git-dir $d log --reverse --pretty=format:'%an' | head -n 1) # todo: find a better way to do this
+	REPO_OWNER=$(git --git-dir $d log --reverse --pretty=format:'%an' | head -n 1) # todo: find a better way to do this & handle organization name parsing
 	REPO_LAST_COMMIT=$(git --git-dir $d log -1 --date=relative --pretty=format:'%cd')
 	echo "<tr class=\"item\"><td><a href=\"$REPO_NAME$EX\">$REPO_NAME</a></td><td>$REPO_DESC</td><td>$REPO_OWNER</td><td>$REPO_LAST_COMMIT</td></tr>" >> $WWW_DIR/index.html
 	if [ $CLONE_URL = 'remote' ]; then
@@ -106,18 +106,28 @@ for d in $(find $REPO_DIR -name .git -type d -prune | sort); do
 	fi
 	generate_repository_index $REPO_NAME $REPO_URL $REPO_DESC
 	if [ $MAX_COMMITS -eq 0 ]; then
-		REPO_COMMITS=$(git --git-dir $d log --all --date=relative --pretty=format:"%h|%s|%cn|%cd")
+		REPO_COMMITS=$(git --git-dir $d log --all --date=relative --pretty=format:"%G?|%GS|%GK|%h|%s|%cn|%cd")
 	else
-		REPO_COMMITS=$(git --git-dir $d log --all --date=relative --pretty=format:"%h|%s|%cn|%cd" | head -n $MAX_COMMITS)
+		REPO_COMMITS=$(git --git-dir $d log --all --date=relative --pretty=format:"%G?|%GS|%GK|%h|%s|%cn|%cd" | head -n $MAX_COMMITS)
 	fi
 	echo "$REPO_COMMITS" | while IFS= read -r line; do
-		COMMIT_HASH=$(echo $line | cut -d'|' -f1)
-		COMMIT_MESSAGE=$(echo $line | cut -d'|' -f2 | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g;s/"/\&quot;/g;')
+		COMMIT_SIGNED=$(echo $line | cut -d'|' -f1)
+		COMMIT_KEY=$(echo $line | cut -d'|' -f2)
+		COMMIT_KEYID=$(echo $line | cut -d'|' -f3)
+		if [ $COMMIT_SIGNED = 'G' ] then;
+			COMMIT_SIGNED="<span style=\"color:green\" title=\"$COMMIT_KEY&#13;$COMMIT_KEYID\">&#128274;</span>"
+		elif [ $COMMIT_SIGNED = 'B' ] || [ $COMMIT_SIGNED = 'U' ]  || [ $COMMIT_SIGNED = 'X' ] || [ $COMMIT_SIGNED = 'Y' ] || [ $COMMIT_SIGNED = 'R' ]; then
+			COMMIT_SIGNED="<span style=\"color:red\" title=\"$COMMIT_KEY&#13;$COMMIT_KEYID\">&#128274;</span>"
+		else
+			COMMIT_SIGNED="&nbsp;"
+		fi
+		COMMIT_HASH=$(echo $line | cut -d'|' -f4)
+		COMMIT_MESSAGE=$(echo $line | cut -d'|' -f5 | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g;s/"/\&quot;/g;')
 		if [ $MAX_COMMIT_MSG -ne 0 -a ${#COMMIT_MESSAGE} -gt $MAX_COMMIT_MSG ]; then
 			COMMIT_MESSAGE=${COMMIT_MESSAGE:0:$MAX_COMMIT_MSG}...
 		fi
-		COMMIT_AUTHOR=$(echo $line | cut -d'|' -f3)
-		COMMIT_DATE=$(echo $line | cut -d'|' -f4)
-		echo "<tr class=\"item\"><td>$COMMIT_HASH</td><td>$COMMIT_MESSAGE</td><td>$COMMIT_AUTHOR</td><td>$COMMIT_DATE</td></tr>" >> $WWW_DIR/$REPO_NAME$EX
+		COMMIT_AUTHOR=$(echo $line | cut -d'|' -f6)
+		COMMIT_DATE=$(echo $line | cut -d'|' -f7)
+		echo "<tr class=\"item\"><td>$COMMIT_SIGNED $COMMIT_HASH</td><td>$COMMIT_MESSAGE</td><td>$COMMIT_AUTHOR</td><td>$COMMIT_DATE</td></tr>" >> $WWW_DIR/$REPO_NAME$EX
 	done
 done
\ No newline at end of file