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

Feature request: Option to create unique branch name for a given run #486

Open
1 of 2 tasks
jcmcken opened this issue Jun 15, 2024 · 2 comments
Open
1 of 2 tasks
Labels
enhancement New feature or request

Comments

@jcmcken
Copy link

jcmcken commented Jun 15, 2024

The feature request

Add some option to generate a randomized branch name by default for a given multi-gitter run (where with each run, the branch name would re-randomize) instead of defaulting to a static value.

My use case

Currently, the branch name defaults to a static value. In a larger team, this can cause conflicts and annoying behavior if users forget to pass the branch name. For example, if one person is trying to update repos A,B, and C, and another person is trying to update B,C, and D. If they forget to pass a unique branch name, they can conflict with one another and lead to a situation where person one succeeds, but person two errors on repo B.

(And as a side note, because of #474, the user might not realize that something has errored if they don't carefully examine the output)

It would be nice if this could be something encoded into the config file that team members can pull in as a default. For example, some option that specifies the branch name as multi-gitter-$(openssl rand -hex 5) (i.e. append a 5 byte hex random string to the end).

For example:

randomize-branch: true

Implementation

  • (Tenative) I would like to contribute this feature if it's a suitable addition to multi-gitter
  • I have no intention of adding this feature myself.
@jcmcken jcmcken added the enhancement New feature or request label Jun 15, 2024
@lindell
Copy link
Owner

lindell commented Jun 17, 2024

Thanks for the suggestions, but I don't know if this is a good idea. At least as suggested. There are two reasons.

  1. You can easily do this externally. (As you suggested -B multi-gitter-$(openssl rand -hex 5))
  2. This might not be the only customization. Users might want to append dates, random strings, name of machine running the script, logged in user, etc... All in different formats.

To solve no.2 we might allow for some pre-defined variables to be used in the branch name. Like -B "branch-name-{random}", but I'm still hesitant.

It feels like the root of your problem is a process problem. Rather than a technical one. Forcing people to use an alias like this one:

alias multi-gitter-run='multi-gitter run -B "multi-gitter-$(openssl rand -hex 5)"'

Might as well solve the problem?

@jcmcken
Copy link
Author

jcmcken commented Jun 17, 2024

I thought about that, although it implies the user needs to set up the alias. I suppose the user would also need to use the correct config file if the option existed. Though the benefit would be installing a single config file vs installing a config file and having to edit a bashrc

Another thought I had was to allow environment variable interpolation the config file. Then you could set the branch name to multi-gitter-$USER (or some other env var unique to the user). But I'm not sure if that's too cute. Though as a benefit, it would allow other types of configuration through the environment as well

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

No branches or pull requests

2 participants