Handler for the `git push` command.
(args: string[])
| 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[]) { |
no test coverage detected