git-viewer 7.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.
@@ -2164,7 +2164,19 @@ function DiffPanel() {
2164
2164
  /* @__PURE__ */ jsx("span", { children: state.selectedCommit.date }),
2165
2165
  /* @__PURE__ */ jsx("span", { css: { margin: "0 8px" }, children: "\u2022" }),
2166
2166
  /* @__PURE__ */ jsx("code", { css: { color: colors.accent }, children: state.selectedCommit.shortSha })
2167
- ] })
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
2168
2180
  ]
2169
2181
  }
2170
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.trim();
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%x00%h%x00%s%x00%an%x00%ai%x00%P%x00%D";
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 lines = output ? output.split("\n").filter(Boolean) : [];
8905
- let rawCommits = lines.map((line) => {
8906
- let [sha, shortSha, subject, author, date, parents, refs] = line.split("\0");
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
- (c) => c.subject.toLowerCase().includes(query) || c.author.toLowerCase().includes(query) || c.sha.toLowerCase().includes(query)
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%x00%h%x00%s%x00%an%x00%ai%x00%P";
9033
- let metaOutput = await git(`show --format="${format}" -s ${sha}`);
9034
- let [fullSha, shortSha, subject, author, date, parents] = metaOutput.split("\0");
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) : [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-viewer",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "Visual git log viewer with branch graph and diff display",
5
5
  "repository": {
6
6
  "type": "git",