Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Don't touch Git if a branch is specified #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/commands/upload_cmds/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ module.exports = {
for (const file of argv.files) {
process.stdout.write(`- ${file.source}...`);
const fileDir = path.dirname(file.source);
createdDirs = await checkDirExists(
API,
createdDirs,
fileDir,
branch,
info,
);
if (fileDir !== '.') {
createdDirs = await checkDirExists(
API,
createdDirs,
fileDir,
branch,
info,
);
}

await uploadFile(API, file, branch, info);
console.log(chalk.green('OK'));
Expand Down
15 changes: 6 additions & 9 deletions lib/utils/getCrowdinBranch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ const getBasePath = require('./getBasePath');

module.exports = async function getCrowdinBranch(argv) {
const { baseBranches, branch } = argv;
const projectBranch = await gitBranch(path.dirname(getBasePath(argv)));

return new Promise((resolve) => {
const targetBranch = branch || projectBranch;
const targetBranch = branch || await gitBranch(path.dirname(getBasePath(argv)));

if (!targetBranch || baseBranches.includes(targetBranch)) {
resolve(undefined);
} else {
resolve(targetBranch.replace(/\//g, '_'));
}
});
if (targetBranch && !baseBranches.includes(targetBranch)) {
return targetBranch.replace(/\//g, '_');
} else {
return undefined;
}
};