Current Branch being asked to Git, removed from Workspace Config and Browser Local Storage
This commit is contained in:
1 parent
268d5eba7c
commit
a64dd3ccd8
3 files changed
+162
-17
No files matched your search
+56
-6
@@ -833,9 +833,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> token = ' + token)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
@@ -892,9 +889,62 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> username = ' + username)
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> token = ' + token)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case 'Branch': {
|
||||
try {
|
||||
branch()
|
||||
|
||||
async function branch() {
|
||||
let result = await doGit()
|
||||
|
||||
if (result.error === undefined) {
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_OK_RESPONSE.result,
|
||||
message: result
|
||||
}
|
||||
respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
} else {
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'App Error - Could Not Get Current Branch',
|
||||
anchor: undefined,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
respondWithDocsObject(docs, error)
|
||||
}
|
||||
}
|
||||
|
||||
async function doGit() {
|
||||
const simpleGit = require('simple-git');
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
maxConcurrentProcesses: 6,
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
try {
|
||||
return await git.branch()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Error reading current branch.')
|
||||
console.log(err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Update -> err.stack = ' + err.stack)
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
|
||||
Reference in new issue
Block a user