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

"mob start" fails when base branch isn't a local branch #451

Closed
stefanscheidt opened this issue Sep 30, 2024 · 4 comments
Closed

"mob start" fails when base branch isn't a local branch #451

stefanscheidt opened this issue Sep 30, 2024 · 4 comments
Assignees
Labels
bug Something isn't working hacktoberfest

Comments

@stefanscheidt
Copy link
Contributor

I'm not sure if this is a feature or a bug: Let's assume an ensemble works on a task with the base branch some-task. Now a colleague joins, clones the repo, switches immediately to mob/some-task (!) and enters mob s 10. Then he/she will see:

  git fetch origin --prune
ERROR git rev-list --count --left-only refs/heads/some-task...refs/remotes/origin/some-task
ERROR fatal: ambiguous argument 'refs/heads/some-task...refs/remotes/origin/some-task': unknown revision or path not in the working tree.
ERROR Use '--' to separate paths from revisions, like this:
ERROR 'git <command> [<revision>...] -- [<file>...]'
ERROR exit status 128

Of course he/she should have switched to some-task and do a mob s 10 (or probably mob s 10 --join ).
Is the current behaviour intended or could this be improved?

@stefanscheidt
Copy link
Contributor Author

Hi. Sorry, but the above error message is probably misleading. I anonymized a real output, replacing our branch name with some-task. I just found out that base branches with hyphen in there name actually behave differently.

If you provoke the above with a base branch without hyphens in its name, you will get:

❯ git sw mob/basebranchwithouthyphen
branch 'mob/basebranchwithouthyphen' set up to track 'origin/mob/basebranchwithouthyphen'.
Switched to a new branch 'mob/basebranchwithouthyphen'

❯ mob s
  git fetch origin --prune
ERROR git rev-list --count --left-only refs/heads/basebranchwithouthyphen...refs/remotes/origin/basebranchwithouthyphen
ERROR fatal: ambiguous argument 'refs/heads/basebranchwithouthyphen...refs/remotes/origin/basebranchwithouthyphen': unknown revision or path not in the working tree.
ERROR Use '--' to separate paths from revisions, like this:
ERROR 'git <command> [<revision>...] -- [<file>...]'
ERROR exit status 128

If you do the same with a base branch with hyphens in its name, you'll get:

❯ git sw mob/base-branch-with-hyphens
branch 'mob/base-branch-with-hyphens' set up to track 'origin/mob/base-branch-with-hyphens'.
Switched to a new branch 'mob/base-branch-with-hyphens'

❯ mob s
  git fetch origin --prune
ERROR Remote branch origin/base is missing
👉 To start and create the remote branch

  mob start --create

@gregorriegler
Copy link
Collaborator

Good find, thank you @stefanscheidt

@hollesse hollesse added bug Something isn't working hacktoberfest labels Oct 4, 2024
@hollesse hollesse self-assigned this Oct 11, 2024
@hollesse
Copy link
Member

I would like to create another issue for the special case with branch names that contains hyphens. There we have an Issue with the feature of the wip branch qualifier. In my honest opinion this can not be fixed without adjusting behavior there which would be a breaking change. Therefore i would like to decouple these both bugs.

@hollesse
Copy link
Member

see #458 for branch names with hyphens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest
Projects
None yet
Development

No branches or pull requests

3 participants