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

hit fix - make commit and push #39

Closed
2 tasks done
vrom911 opened this issue Feb 6, 2019 · 4 comments
Closed
2 tasks done

hit fix - make commit and push #39

vrom911 opened this issue Feb 6, 2019 · 4 comments
Labels
CLI command-line interface Git Git commands good first issue Good for newcomers

Comments

@vrom911
Copy link
Member

vrom911 commented Feb 6, 2019

At the moment we have hit fix command which amends the changes to the latest commit and force pushes the branch. I guess the better name for this command is hit amend.

I can see the better usage for the hit fix command: to make the separate commit (without the issue prefix) and to push the branch.

So, to resolve this issue ones need:

  • Rename hit fix to hit amend
  • Implement hit fix command which will take the optional string as the commit message (if the optional string is not provided then use "Fix after review" message), make the commit to the current branch and push the current branch.
@vrom911 vrom911 added good first issue Good for newcomers Git Git commands CLI command-line interface labels Feb 6, 2019
@chshersh
Copy link
Contributor

chshersh commented Feb 7, 2019

@Jigar3 hi! I wonder, do you still have plans on finish this issue? Otherwise we would like to proceed with it and finish soon 🙂

@Jigar3
Copy link
Contributor

Jigar3 commented Feb 7, 2019

I have started working on it. Will submit a PR soon. 😀

@Jigar3
Copy link
Contributor

Jigar3 commented Feb 7, 2019

runFix :: Maybe Text -> IO ()
runFix = \case
    Nothing -> do
        "git" ["add", "."]
        "git" ["commit", "-m", "Fix after review"]
        runPush False
    Just msg -> do
        "git" ["add", "."]
        "git" ["commit", "-m "] ++ msg
        runPush False
Error:

• Couldn't match expected type ‘[a1]’ with actual type ‘Text’
• In the second argument of ‘(++)’, namely ‘msg’

I am getting this error and am not sure if its the correct approach. Could you guide me please 😅

@chshersh
Copy link
Contributor

chshersh commented Feb 7, 2019

@Jigar3 The problem is in this line:

"git" ["commit", "-m "] ++ msg

You want to append msg to the list ["commit", "-m "] but instead you're appending it to function call "git" ["commit", "-m "]. What you want is something like:

"git" $ ["commit", "-m "] ++ [msg]

Or just

"git" ["commit", "-m ", msg]

Also you may notice some code duplication in your function. Instead of pattern-matching on Maybe on top level you can just construct message text from that Maybe Text and pass it to "git" inside list. I hope that helps!

@chshersh chshersh closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI command-line interface Git Git commands good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants