Skip to content

Commit 007596a

Browse files
committed
Merge pull request #17 from neel1996/linefeed-fix
1 parent 67d043e commit 007596a

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

git/gitFetchPullApi.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,22 @@ const gitFetchApi = async (repoId, remoteUrl, remoteBranch) => {
4444
};
4545
}
4646

47-
return await execPromisified(`git fetch ${remoteName} ${remoteBranch}`, {
47+
return await execPromisified(`git fetch ${remoteName} ${remoteBranch} -v`, {
4848
cwd: fetchRepopath.getRepoPath(repoId),
4949
windowsHide: true,
5050
})
5151
.then(({ stdout, stderr }) => {
5252
if (stdout || stderr) {
5353
// Git fetch alone returns the result in the standard error stream
54-
const fetchResponse = stderr.trim().split("\n");
54+
let responseValue = "";
55+
if (stdout) {
56+
responseValue += stdout;
57+
}
58+
if (stderr) {
59+
responseValue += stderr;
60+
}
61+
62+
const fetchResponse = responseValue.trim().split("\n");
5563

5664
console.log("Fetch Response :" + fetchResponse);
5765
if (fetchResponse) {
@@ -92,13 +100,20 @@ const gitPullApi = async (repoId, remoteUrl, remoteBranch) => {
92100
};
93101
}
94102

95-
return await execPromisified(`git pull ${remoteName} ${remoteBranch}`, {
103+
return await execPromisified(`git pull ${remoteName} ${remoteBranch} -v`, {
96104
cwd: fetchRepopath.getRepoPath(repoId),
97105
windowsHide: true,
98106
})
99107
.then(async ({ stdout, stderr }) => {
100108
if (stdout || stderr) {
101-
const pullResponse = stderr.trim().split("\n");
109+
let responseValue = "";
110+
if (stdout) {
111+
responseValue += stdout;
112+
}
113+
if (stderr) {
114+
responseValue += stderr;
115+
}
116+
const pullResponse = responseValue.trim().split("\n");
102117

103118
if (pullResponse && pullResponse.length > 0) {
104119
return {

git/gitFileDifferenceAPI.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function getGitFileDifference(repoId, fileName) {
3030
windowsHide: true,
3131
})
3232
.then(({ stdout, stderr }) => {
33-
if (stdout && !stderr) {
33+
if (stdout) {
3434
return stdout.trim().split("\n");
3535
} else {
3636
console.log(stderr);
@@ -50,7 +50,7 @@ async function getGitFileDifference(repoId, fileName) {
5050
}
5151
)
5252
.then(({ stdout, stderr }) => {
53-
if (stdout && !stderr) {
53+
if (stdout) {
5454
return stdout.trim().split("\n");
5555
} else {
5656
console.log(stderr);

0 commit comments

Comments
 (0)