git-viewer 6.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entry.bundled.js +18 -3
- package/dist/server.js +20 -13
- package/package.json +1 -1
package/dist/entry.bundled.js
CHANGED
|
@@ -1711,8 +1711,9 @@ function Sidebar() {
|
|
|
1711
1711
|
"div",
|
|
1712
1712
|
{
|
|
1713
1713
|
css: {
|
|
1714
|
-
|
|
1715
|
-
|
|
1714
|
+
minWidth: "180px",
|
|
1715
|
+
maxWidth: "300px",
|
|
1716
|
+
width: "fit-content",
|
|
1716
1717
|
borderRight: `1px solid ${colors.border}`,
|
|
1717
1718
|
display: "flex",
|
|
1718
1719
|
flexDirection: "column",
|
|
@@ -1796,6 +1797,7 @@ function RefNodeItem(handle) {
|
|
|
1796
1797
|
cursor: "pointer",
|
|
1797
1798
|
color: colors.textMuted,
|
|
1798
1799
|
fontSize: "12px",
|
|
1800
|
+
whiteSpace: "nowrap",
|
|
1799
1801
|
"&:hover": { color: colors.text }
|
|
1800
1802
|
},
|
|
1801
1803
|
on: {
|
|
@@ -1828,6 +1830,7 @@ function RefNodeItem(handle) {
|
|
|
1828
1830
|
background: isSelected ? colors.accentDim : "transparent",
|
|
1829
1831
|
color: node.current ? colors.accent : colors.text,
|
|
1830
1832
|
fontWeight: node.current ? 600 : 400,
|
|
1833
|
+
whiteSpace: "nowrap",
|
|
1831
1834
|
"&:hover": {
|
|
1832
1835
|
background: isSelected ? colors.accentDim : colors.bgLighter
|
|
1833
1836
|
}
|
|
@@ -2161,7 +2164,19 @@ function DiffPanel() {
|
|
|
2161
2164
|
/* @__PURE__ */ jsx("span", { children: state.selectedCommit.date }),
|
|
2162
2165
|
/* @__PURE__ */ jsx("span", { css: { margin: "0 8px" }, children: "\u2022" }),
|
|
2163
2166
|
/* @__PURE__ */ jsx("code", { css: { color: colors.accent }, children: state.selectedCommit.shortSha })
|
|
2164
|
-
] })
|
|
2167
|
+
] }),
|
|
2168
|
+
state.selectedCommit.body ? /* @__PURE__ */ jsx(
|
|
2169
|
+
"div",
|
|
2170
|
+
{
|
|
2171
|
+
css: {
|
|
2172
|
+
marginTop: "8px",
|
|
2173
|
+
whiteSpace: "pre-wrap",
|
|
2174
|
+
fontSize: "12px",
|
|
2175
|
+
lineHeight: "1.4"
|
|
2176
|
+
},
|
|
2177
|
+
children: state.selectedCommit.body
|
|
2178
|
+
}
|
|
2179
|
+
) : null
|
|
2165
2180
|
]
|
|
2166
2181
|
}
|
|
2167
2182
|
),
|
package/dist/server.js
CHANGED
|
@@ -8827,11 +8827,11 @@ if (!repoDir) {
|
|
|
8827
8827
|
process.exit(1);
|
|
8828
8828
|
}
|
|
8829
8829
|
async function git(args) {
|
|
8830
|
-
let { stdout } = await exec(`git ${args}`, {
|
|
8830
|
+
let { stdout } = await exec(`git -c color.ui=never ${args}`, {
|
|
8831
8831
|
cwd: repoDir,
|
|
8832
8832
|
maxBuffer: 10 * 1024 * 1024
|
|
8833
8833
|
});
|
|
8834
|
-
return stdout.
|
|
8834
|
+
return stdout.trimEnd();
|
|
8835
8835
|
}
|
|
8836
8836
|
async function getCurrentBranch() {
|
|
8837
8837
|
return git("rev-parse --abbrev-ref HEAD");
|
|
@@ -8893,21 +8893,22 @@ function insertIntoTree(nodes, parts, fullName, currentBranch) {
|
|
|
8893
8893
|
insertIntoTree(folder.children, rest, fullName, currentBranch);
|
|
8894
8894
|
}
|
|
8895
8895
|
async function getCommits(ref, search) {
|
|
8896
|
-
let format = "%H%
|
|
8897
|
-
let args = `log --format="${format}" -n 500`;
|
|
8896
|
+
let format = "%H%x1f%h%x1f%s%x1f%b%x1f%an%x1f%ai%x1f%P%x1f%D";
|
|
8897
|
+
let args = `log -z --format="${format}" -n 500`;
|
|
8898
8898
|
if (ref && ref !== "all") {
|
|
8899
8899
|
args += ` ${ref}`;
|
|
8900
8900
|
} else {
|
|
8901
8901
|
args += " --all";
|
|
8902
8902
|
}
|
|
8903
8903
|
let output = await git(args);
|
|
8904
|
-
let
|
|
8905
|
-
let rawCommits =
|
|
8906
|
-
let [sha, shortSha, subject, author, date, parents, refs] =
|
|
8904
|
+
let records = output ? output.split("\0").filter(Boolean) : [];
|
|
8905
|
+
let rawCommits = records.map((record) => {
|
|
8906
|
+
let [sha, shortSha, subject, body, author, date, parents, refs] = record.split("");
|
|
8907
8907
|
return {
|
|
8908
8908
|
sha,
|
|
8909
8909
|
shortSha,
|
|
8910
8910
|
subject,
|
|
8911
|
+
body: body ? body.trimEnd() : "",
|
|
8911
8912
|
author,
|
|
8912
8913
|
date: formatDate(date),
|
|
8913
8914
|
parents: parents ? parents.split(" ").filter(Boolean) : [],
|
|
@@ -8917,9 +8918,13 @@ async function getCommits(ref, search) {
|
|
|
8917
8918
|
let filteredCommits = rawCommits;
|
|
8918
8919
|
if (search) {
|
|
8919
8920
|
let query = search.toLowerCase();
|
|
8920
|
-
filteredCommits = rawCommits.filter(
|
|
8921
|
-
|
|
8922
|
-
|
|
8921
|
+
filteredCommits = rawCommits.filter((c) => {
|
|
8922
|
+
let haystack = `${c.subject}
|
|
8923
|
+
${c.body}
|
|
8924
|
+
${c.author}
|
|
8925
|
+
${c.sha}`;
|
|
8926
|
+
return haystack.toLowerCase().includes(query);
|
|
8927
|
+
});
|
|
8923
8928
|
}
|
|
8924
8929
|
let { commits, maxLane } = computeGraph(filteredCommits);
|
|
8925
8930
|
return { commits, maxLane };
|
|
@@ -9029,9 +9034,10 @@ function formatDate(date) {
|
|
|
9029
9034
|
});
|
|
9030
9035
|
}
|
|
9031
9036
|
async function getDiff(sha) {
|
|
9032
|
-
let format = "%H%
|
|
9033
|
-
let metaOutput = await git(`show --format="${format}" -s ${sha}`);
|
|
9034
|
-
let [
|
|
9037
|
+
let format = "%H%x1f%h%x1f%s%x1f%b%x1f%an%x1f%ai%x1f%P";
|
|
9038
|
+
let metaOutput = await git(`show -z --format="${format}" -s ${sha}`);
|
|
9039
|
+
let [record] = metaOutput.split("\0");
|
|
9040
|
+
let [fullSha, shortSha, subject, body, author, date, parents] = record.split("");
|
|
9035
9041
|
let diffOutput = await git(`show --format="" ${sha}`);
|
|
9036
9042
|
let diffHtml = (0, import_diff2html.html)((0, import_diff2html.parse)(diffOutput), {
|
|
9037
9043
|
drawFileList: false,
|
|
@@ -9042,6 +9048,7 @@ async function getDiff(sha) {
|
|
|
9042
9048
|
sha: fullSha,
|
|
9043
9049
|
shortSha,
|
|
9044
9050
|
subject,
|
|
9051
|
+
body: body ? body.trimEnd() : "",
|
|
9045
9052
|
author,
|
|
9046
9053
|
date: formatDate(date),
|
|
9047
9054
|
parents: parents ? parents.split(" ").filter(Boolean) : [],
|