Selaa lähdekoodia

Adds better log caching for timeline

main
Eric Amodio 1 vuosi sitten
vanhempi
commit
ba0aa6eb4d
2 muutettua tiedostoa jossa 17 lisäystä ja 5 poistoa
  1. +1
    -1
      src/env/node/git/localGitProvider.ts
  2. +16
    -4
      src/plus/webviews/timeline/timelineWebview.ts

+ 1
- 1
src/env/node/git/localGitProvider.ts Näytä tiedosto

@ -3095,7 +3095,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
return cachedLog.item;
}
if (options.ref != null || options.limit != null) {
if (options.ref != null || (options.limit != null && options.limit !== 0)) {
// Since we are looking for partial log, see if we have the log of the whole file
const cachedLog = doc.state.getLog(
`log${options.renames ? ':follow' : ''}${options.reverse ? ':reverse' : ''}`,

+ 16
- 4
src/plus/webviews/timeline/timelineWebview.ts Näytä tiedosto

@ -474,14 +474,26 @@ function generateRandomTimelineDataset(): Commit[] {
function getPeriodDate(period: Period): Date {
const [number, unit] = period.split('|');
let date;
switch (unit) {
case 'D':
return createFromDateDelta(new Date(), { days: -parseInt(number, 10) });
date = createFromDateDelta(new Date(), { days: -parseInt(number, 10) });
break;
case 'M':
return createFromDateDelta(new Date(), { months: -parseInt(number, 10) });
date = createFromDateDelta(new Date(), { months: -parseInt(number, 10) });
break;
case 'Y':
return createFromDateDelta(new Date(), { years: -parseInt(number, 10) });
date = createFromDateDelta(new Date(), { years: -parseInt(number, 10) });
break;
default:
return createFromDateDelta(new Date(), { months: -3 });
date = createFromDateDelta(new Date(), { months: -3 });
break;
}
// If we are more than 1/2 way through the day, then set the date to the next day
if (date.getHours() >= 12) {
date.setDate(date.getDate() + 1);
}
date.setHours(0, 0, 0, 0);
return date;
}

Ladataan…
Peruuta
Tallenna