Skip to content

Commit

Permalink
fix: While use of the ListLogSummary type is deprecated in favour o…
Browse files Browse the repository at this point in the history
…f the new `LogResult`, the alias type should also support the default generic `DefaultLogFields` to allow downstream consumers to upgrade to newer `2.x` versions without the need to specify a generic.

Closes #586
  • Loading branch information
steveukx committed Feb 23, 2021
1 parent d3e8dc7 commit 508e602
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions test/unit/log.spec.ts
@@ -1,4 +1,4 @@
import { SimpleGit } from 'typings';
import { ListLogSummary, SimpleGit } from 'typings';
import {
assertExecutedCommands,
assertExecutedCommandsContains,
Expand Down Expand Up @@ -309,9 +309,9 @@ ${START_BOUNDARY}jkl${COMMIT_BOUNDARY}
const parser = createListLogSummaryParser(splitOn.SEMIS);
const actual = parser(`
${ START_BOUNDARY }aaa;;;;;2018-09-13 06:52:30 +0100;;;;;WIP on master: 2942035 blah (refs/stash);;;;;Steve King;;;;;steve@mydev.co${ COMMIT_BOUNDARY }
${ START_BOUNDARY }bbb;;;;;2018-09-13 06:52:10 +0100;;;;;WIP on master: 2942035 blah;;;;;Steve King;;;;;steve@mydev.co${ COMMIT_BOUNDARY }
${ START_BOUNDARY }ccc;;;;;2018-09-13 06:48:22 +0100;;;;;WIP on master: 2942035 blah;;;;;Steve King;;;;;steve@mydev.co${ COMMIT_BOUNDARY }
${START_BOUNDARY}aaa;;;;;2018-09-13 06:52:30 +0100;;;;;WIP on master: 2942035 blah (refs/stash);;;;;Steve King;;;;;steve@mydev.co${COMMIT_BOUNDARY}
${START_BOUNDARY}bbb;;;;;2018-09-13 06:52:10 +0100;;;;;WIP on master: 2942035 blah;;;;;Steve King;;;;;steve@mydev.co${COMMIT_BOUNDARY}
${START_BOUNDARY}ccc;;;;;2018-09-13 06:48:22 +0100;;;;;WIP on master: 2942035 blah;;;;;Steve King;;;;;steve@mydev.co${COMMIT_BOUNDARY}
`);

Expand All @@ -321,9 +321,9 @@ ${ START_BOUNDARY }ccc;;;;;2018-09-13 06:48:22 +0100;;;;;WIP on master: 2942035
hash: 'aaa'
}),
all: [
like({ hash: 'aaa'}),
like({ hash: 'bbb'}),
like({ hash: 'ccc'}),
like({hash: 'aaa'}),
like({hash: 'bbb'}),
like({hash: 'ccc'}),
]
}));

Expand Down Expand Up @@ -521,4 +521,12 @@ ${START_BOUNDARY}207601debebc170830f2921acf2b6b27034c3b1f::2016-01-03 15:50:58 +
});
});

describe('deprecations', () => {
it('supports ListLogSummary without generic type', async () => {
const summary: Promise<ListLogSummary> = git.log({from: 'from', to: 'to'});
await closeWithSuccess();

expect(summary).not.toBe(undefined);
});
});
});
2 changes: 1 addition & 1 deletion typings/response.d.ts
Expand Up @@ -450,4 +450,4 @@ export type MoveSummary = MoveResult;
/**
* @deprecated to aid consistent naming, please use `LogResult` instead of `ListLogSummary`.
*/
export type ListLogSummary<T> = LogResult<T>;
export type ListLogSummary<T = DefaultLogFields> = LogResult<T>;

0 comments on commit 508e602

Please sign in to comment.