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

Better error handling for "Clean Repo" check #112

Open
conor909 opened this issue Feb 16, 2021 · 4 comments
Open

Better error handling for "Clean Repo" check #112

conor909 opened this issue Feb 16, 2021 · 4 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@conor909
Copy link

conor909 commented Feb 16, 2021

🚀 Feature Proposal

When publishing we do a deep check on a clean "git status" object, and check it against the actual result of git.status on the path to the project we provide.

here:

assert.deepStrictEqual(compare, CLEAN_REPO, 'The git repo must be clean (committed and pushed) before releasing!')

Motivation

The issue is that no matter what the differences of the two objects is, the error prints:
The git repo must be clean (committed and pushed) before releasing!

My issue was that my branch was named "main" instead of the default "master". But the error message was throwing me off.

I propose to print the result of assert.deepStrictEqual, as it provides the expected vs. received, so it would flag up if the tracking or any other properties on those objects didn't match.

Alternatively, if we only care about the ahead & behind properties to determine the git status, we could only compare those 2 properties.

Example

   try {
      assert.deepStrictEqual(compare, CLEAN_REPO)
    } catch (err) {
      console.log(err)
    }

or something like:

  const CLEAN_REPO = {
    ahead: 0,
    behind: 0
  }

  const compare = {
    ahead: status.ahead,
    behind: status.behind
  }

  assert.deepStrictEqual(compare, CLEAN_REPO, 'The git repo must be clean (committed and pushed) before releasing!')

@capaj
Copy link
Contributor

capaj commented Sep 24, 2021

Yes, this would help quite a bit-bumped into an issue today and I had to add console.logs there

@Eomm Eomm added the good first issue Good for newcomers label Sep 26, 2021
@Eomm
Copy link
Member

Eomm commented Sep 26, 2021

Alternatively, if we only care about the ahead & behind properties to determine the git status, we could only compare those 2 properties.

This would be harmful because the subsequent commands would run against master instead of the main

Remember that you can change the default with the command

$ releasify config --arg branch -v info
# input "main"

@Aslam-13
Copy link

Aslam-13 commented Feb 8, 2022

Hi,
I want to give it a try can you pls assign to me.

@Aslam-13
Copy link

Aslam-13 commented Feb 9, 2022

Hi,
I have made a PR #214 kindly review it and give me a feedback if any changes is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants