git-phlow
git-phlow copied to clipboard
Support setting default branch in git config
It should be possible to set the name of the integration branch in the normal git config hierarchy. Only if the value is not set, it should default to asking GitHub for its "default branch".
This feature is useful for situations where you are working on e.g. a maintenance branch. It will also be useful for future support of other Git servers that do not have a "default-branch" API endpoint.
This issue probably depends on or relates to #15
@lakruzz Could you leave a comment as to why this was marked as "won't have"? I believe it is a valid use case, but maybe you have good reasons as to why it is not needed.
Even if there is a good reason, it would be good to document it to avoid repeat discussions.
It would be redundant data - your local config file, doesnt know what the default branch is, it can only guess.
If we really want to cache this, we probably need to have a solutuon that covers all calls to the api "can i trust the data i already have?"
Am I misunderstang the feature?
I saw it as a performance optimizing move, but is it more that we want to o override the GitHub setting?
If the phlow is only useable when you have access to GitHub, storing the data in the config file may not be that important, since we have to ask for the default branch anyways? but of course it depends on the use case!?
@lakruzz Yes, you are misunderstanding the feature - or not reading what I wrote.
"This feature is useful for situations where you are working on e.g. a maintenance branch."
According to our Phlow, we want to be able to work the same way when doing maintenance on a maintenance branch. To be able to do this we absolutely need a way to override using the "default branch" as our integration branch.
I suggest that we add the config parameter:
phlow.integrationbranch = <branchname>
In reality I see the configured value the central source of truth and querying the GitHub api to guess the integration branch is just a user friendly convenience method.
Think of it as if we had:
phlow.integrationbranch = query
as the default. Actually adding this "query" as a valid parameter will need some thought as it could cause confusion or ambiguity with a possible actual branch name. This might be solved if we replace query
with something that could not legally be a branch name, but I will have to come back with a good answer to that one.
NOTE: We will also need a way to override the name of the ready branch unless we chose to enforce Claus' naming scheme suggestion where a integration branch must be called