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

x/review: hooks does not re-install hooks #16777

Open
broady opened this issue Aug 17, 2016 · 5 comments

Comments

@broady
Copy link
Member

commented Aug 17, 2016

When calling git-codereview hooks, it shouldn't skip over hook files that already exist.

My GOROOT had the default Gerrit hooks instead of git-codereview's hooks.

installHook probably needs a flag to skip this block of code:

        // If hook file exists, assume it is okay.
        _, err := os.Stat(filename)

Or, we could use file size as a heuristic to re-install the hooks, since we're already statting the file.

@quentinmit quentinmit changed the title git-codereview: hooks does not re-install hooks x/review: hooks does not re-install hooks Sep 6, 2016

@quentinmit

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2016

I don't think overwriting the hooks is a good idea either; the user might have their own hooks that they're not expecting to be overwritten. Perhaps a "-f" to overwrite hooks, and a warning if -f is not supplied?

@quentinmit quentinmit added this to the Unreleased milestone Sep 6, 2016

@agnivade

This comment has been minimized.

Copy link
Member

commented Mar 24, 2019

@josharian for decision

@josharian

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

We shouldn't overwrite existing hooks. That much seems clear.

I'd rather not add more flags and I'd rather not have the tool delete anything; this is rarely used functionality, I suspect, which means the opportunity for latent bugs and data loss is higher.

Perhaps when there are existing hooks, we could print a message like:

There is already a hooks file at %v.
To install git-codereview hooks, delete that file and re-run 'git-codereview hooks'.

Thoughts?

@agnivade

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

SGTM.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 1, 2019

Change https://golang.org/cl/184417 mentions this issue: git-codereview: log message when non-gerrit hooks were detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.