timeline: use follow option so timeline follow file beyond renames (#187174)

feat(git): use follow option so timeline follow file beyond renames

Co-authored-by: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com>
This commit is contained in:
Francis Chartrand 2023-12-08 08:03:59 -05:00 committed by GitHub
parent 5bf577b08a
commit bef295a70b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -50,6 +50,8 @@ interface MutableRemote extends Remote {
* Log file options.
*/
export interface LogFileOptions {
/** Optional. Continue listing the history of a file beyond renames */
readonly follow?: boolean;
/** Optional. The maximum number of log entries to retrieve. */
readonly maxEntries?: number | string;
/** Optional. The Git sha (hash) to start retrieving log entries from. */
@ -1091,6 +1093,10 @@ export class Repository {
args.push('--author-date-order');
}
if (options?.follow) {
args.push('--follow');
}
args.push('--', uri.fsPath);
const result = await this.exec(args);

View file

@ -152,6 +152,7 @@ export class GitTimelineProvider implements TimelineProvider {
const commits = await repo.logFile(uri, {
maxEntries: limit,
hash: options.cursor,
follow: true,
// sortByAuthorDate: true
});