Skip to content

Conversation

samirnoman
Copy link
Contributor

when we add git-store-meta for the first time to a git repo, we have to issue two seperate commands:

perl git-store-meta.pl --install # this isntalls the hooks but not .git_store_meta
perl git-store # this creates .git_store_meta

If we only install the hooks, the .git_store_meta is not created automatically. Without the file .git_store_meta, the hooks will not do anything.

This might confuse new users, because they may assume that installing the hooks is enough.

There are a few solutions to this:

  1. we can add a new option (such as '--create_store') which will work with --install action
  2. we can make creation of the .git_store_meta automatic with --install (if it does not exist of course) and add (--no-store) if we don't this to happen
  3. add a new action (--init) which will run --install and then --store actions together

I have made a modification to implement the third alternative (add action --init) because I think it's meaning is more intuitive to git users.

TODO: I think it might be a good idea to check if .git_store_meta already exist before overwriting it with --init action; unless --force is in effect (or use another option for that)

@samirnoman
Copy link
Contributor Author

samirnoman commented Jun 24, 2024

After thinking more about it, I think it might be helpful to also add .git_store_meta and commit it the repo using the action --init (need to check that the work-tree is clean).
So, the command perl git-store-meta.pl --init should be equivalent to these:

perl git-store-meta.pl --install
perl git-store-meta.pl --store
git add .git_store_meta
git commit -m 'add .git_store_meta'

I recommend checking if the work tree is clean before executing it, similar to the checks in apply.

I think this is what most users should expect when using --init .

@danny0838
Copy link
Owner

danny0838 commented Jun 24, 2024

As --install is mostly a one-time command for a repo, and --install and --store don't share same options, we don't plan to implementation something like this that further complicates the code and documentation.

init action will run the equivalent of these commands in the following order:

* perl git-store-meta.pl --store
* git add .git_store_meta
* git commit -m 'initialize with git-store-meta.pl @Verion#'
* perl git-store-meta.pl --install

NOTE: installing hooks will be the last step in order to avoid firing pre-commit trigger
@samirnoman
Copy link
Contributor Author

fixed eol

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

Successfully merging this pull request may close these issues.

2 participants