git ssb

30+

cel / git-ssb-web



Commit 68a3119b5b0aeed5e65d3cf73046a6bc4d29790c

Show unchanged update in raw view

Charles Lehner committed on 3/27/2016, 11:15:08 PM
Parent: f9ae255137056af9ca9eb15af5390590f1d282a5

Files changed

index.jschanged
index.jsView
@@ -1083,8 +1083,14 @@
10831083
10841084 function serveRepoUpdate(req, repo, id, msg, path) {
10851085 var raw = req._u.query.raw != null
10861086
1087 + if (raw)
1088 + return renderRepoPage(repo, null, pull.once(
1089 + '<a href="?" class="raw-link header-align">Info</a>' +
1090 + '<h3>Update</h3>' +
1091 + '<section class="collapse">' + json(msg) + '</section>'))
1092 +
10871093 // convert packs to old single-object style
10881094 if (msg.content.indexes) {
10891095 for (var i = 0; i < msg.content.indexes.length; i++) {
10901096 msg.content.packs[i] = {
@@ -1093,51 +1099,46 @@
10931099 }
10941100 }
10951101 }
10961102
1097- return renderRepoPage(repo, null,
1098- raw ? pull.once(
1099- '<a href="?" class="raw-link header-align">Info</a>' +
1103 + return renderRepoPage(repo, null, cat([
1104 + pull.once(
1105 + '<a href="?raw" class="raw-link header-align">Data</a>' +
11001106 '<h3>Update</h3>' +
1101- '<section class="collapse">' + json(msg) + '</section>')
1102- : cat([
1103- pull.once(
1104- '<a href="?raw" class="raw-link header-align">Data</a>' +
1105- '<h3>Update</h3>' +
1106- renderRepoUpdate(repo, {key: id, value: msg}, true) +
1107- (msg.content.objects ? '<h3>Objects</h3>' +
1108- objsArr(msg.content.objects).map(renderObject).join('\n') : '') +
1109- (msg.content.packs ? '<h3>Packs</h3>' +
1110- msg.content.packs.map(renderPack).join('\n') : '')),
1111- cat(!msg.content.packs ? [] : [
1112- pull.once('<h3>Commits</h3>'),
1113- pull(
1114- pull.values(msg.content.packs),
1115- paramap(function (pack, cb) {
1116- var key = pack.pack.link
1117- ssb.blobs.want(key, function (err, got) {
1118- if (err) cb(err)
1119- else if (!got) cb(null, pull.once('Missing blob ' + key))
1120- else cb(null, ssb.blobs.get(key))
1121- })
1122- }, 8),
1123- pull.map(function (readPack, cb) {
1124- return gitPack.decode({}, repo, cb, readPack)
1125- }),
1126- pull.flatten(),
1127- paramap(function (obj, cb) {
1128- if (obj.type == 'commit')
1129- Repo.getCommitParsed(obj, cb)
1130- else
1131- pull(obj.read, pull.drain(null, cb))
1132- }, 8),
1133- pull.filter(),
1134- pull.map(function (commit) {
1135- return renderCommit(repo, commit)
1107 + renderRepoUpdate(repo, {key: id, value: msg}, true) +
1108 + (msg.content.objects ? '<h3>Objects</h3>' +
1109 + objsArr(msg.content.objects).map(renderObject).join('\n') : '') +
1110 + (msg.content.packs ? '<h3>Packs</h3>' +
1111 + msg.content.packs.map(renderPack).join('\n') : '')),
1112 + cat(!msg.content.packs ? [] : [
1113 + pull.once('<h3>Commits</h3>'),
1114 + pull(
1115 + pull.values(msg.content.packs),
1116 + paramap(function (pack, cb) {
1117 + var key = pack.pack.link
1118 + ssb.blobs.want(key, function (err, got) {
1119 + if (err) cb(err)
1120 + else if (!got) cb(null, pull.once('Missing blob ' + key))
1121 + else cb(null, ssb.blobs.get(key))
11361122 })
1137- )
1138- ])
1139- ]))
1123 + }, 8),
1124 + pull.map(function (readPack, cb) {
1125 + return gitPack.decode({}, repo, cb, readPack)
1126 + }),
1127 + pull.flatten(),
1128 + paramap(function (obj, cb) {
1129 + if (obj.type == 'commit')
1130 + Repo.getCommitParsed(obj, cb)
1131 + else
1132 + pull(obj.read, pull.drain(null, cb))
1133 + }, 8),
1134 + pull.filter(),
1135 + pull.map(function (commit) {
1136 + return renderCommit(repo, commit)
1137 + })
1138 + )
1139 + ])
1140 + ]))
11401141 }
11411142
11421143 function renderObject(obj) {
11431144 return '<section class="collapse">' +

Built with git-ssb-web