Skip to content

Commit

Permalink
Fixes #860 & #862 - switch to iso dates
Browse files Browse the repository at this point in the history
Older version of Git don't support unix timestamp dates
  • Loading branch information
eamodio committed Sep 24, 2019
1 parent 3dc9e69 commit 705a13c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Fixed

- Fixes [#862](https://github.com/eamodio/vscode-gitlens/issues/862) - Command failed when expanding a local branch
- Fixes [#860](https://github.com/eamodio/vscode-gitlens/issues/860) - Unknown date format error
- Fixes [#858](https://github.com/eamodio/vscode-gitlens/issues/858) - GitHub avatars in blame line hovers are huge
- Fixes issue with locating a working file when the file is staged or modified

Expand Down
2 changes: 1 addition & 1 deletion src/git/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ export class Git {
repoPath: string,
{ all, branch, since }: { all?: boolean; branch?: string; since?: string } = {}
): Promise<string> {
const params = ['log', '-g', `--format=${GitReflogParser.defaultFormat}`, '--date=unix'];
const params = ['log', '-g', `--format=${GitReflogParser.defaultFormat}`, '--date=iso8601'];
if (all) {
params.push('--all');
}
Expand Down
4 changes: 2 additions & 2 deletions src/git/parsers/branchParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class GitBranchParser {
`${lb}u${rb}%(upstream:short)`, // branch upstream
`${lb}t${rb}%(upstream:track)`, // branch upstream tracking state
`${lb}r${rb}%(objectname)`, // ref
`${lb}d${rb}%(committerdate:unix)` // committer date
`${lb}d${rb}%(committerdate:iso8601)` // committer date
].join('');

@debug({ args: false, singleLine: true })
Expand Down Expand Up @@ -57,7 +57,7 @@ export class GitBranchParser {
name,
remote,
current.charCodeAt(0) === 42, // '*',
new Date(Number(date) * 1000),
new Date(date),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
ref == null || ref.length === 0 ? undefined : ` ${ref}`.substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
Expand Down
4 changes: 2 additions & 2 deletions src/git/parsers/reflogParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const rb = '%x3e'; // `%x${'>'.charCodeAt(0).toString(16)}`;
export class GitReflogParser {
static defaultFormat = [
`${lb}r${rb}%H`, // ref
`${lb}d${rb}%gD`, // reflog selector (with UNIX timestamp)
`${lb}d${rb}%gD`, // reflog selector (with iso8601 timestamp)
`${lb}s${rb}%gs` // reflog subject
// `${lb}n${rb}%D` // ref names
].join('');
Expand Down Expand Up @@ -95,7 +95,7 @@ export class GitReflogParser {
` ${sha}`.substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
` ${selector}`.substr(1),
new Date(Number(date) * 1000),
new Date(date),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
` ${command}`.substr(1),
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
Expand Down

0 comments on commit 705a13c

Please sign in to comment.