Skip to content

Commit

Permalink
fix: Progress plugin should request progress events for fetch as well…
Browse files Browse the repository at this point in the history
… as other common long running tasks.
  • Loading branch information
steveukx committed Feb 20, 2021
1 parent 49281bd commit ea68857
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions readme.md
Expand Up @@ -97,9 +97,9 @@ await git.pull();
await git.raw('pull', '--progress');
```

The `checkout`, `clone`, `pull`, `push` methods will automatically enable progress events when
a progress handler has been set. For any other method that _can_ support progress events, set
`--progress` in the task's `TaskOptions` for example to receive progress events when running
The `checkout`, `clone`, 'fetch, `pull`, `push` methods will automatically enable progress events
when a progress handler has been set. For any other method that _can_ support progress events,
set `--progress` in the task's `TaskOptions` for example to receive progress events when running
submodule tasks:

```typescript
Expand Down
2 changes: 1 addition & 1 deletion src/lib/plugins/progress-monitor-plugin.ts
Expand Up @@ -5,7 +5,7 @@ import { SimpleGitPlugin } from './simple-git-plugin';

export function progressMonitorPlugin(progress: Exclude<SimpleGitOptions['progress'], void>) {
const progressCommand = '--progress';
const progressMethods = ['checkout', 'clone', 'pull', 'push'];
const progressMethods = ['checkout', 'clone', 'fetch', 'pull', 'push'];

const onProgress: SimpleGitPlugin<'spawn.after'> = {
type: 'spawn.after',
Expand Down
8 changes: 5 additions & 3 deletions test/unit/plugins.spec.ts
Expand Up @@ -95,14 +95,16 @@ describe('plugins', () => {

it.each<[string, (git: SimpleGit) => unknown]>([
['checkout', (git) => git.checkout('main')],
['clone', (git) => git.clone('some-remote.git')],
['fetch', (git) => git.fetch('some-remote')],
['pull', (git) => git.pull()],
['push', (git) => git.push()],
['clone', (git) => git.clone('some-remote.git')],
['checkout - progress set', (git) => git.checkout('main', ['--progress', 'blah'])],
['clone - progress set', (git) => git.clone('some-remote.git', ['--progress', 'blah'])],
['fetch - progress set', (git) => git.fetch('some-remote', {'--progress': null, '--foo': 'bar'})],
['pull - progress set', (git) => git.pull(['--progress', 'blah'])],
['push - progress set', (git) => git.push(['--progress', 'blah'])],
['clone - progress set', (git) => git.clone('some-remote.git', ['--progress', 'blah'])],
['raw - progress set', (git) => git.raw('foo','--progress', 'blah')],
['raw - progress set', (git) => git.raw('foo', '--progress', 'blah')],
])(`auto-adds to %s`, async (_name, use) => {
use(newSimpleGit({progress: fn}));

Expand Down

0 comments on commit ea68857

Please sign in to comment.