diff --git a/CHANGELOG.md b/CHANGELOG.md index 575c5ae..5e7afe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] +### Fixed +- Fixes [#257](https://github.com/eamodio/vscode-gitlens/issues/257) - Some branches fail to show history + ## [7.5.6] - 2018-01-22 ### Changed - 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) diff --git a/src/git/git.ts b/src/git/git.ts index d2f5a4f..45b2c59 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -23,9 +23,39 @@ export * from './remotes/provider'; let git: IGit; const defaultBlameParams = ['blame', '--root', '--incremental']; + // Using %x00 codes because some shells seem to try to expand things if not -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']; -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']; +const lb = '%x3c'; // `%x${'<'.charCodeAt(0).toString(16)}`; +const rb = '%x3e'; // `%x${'>'.charCodeAt(0).toString(16)}`; +const sl = '%x2f'; // `%x${'/'.charCodeAt(0).toString(16)}`; + +const logFormat = [ + `${lb}${sl}f${rb}`, + `${lb}r${rb} %H`, // ref + `${lb}a${rb} %an`, // author + `${lb}e${rb} %ae`, // email + `${lb}d${rb} %at`, // date + `${lb}p${rb} %P`, // parents + `${lb}s${rb}`, + `%B`, // summary + `${lb}${sl}s${rb}`, + `${lb}f${rb}` +].join('%n'); + +const defaultLogParams = ['log', '--name-status', '--full-history', '-M', `--format=${logFormat}`]; + +const stashFormat = [ + `${lb}${sl}f${rb}`, + `${lb}r${rb} %H`, // ref + `${lb}d${rb} %at`, // date + `${lb}l${rb} %gd`, // reflog-selector + `${lb}s${rb}`, + `%B`, // summary + `${lb}${sl}s${rb}`, + `${lb}f${rb}` +].join('%n'); + +const defaultStashParams = ['stash', 'list', '--name-status', '--full-history', '-M', `--format=${stashFormat}`]; const GitWarnings = [ /Not a git repository/, diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 2329074..43bd941 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -106,6 +106,11 @@ export class GitLogParser { entry.summary += `\n${line}`; } } + + if (entry.summary !== undefined) { + // Remove the trailing newline + entry.summary = entry.summary.slice(0, -1); + } break; case 102: // 'f': // files @@ -223,7 +228,7 @@ export class GitLogParser { entry.author!, entry.email, new Date(entry.date! as any * 1000), - entry.summary!, + entry.summary === undefined ? '' : entry.summary, relativeFileName, entry.fileStatuses || [], entry.status, diff --git a/src/git/parsers/stashParser.ts b/src/git/parsers/stashParser.ts index ff1fb2d..57c23db 100644 --- a/src/git/parsers/stashParser.ts +++ b/src/git/parsers/stashParser.ts @@ -72,6 +72,11 @@ export class GitStashParser { entry.summary += `\n${line}`; } } + + if (entry.summary !== undefined) { + // Remove the trailing newline + entry.summary = entry.summary.slice(0, -1); + } break; case 102: // 'f': // files @@ -127,7 +132,7 @@ export class GitStashParser { repoPath, entry.ref!, new Date(entry.date! as any * 1000), - entry.summary!, + entry.summary === undefined ? '' : entry.summary, entry.fileNames!, entry.fileStatuses || [] );