Skip to content

Commit 10c345d

Browse files
committed
Fixes #257 - commits w/o summaries cause issues
1 parent f38eba1 commit 10c345d

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
### Fixed
9+
- Fixes [#257](https://github.com/eamodio/vscode-gitlens/issues/257) - Some branches fail to show history
10+
711
## [7.5.6] - 2018-01-22
812
### Changed
913
- Changes `chorded` keymap on Windows to use `Ctrl+Shift+G` rather than `Ctrl+Alt+G` to avoid [issues](https://blogs.msdn.microsoft.com/oldnewthing/20040329-00/?p=40003)

src/git/git.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,39 @@ export * from './remotes/provider';
2323
let git: IGit;
2424

2525
const defaultBlameParams = ['blame', '--root', '--incremental'];
26+
2627
// Using %x00 codes because some shells seem to try to expand things if not
27-
const defaultLogParams = ['log', '--name-status', '--full-history', '-M', '--format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%x3c%x2fs%x3e%n%x3cf%x3e'];
28-
const defaultStashParams = ['stash', 'list', '--name-status', '--full-history', '-M', '--format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3cd%x3e %at%n%x3cl%x3e %gd%n%x3cs%x3e%n%B%x3c%x2fs%x3e%n%x3cf%x3e'];
28+
const lb = '%x3c'; // `%x${'<'.charCodeAt(0).toString(16)}`;
29+
const rb = '%x3e'; // `%x${'>'.charCodeAt(0).toString(16)}`;
30+
const sl = '%x2f'; // `%x${'/'.charCodeAt(0).toString(16)}`;
31+
32+
const logFormat = [
33+
`${lb}${sl}f${rb}`,
34+
`${lb}r${rb} %H`, // ref
35+
`${lb}a${rb} %an`, // author
36+
`${lb}e${rb} %ae`, // email
37+
`${lb}d${rb} %at`, // date
38+
`${lb}p${rb} %P`, // parents
39+
`${lb}s${rb}`,
40+
`%B`, // summary
41+
`${lb}${sl}s${rb}`,
42+
`${lb}f${rb}`
43+
].join('%n');
44+
45+
const defaultLogParams = ['log', '--name-status', '--full-history', '-M', `--format=${logFormat}`];
46+
47+
const stashFormat = [
48+
`${lb}${sl}f${rb}`,
49+
`${lb}r${rb} %H`, // ref
50+
`${lb}d${rb} %at`, // date
51+
`${lb}l${rb} %gd`, // reflog-selector
52+
`${lb}s${rb}`,
53+
`%B`, // summary
54+
`${lb}${sl}s${rb}`,
55+
`${lb}f${rb}`
56+
].join('%n');
57+
58+
const defaultStashParams = ['stash', 'list', '--name-status', '--full-history', '-M', `--format=${stashFormat}`];
2959

3060
const GitWarnings = [
3161
/Not a git repository/,

src/git/parsers/logParser.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ export class GitLogParser {
106106
entry.summary += `\n${line}`;
107107
}
108108
}
109+
110+
if (entry.summary !== undefined) {
111+
// Remove the trailing newline
112+
entry.summary = entry.summary.slice(0, -1);
113+
}
109114
break;
110115

111116
case 102: // 'f': // files
@@ -223,7 +228,7 @@ export class GitLogParser {
223228
entry.author!,
224229
entry.email,
225230
new Date(entry.date! as any * 1000),
226-
entry.summary!,
231+
entry.summary === undefined ? '' : entry.summary,
227232
relativeFileName,
228233
entry.fileStatuses || [],
229234
entry.status,

src/git/parsers/stashParser.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export class GitStashParser {
7272
entry.summary += `\n${line}`;
7373
}
7474
}
75+
76+
if (entry.summary !== undefined) {
77+
// Remove the trailing newline
78+
entry.summary = entry.summary.slice(0, -1);
79+
}
7580
break;
7681

7782
case 102: // 'f': // files
@@ -127,7 +132,7 @@ export class GitStashParser {
127132
repoPath,
128133
entry.ref!,
129134
new Date(entry.date! as any * 1000),
130-
entry.summary!,
135+
entry.summary === undefined ? '' : entry.summary,
131136
entry.fileNames!,
132137
entry.fileStatuses || []
133138
);

0 commit comments

Comments
 (0)