-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fetching without the --progress option #1067
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,6 @@ describe('Test fetchDepth and fetchTags options', () => { | |
'protocol.version=2', | ||
'fetch', | ||
'--prune', | ||
'--progress', | ||
'--no-recurse-submodules', | ||
'--filter=filterValue', | ||
'origin', | ||
|
@@ -174,7 +173,6 @@ describe('Test fetchDepth and fetchTags options', () => { | |
'fetch', | ||
'--no-tags', | ||
'--prune', | ||
'--progress', | ||
'--no-recurse-submodules', | ||
'--filter=filterValue', | ||
'origin', | ||
|
@@ -213,7 +211,6 @@ describe('Test fetchDepth and fetchTags options', () => { | |
'fetch', | ||
'--no-tags', | ||
'--prune', | ||
'--progress', | ||
'--no-recurse-submodules', | ||
'--filter=filterValue', | ||
'--depth=1', | ||
|
@@ -252,7 +249,6 @@ describe('Test fetchDepth and fetchTags options', () => { | |
'protocol.version=2', | ||
'fetch', | ||
'--prune', | ||
'--progress', | ||
'--no-recurse-submodules', | ||
'--filter=filterValue', | ||
'--depth=1', | ||
|
@@ -263,4 +259,120 @@ describe('Test fetchDepth and fetchTags options', () => { | |
expect.any(Object) | ||
) | ||
}) | ||
|
||
it('should call execGit with the correct arguments when showProgress is true', async () => { | ||
jest.spyOn(exec, 'exec').mockImplementation(mockExec) | ||
|
||
const workingDirectory = 'test' | ||
const lfs = false | ||
const doSparseCheckout = false | ||
git = await commandManager.createCommandManager( | ||
workingDirectory, | ||
lfs, | ||
doSparseCheckout | ||
) | ||
const refSpec = ['refspec1', 'refspec2'] | ||
const options = { | ||
filter: 'filterValue', | ||
showProgress: true | ||
} | ||
|
||
await git.fetch(refSpec, options) | ||
|
||
expect(mockExec).toHaveBeenCalledWith( | ||
expect.any(String), | ||
[ | ||
'-c', | ||
'protocol.version=2', | ||
'fetch', | ||
'--no-tags', | ||
'--prune', | ||
'--no-recurse-submodules', | ||
'--progress', | ||
'--filter=filterValue', | ||
'origin', | ||
'refspec1', | ||
'refspec2' | ||
], | ||
expect.any(Object) | ||
) | ||
}) | ||
|
||
it('should call execGit with the correct arguments when fetchDepth is 42 and showProgress is true', async () => { | ||
jest.spyOn(exec, 'exec').mockImplementation(mockExec) | ||
|
||
const workingDirectory = 'test' | ||
const lfs = false | ||
const doSparseCheckout = false | ||
git = await commandManager.createCommandManager( | ||
workingDirectory, | ||
lfs, | ||
doSparseCheckout | ||
) | ||
const refSpec = ['refspec1', 'refspec2'] | ||
const options = { | ||
filter: 'filterValue', | ||
fetchDepth: 42, | ||
showProgress: true | ||
} | ||
|
||
await git.fetch(refSpec, options) | ||
|
||
expect(mockExec).toHaveBeenCalledWith( | ||
expect.any(String), | ||
[ | ||
'-c', | ||
'protocol.version=2', | ||
'fetch', | ||
'--no-tags', | ||
'--prune', | ||
'--no-recurse-submodules', | ||
'--progress', | ||
'--filter=filterValue', | ||
'--depth=42', | ||
'origin', | ||
'refspec1', | ||
'refspec2' | ||
], | ||
expect.any(Object) | ||
) | ||
}) | ||
|
||
it('should call execGit with the correct arguments when fetchTags is true and showProgress is true', async () => { | ||
jest.spyOn(exec, 'exec').mockImplementation(mockExec) | ||
|
||
const workingDirectory = 'test' | ||
const lfs = false | ||
const doSparseCheckout = false | ||
git = await commandManager.createCommandManager( | ||
workingDirectory, | ||
lfs, | ||
doSparseCheckout | ||
) | ||
const refSpec = ['refspec1', 'refspec2'] | ||
const options = { | ||
filter: 'filterValue', | ||
fetchTags: true, | ||
showProgress: true | ||
} | ||
|
||
await git.fetch(refSpec, options) | ||
|
||
expect(mockExec).toHaveBeenCalledWith( | ||
expect.any(String), | ||
[ | ||
'-c', | ||
'protocol.version=2', | ||
'fetch', | ||
'--prune', | ||
'--no-recurse-submodules', | ||
'--progress', | ||
'--filter=filterValue', | ||
'origin', | ||
'refspec1', | ||
'refspec2' | ||
], | ||
expect.any(Object) | ||
) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be happy to remove some of the test coverage if it's considered too much. I was trying to follow the example set in #579 . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Too much coverage is rarely a problem. Thank you for the detailed effort! |
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to merge these options onto the default option values here so the assertions become more like real world examples. (This is just an idea for a separate PR though.)