Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

If no branch is defined, use an empty string. #29

Merged
merged 3 commits into from
Jun 27, 2019

Conversation

annawinkler
Copy link
Contributor

In the project I'm working on, we do not always have branch defined. Without a branch defined, unfortunately, an exception is thrown. An empty string seems like a reasonable value to return if there is no branch defined.

@parkr
Copy link
Owner

parkr commented Jun 25, 2019

Hi @annawinkler! Thank you so much for the PR. How are you looking up the revision? Are you deploying a revision directly?

@annawinkler
Copy link
Contributor Author

Hi @parkr - great question! When a branch is not specified, the :real_revision is used to get the latest revision from HEAD.

@annawinkler
Copy link
Contributor Author

I'm using Capistrano 2 if that helps...

@parkr
Copy link
Owner

parkr commented Jun 26, 2019

Ah interesting. It sounds like you had to work around a :revision variable, maybe? I wonder if it’d make sense for our rev method to read from a :revision variable or otherwise run the git command.

That said, I’d be happy to accept this PR in the interest of unblocking you all 😄

end

def deploy_target
[slack_app_name, branch].join('/') + (rev ? " (#{rev[0..5]})" : "")
[slack_app_name, branch_or_not].join('/') + (rev ? " (#{rev[0..5]})" : "")
Copy link
Owner

Choose a reason for hiding this comment

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

This will produce slack_app_name/@revision when a branch name isn’t specified. Are you cool with this or would you rather see slack_app_name@revision?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's a good point. No, I think seeing slack_app_name@revision would be better. I'll update the PR.

@annawinkler
Copy link
Contributor Author

Hi @parkr ! I tested this branch with the following 3 different scenarios:

  1. cap my_app deploy
  2. cap my_app branch=a_branch
  3. cap my_app deploy -S revision=SOME_SHA

I like your suggestion to include the revision if it is specified, and I like the output for (2) and (3). For (1), in the case where no branch and no revision is specified, HEAD is assumed and while I would like to see the git sha for HEAD I'm not sure I like adding the special code for that case.

What are your thoughts now about this PR? Anything else that would be good to consider or does this look OK to merge?

@parkr
Copy link
Owner

parkr commented Jun 27, 2019

This is perfect! Thank you so much for your contribution. I’ll merge and release a new version today. 😄

@annawinkler
Copy link
Contributor Author

Thanks @parkr ! 🎉

@parkr parkr merged commit e85b11c into parkr:master Jun 27, 2019
parkr added a commit that referenced this pull request Jun 27, 2019
@parkr
Copy link
Owner

parkr commented Jun 27, 2019

1.3.4 has been released! 🎉

@annawinkler annawinkler deleted the branch-is-not-required branch June 27, 2019 17:15
@annawinkler
Copy link
Contributor Author

Woo hoo - thanks!!!

@parkr
Copy link
Owner

parkr commented Jun 27, 2019

Thank you for making this project better ❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants