From eda2375b84d7bfab8122bfa851b6aae74a01420a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 25 Jan 2018 14:29:31 -0500 Subject: [PATCH] Fixes #259 - Don't use full-history on files --- CHANGELOG.md | 1 + src/git/git.ts | 21 ++++++--------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e7afe3..f24045a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] ### Fixed - Fixes [#257](https://github.com/eamodio/vscode-gitlens/issues/257) - Some branches fail to show history +- Fixes [#259](https://github.com/eamodio/vscode-gitlens/issues/259) - File history lists unrelated merge commits ## [7.5.6] - 2018-01-22 ### Changed diff --git a/src/git/git.ts b/src/git/git.ts index 45b2c59..1815732 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -42,7 +42,7 @@ const logFormat = [ `${lb}f${rb}` ].join('%n'); -const defaultLogParams = ['log', '--name-status', '--full-history', '-M', `--format=${logFormat}`]; +const defaultLogParams = ['log', '--name-status', '-M', `--format=${logFormat}`]; const stashFormat = [ `${lb}${sl}f${rb}`, @@ -55,7 +55,7 @@ const stashFormat = [ `${lb}f${rb}` ].join('%n'); -const defaultStashParams = ['stash', 'list', '--name-status', '--full-history', '-M', `--format=${stashFormat}`]; +const defaultStashParams = ['stash', 'list', '--name-status', '-M', `--format=${stashFormat}`]; const GitWarnings = [ /Not a git repository/, @@ -389,7 +389,7 @@ export class Git { } static log(repoPath: string, options: { maxCount?: number, ref?: string, reverse?: boolean }) { - const params = [...defaultLogParams, '-m']; + const params = [...defaultLogParams, '--full-history', '-m']; if (options.maxCount && !options.reverse) { params.push(`-n${options.maxCount}`); } @@ -412,16 +412,7 @@ export class Git { params.push(`-n${options.maxCount}`); } - if (options.skipMerges) { - params.push('--no-merges'); - } - else { - params.push('-m'); - // If we are looking for a specific sha don't simplify merges - if (!options.ref || options.maxCount! > 2) { - params.push('--simplify-merges'); - } - } + params.push(options.skipMerges ? '--no-merges' : '-m'); if (options.ref && !Git.isStagedUncommitted(options.ref)) { if (options.reverse) { @@ -443,7 +434,7 @@ export class Git { static async log_recent(repoPath: string, fileName: string) { try { - const data = await gitCommandCore({ cwd: repoPath }, 'log', '--full-history', '-M', '-n1', '--format=%H', '--', fileName); + const data = await gitCommandCore({ cwd: repoPath }, 'log', '-M', '-n1', '--format=%H', '--', fileName); return data.trim(); } catch { @@ -453,7 +444,7 @@ export class Git { static async log_resolve(repoPath: string, fileName: string, ref: string) { try { - const data = await gitCommandCore({ cwd: repoPath }, 'log', '--full-history', '-M', '-n1', '--format=%H', ref, '--', fileName); + const data = await gitCommandCore({ cwd: repoPath }, 'log', '-M', '-n1', '--format=%H', ref, '--', fileName); return data.trim(); } catch {