←︎ stagit :: a31de98


1
commit a31de98e39ccefcae5d5780ab8fb959bbadcbbde
2
Author: acidvegas <acid.vegas@acid.vegas>
3
Date:   Sun May 3 05:22:30 2020 -0400
4
5
    Fixed another bashism truncating string length. Should be all of them now
6
---
7
 stagit | 4 +---
8
 1 file changed, 1 insertion(+), 3 deletions(-)
9
10
diff --git a/stagit b/stagit
11
index a6d1690..369aad7 100755
12
--- a/stagit
13
+++ b/stagit
14
@@ -152,7 +152,7 @@ for d in $REPOS; do
15
 		COMMIT_HASH=$(echo $line | cut -d'|' -f4)
16
 		COMMIT_MESSAGE=$(echo $line | cut -d'|' -f5 | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g;s/"/\&quot;/g;')
17
 		if [ $MAX_COMMIT_MSG -ne 0 -a ${#COMMIT_MESSAGE} -gt $MAX_COMMIT_MSG ]; then
18
-			COMMIT_MESSAGE=${COMMIT_MESSAGE:0:$MAX_COMMIT_MSG}... # todo: fix possible bashism
19
+			COMMIT_MESSAGE=$(echo $COMMIT_MESSAGE | cut -c 1-$MAX_COMMIT_MSG)
20
 		fi
21
 		COMMIT_AUTHOR=$(echo $line | cut -d'|' -f6)
22
 		COMMIT_DATE=$(echo $line | cut -d'|' -f7)
23
@@ -170,10 +170,8 @@ for d in $REPOS; do
24
 		COMMIT_DIFF=$(echo "$COMMIT_DIFF" | sed 's/\[31m/<span class="deletion">/g; s/\[1\;31m/<span class="remote">/g; s/\[32m/<span class="insertion">/g; s/\[1\;32m/<span class="branch">/g; s/\[33m/<span class="commit">/g; s/\[36m/<span class="hunk">/g; s/\[1\;36m/<span class="reference">/g; s/\[1m/<span class="bold">/g; s/\[m/<\/span>/g')
25
 		COUNT=1
26
 		echo "$COMMIT_DIFF" | while IFS= read -r line; do
27
 			echo "<tr class=\"item\"><td class=\"linenumber\"><a href=\"#l$COUNT\" name=\"l$COUNT\">$COUNT</a></td><td><pre>$line</pre></td></tr>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
28
 			COUNT=`expr $COUNT + 1`
29
-			#fi
30
 		done
31
 		echo "</table>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
32
 		generate_footer $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html