Skip to content
Permalink
Browse files

html version with source diff with the help of https://github.com/rtf…

  • Loading branch information...
palaniraja committed Mar 14, 2019
1 parent b70fdbb commit 30f731dfcd4bec2be3a023a09150e076b03e9738
Showing with 75 additions and 9 deletions.
  1. +25 −0 head.html
  2. +24 −0 tail.html
  3. +26 −9 whatchanged.sh

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,24 @@
</table>
<script type="text/javascript">
function doDiff(){
for (var i = 0; i <fileCount; i++) {
var rawDiff = document.getElementById('rawDiff'+i).value;
var outDiff = document.getElementById('outDiff'+i)
var diffHtml = Diff2Html.getPrettyHtml(rawDiff, {
inputFormat: 'diff',
showFiles: false,
matching: 'words',
outputFormat: 'side-by-side'
}
);
outDiff.innerHTML = diffHtml;
}
}
doDiff();
</script>
</body>
</html>
@@ -1,27 +1,44 @@

echo "Usage: $0 <startCommitSHA> <startCommitSHA>\n\n"
echo "===========================================\n"
echo "Usage: $0 <startCommitSHA> <startCommitSHA>\n"
echo "===========================================\n\n\n"

outputFile="out.html"
outputFile="diff.html"
rm $outputFile && touch $outputFile
# 3b9aea39c7..37c07544408b
diffString=""
index=0

echo "Start from Commit SHA: $1\n"
echo "End at Commit SHA: $2"

`echo "<html><head><style>td{white-space: pre;}</style></head><body><table border=1>" >> $outputFile`
`cat head.html >> $outputFile`

echo "<p>Files changed between <b>$1</b> and <b>$2</b></p>" >> $outputFile
echo "<table border=1 style='border-collapse: collapse;'>" >> $outputFile
git log --pretty='format:' --name-only $1..$2 | sort -u | while read line
do
if [ -n "${line}" ]; then
`echo "<tr>" >> $outputFile`
`echo "<td>File: ($line)</td>" >> $outputFile`
`echo "<td>" >> $outputFile`
git log --pretty=oneline --abbrev-commit $1..$2 -- $line >> $outputFile
`echo "</td></tr>" >> $outputFile`
`echo "<td> <h3>File: ($line)</h3>" >> $outputFile`
`echo "<p>" >> $outputFile`

git log --pretty=oneline --abbrev-commit $1..$2 -- $line >> $outputFile
# --all --full-history

`echo "</p><textarea class='rawDiff' id='rawDiff$index'>" >> $outputFile`

diffString=$(git diff $1..$2 -- $line)
`echo "$diffString</textarea><div class='outDiff' id='outDiff$index'>PRETTY HERE</div></td></tr>" >> $outputFile`

index=$((index + 1))

# TODO: need to fix why $index is different on outside of loop, reseting on everyfile now to get the job done.
`echo "<script type='text/javascript'>var fileCount=$index;//test</script>" >> $outputFile`
fi
done
`echo "</table></body></html>" >> $outputFile`

echo "\n\nSaved to $outputFile"

`cat tail.html >> $outputFile`

echo "\n\nSaved to $outputFile"

0 comments on commit 30f731d

Please sign in to comment.
You can’t perform that action at this time.