Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for diffBranch existence before fetch files #115

Merged
merged 3 commits into from
May 15, 2020
Merged
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ if (process.stdout.isTTY) {

let committedGitFiles = [];
if (isdiffBranchExisted) {
log(success('Great, we find the ' + diffBranch + ' branch.'));
Copy link
Owner

@theenadayalank theenadayalank May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I have merged this PR without noticing this line. I meant to add the log in debug mode. It's my fault that I didn't communicate well. I'm sorry for the inconvenience.

If you don't mind, could you raise another PR with a log message which prints only in debug mode?

If the base branch is found, you can put a log in debug mode. (something like Base branch exists)
If not found, a warning log can be printed in normal mode. (something like below)

⚠️The base branch(branch_name) doesn't exist
Hence all the files will be considered

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well,that's my fault.I will fix it later.

try {
committedGitFiles = fetchGitDiff(diffBranch);
debug('Committed GIT files: ', committedGitFiles);
Expand All @@ -119,6 +120,8 @@ if (process.stdout.isTTY) {
}
// if diffBranch is not existed,get all tracked files on currentBranch to lint
else {
log(warning('Sorry, we cannot find the ' + diffBranch + ' branch.'));
log(warning('So,we use ' + currentBranch + 'branch instead'));
try {
committedGitFiles = getAllTrackedFiles(currentBranch);
debug('Tracked files: ', committedGitFiles);
Expand Down