rycus86 / githooks

Githooks: per-repo and global Git hooks with version control
MIT License
382 stars 20 forks source link

Why no write templates when `git hooks update/install` #16

Closed gabyx closed 5 years ago

gabyx commented 5 years ago

Why do you not write the templates

if ! is_single_repo_install; then
        setup_hook_templates || return 1
        echo # For visual separation
fi

when we issue a git hooks update inside a repository? That looks to me that it only replaces the cli tool, which is then out of sync with the templates?? Why is that?

gabyx commented 5 years ago

It not only looks so, it also happens to be so...

gabyx commented 5 years ago

Ok the single flag was set for my repository. I probably do not quite understand this flag. It should be there to only install the templates into this repository? not global, right?

Ok, what I have found out is:

cd Repo
 ./install.sh # chose install into existing press enter -> default "./"
git hooks config print single # not single... (which makes sense)
git hooks update # will only update the global template and asks to install into existing...

Shouldn't we here definitely install the templates into the existing repo, because here it does not ... Shouldn't a git hooks update in a non-single install update its templates...? This is probably a bug...?

gabyx commented 5 years ago

So the Problem is: When install.sh --single is called and a successive git hooks update it replaces the global cli.sh which is newer than the global templates version. Is this really good? Or should the cli.sh be always back-wards compatible to the global installed templates? I would not do this, to complicated =)

rycus86 commented 5 years ago

Yeah, the alias can only be one (not sure if making it local to the repo is possible or if it makes sense). I agree that updating the global cli.sh for a single-repo install might not make sense, so maybe that's an improvement to make.

rycus86 commented 5 years ago

Was your question answered here and can we close this? Or was there something to do here?

gabyx commented 5 years ago

I leave that open, I am still not quite clear about the single-repo install and behavior. I will report back.