File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,25 @@ const execPromisified = util.promisify(exec);
5
5
const fetchRepopath = require ( "../global/fetchGitRepoPath" ) ;
6
6
7
7
const gitPushToRemoteApi = async ( repoId , remoteHost , branch ) => {
8
- return await execPromisified (
9
- `git remote -v | grep ' ${ remoteHost } ' | grep 'push'` ,
10
- { cwd : fetchRepopath . getRepoPath ( repoId ) , windowsHide : true }
11
- )
8
+ return await execPromisified ( `git remote -v` , {
9
+ cwd : fetchRepopath . getRepoPath ( repoId ) ,
10
+ windowsHide : true ,
11
+ } )
12
12
. then ( async ( { stdout, stderr } ) => {
13
13
if ( ! stderr ) {
14
- const remoteName = stdout . trim ( ) . split ( / \s / gi) [ 0 ] ;
14
+ const remoteVerbose = stdout . trim ( ) . split ( "\n" ) ;
15
+
16
+ const filteredRemote = remoteVerbose
17
+ . filter ( ( remote ) => {
18
+ if ( remote . includes ( remoteHost ) && remote . includes ( "push" ) ) {
19
+ return true ;
20
+ }
21
+ return false ;
22
+ } )
23
+ . join ( "" ) ;
24
+
25
+ const remoteName = filteredRemote . trim ( ) . split ( / \s / gi) [ 0 ] ;
26
+
15
27
const pushCommand = `git push -u ${ remoteName } ${ branch } ` ;
16
28
17
29
return await execPromisified ( `${ pushCommand } ` , {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @itassistors/gitconvex" ,
3
- "version" : " 1.0.14 " ,
3
+ "version" : " 1.0.15 " ,
4
4
"description" : " Git web UI client" ,
5
5
"publishConfig" : {
6
6
"registry" : " https://registry.npmjs.org/"
7
7
},
8
8
"main" : " server.js" ,
9
9
"bin" : {
10
- "gitconvex" : " server.js"
10
+ "gitconvex" :" server.js"
11
11
},
12
12
"scripts" : {
13
13
"start" : " node server.js" ,
You can’t perform that action at this time.
0 commit comments