From 9ae4877f051c8c116b12a09b4531d6efdd12cea7 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 20 Sep 2018 23:20:23 -0400 Subject: [PATCH] Fixes #496 - matches git's default abbrev sha length --- CHANGELOG.md | 1 + src/git/git.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3864a82..041458d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#496](https://github.com/eamodio/vscode-gitlens/issues/496) - Short hash length doesn't match git's default length - Fixes [#503](https://github.com/eamodio/vscode-gitlens/issues/503) - Open Changes (with difftool) opens one difftool window per changed file - Fixes [#405](https://github.com/eamodio/vscode-gitlens/issues/405) - Secondary, blank repository appears repeatedly in gitExplorer view - Fixes [#430](https://github.com/eamodio/vscode-gitlens/issues/430) - File revisions can end up being parsed by language servers (causing errors and warnings, etc) diff --git a/src/git/git.ts b/src/git/git.ts index ca11aca..92b1995 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -227,12 +227,12 @@ export class Git { } const index = ref.indexOf('^'); - if (index > 6) { + if (index > 5) { // Only grab a max of 5 chars for the suffix const suffix = ref.substring(index).substring(0, 5); - return `${ref.substring(0, 8 - suffix.length)}${suffix}`; + return `${ref.substring(0, 7 - suffix.length)}${suffix}`; } - return ref.substring(0, 8); + return ref.substring(0, 7); } static splitPath(fileName: string, repoPath: string | undefined, extract: boolean = true): [string, string] {