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

Branch names with dashes between the words #248

Open
duianto opened this issue Feb 12, 2019 · 6 comments
Open

Branch names with dashes between the words #248

duianto opened this issue Feb 12, 2019 · 6 comments

Comments

@duianto
Copy link
Contributor

duianto commented Feb 12, 2019

Most if not all branch names have used underscores between the words until level 42.

But in:
Name: rebase_onto
Level: 41
Difficulty: **

One of the branch names readme-update uses a dash between the words. The other branch wrong_branch uses an underscore.

When searching in this githug repository for readme-update, then two files are listed:

levels/rebase_onto.rb has 3 instances:

repo.git.native :checkout, { "b" => true }, "readme-update"

repo.commits("readme-update").each { |commit| return false if commit.message == "Wrong changes" }
return false unless repo.commits("readme-update").length == 4

spec/githug_spec.rb has 2 instances:

githug/spec/githug_spec.rb

Lines 241 to 242 in 2544b01

`git checkout readme-update`
`git rebase --onto master wrong_branch readme-update`

While scrolling through spec/githug_spec.rb, I noticed another branch that also use dashes:
long-feature-branch

levels/merge_squash.rb has 3 instances:

description "Merge all commits from the long-feature-branch as a single commit."

repo.git.native :checkout, {"b" => true}, 'long-feature-branch'

# Check if changes from all the commits from long-feature-branch are included.

spec/githug_spec.rb has 1 instance:

`git merge --squash long-feature-branch`

And while writing this I noticed this name new-feature, but I'm not sure if it's a branch name or a git command name. It's listed 1 time here:

commit = `git log new-feature --oneline -n 3 | tail -1 | cut -d " " -f 1`

And 4 times here:
https://github.com/Gazler/githug/blob/2544b01546d00165cd7f7059b965be85e1e15006/levels/cherry-pick/.githug/logs/HEAD

I didn't open a PR because I'm not sure if one/some/all dash names are there for a reason.

@Gazler
Copy link
Owner

Gazler commented Feb 13, 2019

Well spotted, thanks for opening this. As the levels were contributed from many contributors, it is likely that some had their own convention for branch names. I'd be happy for a PR that standardises this to use dashed-branch-names instead of underscored_branch_names.

@duianto
Copy link
Contributor Author

duianto commented Feb 13, 2019

To start with, the https://github.com/Gazler/githug#writing-levels section should mention that branch names should use dashes, so that any new levels that are created will use that style.

@duianto
Copy link
Contributor Author

duianto commented Feb 13, 2019

Should repository names and tags also use dashes?

my_cloned_repo

description "Clone the repository at https://github.com/Gazler/cloneme to `my_cloned_repo`."
solution do
repo("my_cloned_repo").commit("157b2b61f29ab9df45f31c7cd9cb5d8ff06ecde4")

tag_to_be_pushed

repo.git.tag({'f' => true}, "tag_to_be_pushed")

@duianto
Copy link
Contributor Author

duianto commented Feb 13, 2019

The find_old_branch level has 4 branches:

blowup_sun_for_ransom
cure_common_cold
kill_the_batman
solve_world_hunger

they seem to be listed here:
https://github.com/Gazler/githug/tree/2544b01546d00165cd7f7059b965be85e1e15006/levels/find_old_branch/.githug/refs/heads

can they be renamed directly or is there some git commands somewhere else that creates them?

@duianto
Copy link
Contributor Author

duianto commented Feb 13, 2019

The conflict level calls the branch mybranch

description "You need to merge mybranch into the current branch (master). But there may be some incorrect changes in mybranch which may cause conflicts. Solve any merge-conflicts you come across and finish the merge."

https://github.com/Gazler/githug/tree/2544b01546d00165cd7f7059b965be85e1e15006/levels/conflict/.githug/refs/heads

Should it be called my-branch to match the other branch names?

@Gazler
Copy link
Owner

Gazler commented Feb 13, 2019

Should repository names and tags also use dashes?

I think that makes sense.

can they be renamed directly or is there some git commands somewhere else that creates them?

They can be renamed directly, the files are a reference to a sha, so should be fine.

Should it be called my-branch to match the other branch names?

Sounds good to me!

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

No branches or pull requests

2 participants