Skip to content

Commit 63ddf9f

Browse files
committed
Windows compatibility for push to remote module
1 parent 41e2ee2 commit 63ddf9f

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

git/gitPushToRemoteAPI.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ const execPromisified = util.promisify(exec);
55
const fetchRepopath = require("../global/fetchGitRepoPath");
66

77
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+
})
1212
.then(async ({ stdout, stderr }) => {
1313
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+
1527
const pushCommand = `git push -u ${remoteName} ${branch}`;
1628

1729
return await execPromisified(`${pushCommand}`, {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@itassistors/gitconvex",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"description": "Git web UI client",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org/"
77
},
88
"main": "server.js",
99
"bin": {
10-
"gitconvex": "server.js"
10+
"gitconvex":"server.js"
1111
},
1212
"scripts": {
1313
"start": "node server.js",

0 commit comments

Comments
 (0)