danny0838 / git-store-meta

Simple file metadata storing and applying for git.
MIT License
124 stars 19 forks source link

add new action: init which combines --install and --store #50

Open samirnoman opened 3 months ago

samirnoman commented 3 months ago

When adding 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 PR (#46 ) to implement the third alternative (add action --init) because I think it's meaning is more intuitive to git users.

TODO:

samirnoman commented 3 months ago

Actually, after thinking more about it, we also need to add .git_store_meta and commit it to the repo. So, the steps to initialize a repo with git-store-meta.pl for the first time should be similar to this:

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

( these are not implemented yet in PR #46 ) git add .git_store_meta git commit -m 'add .git_store_meta'

So, I recommend implementing the two additional steps (add .git_store_meta & git commit) in the --init action

This way, the action --init will be all that's needed to initialize a git repo