MCPcopy Create free account
hub / github.com/angular/dev-infra / _push

Method _push

ng-dev/utils/testing/virtual-git-client.ts:102–123  ·  view source on GitHub ↗

Handler for the `git push` command.

(args: string[])

Source from the content-addressed store, hash-verified

100
101 /** Handler for the `git push` command. */
102 private _push(args: string[]) {
103 const {repoUrl, refspec} = yargs(args)
104 .command('$0 <repoUrl> <refspec>', false)
105 .positional('repoUrl', {type: 'string', demandOption: true})
106 .positional('refspec', {type: 'string', demandOption: true})
107 .option('q', {boolean: true})
108 .parseSync();
109 const ref = this._unwrapRefspec(refspec);
110 const name = ref.destination || ref.source;
111 const existingPush = this.pushed.find(
112 ({remote}) => remote.repoUrl === repoUrl && remote.name === name,
113 );
114 const pushedHead = this._cloneHead(this.head);
115
116 // Either, update a previously pushed branch, or keep track of a newly
117 // performed branch push. We don't respect the `--force` flag.
118 if (existingPush !== undefined) {
119 existingPush.head = pushedHead;
120 } else {
121 this.pushed.push({remote: {repoUrl, name}, head: pushedHead});
122 }
123 }
124
125 /** Handler for the `git commit` command. */
126 private _commit(rawArgs: string[]) {

Callers 1

runGracefulMethod · 0.95

Calls 3

_unwrapRefspecMethod · 0.95
_cloneHeadMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected