🢀︎ stagit :: 5c033f5


commit 5c033f5be6813a01e9c77aa1a7c62597ade87ee3
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Sat Jul 27 22:01:35 2019 -0400

    Added mirror directory ignoring and converted ssh urls to https for github/gitlab

diff --git a/README.md b/README.md
index 6be5218..0f6edce 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
 # stagit
 > static git page generator
 
-###### Information
+## Information
 This is basically a shell script clone of [stagit](https://git.2f30.org/stagit/).
 
 It is meant to be hosted on [Github](https://github.com) using [Github Pages](https://pages.github.com) with a [Custom domain](https://help.github.com/en/articles/using-a-custom-domain-with-github-pages).
 
 A live demo of this script can be seen [here](https://acid.vegas).
 
-###### Settings
+## Settings
 | Setting          | Default   | Description                                                        |
 | ---------------- | --------- | ------------------------------------------------------------------ |
 | CLONE_URL        | remote    | base url for cloning repositories *(remote = remote.origin.url)*   |
@@ -24,8 +24,10 @@ If the `CLONE_URL` was set to `https://github.com/acidvegas/` for exmaple, then
 
 Lastly, the `CNAME` option is required if you are using a custom domain with Github pages. See [here](https://help.github.com/en/articles/troubleshooting-custom-domains#github-repository-setup-errors) for more information.
 
-###### Todo
-* Convert SSH remote urls to HTTPS for Github & Github-like domains.
+## Notes
+By default, stagit will ignore the  `$REPO_DIR/mirrors` directory. To make stagit include this directory, remove `-path $REPO_DIR/mirrors -prune` from the `find` command in the source.
+
+## Todo
 * 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.
@@ -38,13 +40,12 @@ Lastly, the `CNAME` option is required if you are using a custom domain with Git
 * Colored commit logs.
 * Parse commit lines to set line number padding in commit view.
 
-###### Issues
-* Fix whitespace issue with multi-line echo in generation functions.
+## Issues
 * Sort repositories by basename
 * Fix header padding
 * Fix all possible bashisms identified in source by checkbashisms
 
-###### Mirrors
+## Mirrors
 - [acid.vegas](https://acid.vegas/stagit) *(main)*
 - [SuperNETs](https://git.supernets.org/acidvegas/stagit)
 - [GitHub](https://github.com/acidvegas/stagit)
diff --git a/stagit b/stagit
index 74fb8c1..973b02c 100755
--- a/stagit
+++ b/stagit
@@ -91,7 +91,7 @@ generate_commit_index() {
 mkdir -p $WWW_DIR && rm -rf $WWW_DIR/*
 [ ! -z $CNAME ] && echo $CNAME >> $WWW_DIR/CNAME
 generate_css && generate_index
-for d in $(find $REPO_DIR -name .git -type d -prune | sort); do # todo: sort by basename
+for d in $(find $REPO_DIR -type d -name mirrors -prune -o -type d -name .git -print | sort); do # todo: sort by basename
 	REPO_NAME=$(basename -s .git `git --git-dir $d config --get remote.origin.url`)
 	if [ -f $d/description ]; then
 		REPO_DESC=$(head -n 1 $d/description)
@@ -107,7 +107,8 @@ for d in $(find $REPO_DIR -name .git -type d -prune | sort); do # todo: sort by
 	REPO_LAST_COMMIT=$(git --git-dir $d log -1 --date=relative --pretty=format:'%cd')
 	echo "<tr class=\"item\"><td><a href=\"$REPO_NAME\" title=\"$REPO_NAME\">$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
-		REPO_URL=$(git --git-dir $d config --get remote.origin.url) # todo: handle ssh urls
+		REPO_URL=$(git --git-dir $d config --get remote.origin.url)
+		REPO_URL=$(echo $REPO_URL | sed 's#git@github.com:#https://github.com/#' | sed 's#git@gitlab.com:#https://gitlab.com/#') # convert ssh urls to https
 	else
 		REPO_URL=$CLONE_URL/$REPO_NAME.git
 	fi
@@ -137,7 +138,7 @@ for d in $(find $REPO_DIR -name .git -type d -prune | sort); do # todo: sort by
 		COMMIT_DATE=$(echo $line | cut -d'|' -f7)
 		echo "<tr class=\"item\"><td>$COMMIT_SIGNED</td><td><a href=\"commit/$COMMIT_HASH.html\" title=\"View this commit\">$COMMIT_HASH</a></td><td>$COMMIT_MESSAGE</td><td>$COMMIT_AUTHOR</td><td>$COMMIT_DATE</td></tr>" >> $WWW_DIR/$REPO_NAME/index.html
 		generate_commit_index $REPO_NAME $COMMIT_HASH
-		COMMIT_DIFF=$(git --git-dir $d show $COMMIT_HASH) # todo: convert terminal colors to html
+		COMMIT_DIFF=$(git --git-dir $d show $COMMIT_HASH) # todo: convert terminal colors to html (script ; commmand ; exit)
 		if [ $MAX_COMMIT_LINES -ne 0 -a $(echo "$COMMIT_DIFF" | wc -l) -gt $MAX_COMMIT_LINES ]; then
 			COMMIT_DIFF=$(echo "$COMMIT_DIFF" | head -n $MAX_COMMIT_LINES)
 		fi