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

User scenarios .phlow #209

Closed
5 of 7 tasks
lakruzz opened this issue Aug 26, 2017 · 4 comments
Closed
5 of 7 tasks

User scenarios .phlow #209

lakruzz opened this issue Aug 26, 2017 · 4 comments

Comments

@lakruzz
Copy link
Contributor

lakruzz commented Aug 26, 2017

Here's how I would like to see the desired behaviour of our .phlow files

  • must be a valid git config file

Currently we're using underscores in some of our key names - that is not compliant

  • all properties that can be set from the .phlow file must have program defined defaults

  • all program defaults should work against GitHub and GitHub issues

  • all defaults must be configurable on machine level (system) user level (global) and repository level (.phlow in repo root)

Currently we're not git config file compliant

  • All phlow settings shall be part of the git config query system

Eample

git config --get phlow.remote

Currently the .phlow file in the repo is queried directly by git-phlow program.

The .phlow should be renamed to .gitconfig in order to adapt to conventions - and can be included in the standard git query by the following command (assuming it's made compliant prior to this step):

git config --local include.path ../.gitconfig

This is results in the following include clause in the repos /.git/config file:

[include]
	path = ../.gitconfig
  • the phlow shall be able to run (using program defaults) even if none of the three configuration levels are defined

Example: only if the git config... query in the example above returns a non-zero error coder shall program defaults be used.

Currently .phlow is required in the repo

  • the local .phlow file shall not be created automatically.

Currently it's created if it doesn't exist

@lakruzz
Copy link
Contributor Author

lakruzz commented Aug 27, 2017

Solution

It appears that including the local (repo) level is what seems to be causing the challenge here.

But there seem to exist a viable and generally accepted solution.

In the following examples it's assumed that the content of .phlow is made compliant so the current settings :

[default]
  remote                 = origin
  service                = github
  integration_branch     = master
  issue_url              = https://api.github.com
  delivery_branch_prefix = ready

are changed to

[phlow]
  remote                 = origin
  service                = github
  integration-branch     = master
  issue-url              = https://api.github.com
  delivery-branch-prefix = ready
  1. The section default is changed to `phlow``
  2. All underscores _ are changed to dashes `-``

Actually since these are all default values they could all be removed.

Example - Changing a setting on a global scope

This can be done using git config:

image

The first query fails - but after it's set - it's valid. The information is persisted in the ~/.gitconfig which now contains

[phlow]
	...
        ...
	service = bitbucket

Example - Changing a setting on a local scope

The local scope is read from the individual repo's config file: .git/configbut this file is purely local - it's not involved in clone/push/pull operations. so it will have to be persisted somewhere else.

Ideally in a .gitconfig file that resides in the root of the repo:

The following command

git config --file .gitconfig --replace-all phlow.integration-branch gh-pages

will result in the following configuration being written to a .gitconfig file

[phlow]
	integration-branch = gh-pages

it then can be included in the local git configuration like this:

 git config --local --add include.path ../.gitconfig

We still have one slight inconvenience to overcome using this approach; the local config file .git/config is created when we clone it's never cloned. so Either:

  1. Users must be instructed to run git config --local --add include.path ../.gitconfig
  2. We should include the operation automatically:
[ -e .gitconfig ] && git config --local --replace-all include.path ../.gitconfig

@lakruzz
Copy link
Contributor Author

lakruzz commented Aug 27, 2017

Note on writing to the local .gitconfigfile

To ensure that this is stored in a .gitconfig file in the root of the repo we must either

  1. Change directory to the repo root before execution
  2. include the repo root to the path
cd `git rev-parse --show-toplevel`
git config --file .gitconfig --add phlow.integration-branch gh-pages

or

git config --file `git rev-parse --show-toplevel`.gitconfig --add phlow.integration-branch gh-pages

@groenborg
Copy link
Collaborator

@lakruzz Do we want a config command with git phlow that can bootstrap a new configuration file if the user wants, and a command that enables the user to see a configuration without having to look through .gitconfig files?

e.g.

Bootstrap

git phlow config bootstrap

creates a new .gitconfig with a default configuration for the user to change

Show config

git phlow config show jira

prints the Jira configuration to the terminal

@lakruzz
Copy link
Contributor Author

lakruzz commented Sep 27, 2017

@groenborg

Don't we just want to implement the (missing) git config switch?

git config --repo ...

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

No branches or pull requests

4 participants