Skip to content

x/review/git-codereview: change -n still writes the hooks without announcing #73314

@abitrolly

Description

@abitrolly

According to usage, -n should not result in any changes to repository.

The -n flag prints commands that would make changes but does not run them.

But that's not the case for hooks.

➜ .git/hooks/pre-commit
➜ ls -la .git/hooks/pre-commit
ls: cannot access '.git/hooks/pre-commit': No such file or directory
➜ ~/go/bin/git-codereview change -n
git-codereview: warning: unstaged changes and no staged changes; use 'git add' or 'git change -a'
git commit -q --allow-empty
git-codereview: change updated.
➜ ls -la .git/hooks/pre-commit
-rwx------. 1 anatoli anatoli 58 Apr 10 18:00 .git/hooks/pre-commit

Then my repo becomes broken, because git-codereview does not exist in PATH.

I expect hook handler to report what they are doing and respect -n flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions