-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new interface
git.showBuffer
to allow using git.show
with bin…
…ary file content. Closes #921
- Loading branch information
Showing
6 changed files
with
55 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { SimpleGit } from '../../../typings'; | ||
import { SimpleGitApi } from '../simple-git-api'; | ||
import { getTrailingOptions, trailingFunctionArgument } from '../utils'; | ||
import { straightThroughBufferTask, straightThroughStringTask } from './task'; | ||
|
||
export default function (): Pick<SimpleGit, 'showBuffer' | 'show'> { | ||
return { | ||
showBuffer(this: SimpleGitApi) { | ||
const commands = ['show', ...getTrailingOptions(arguments, 1)]; | ||
if (!commands.includes('--binary')) { | ||
commands.splice(1, 0, '--binary'); | ||
} | ||
|
||
return this._runTask( | ||
straightThroughBufferTask(commands), | ||
trailingFunctionArgument(arguments) | ||
); | ||
}, | ||
|
||
show(this: SimpleGitApi) { | ||
const commands = ['show', ...getTrailingOptions(arguments, 1)]; | ||
return this._runTask( | ||
straightThroughStringTask(commands), | ||
trailingFunctionArgument(arguments) | ||
); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters