Re: [PATCH v4 2/6] git-p4: create new function run_git_hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 10, 2020, 22:24 UTC
- Message-ID
- <xmqqr1z2xeq8.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <596b18e5e50a956d9c52ad4a90fab3e6d309d356.1581372376.git.gitgitgadget@gmail.com>
"Ben Keene via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> @@ -2337,12 +2405,15 @@ def run(self, args):
> sys.exit("number of commits (%d) must match number of shelved changelist (%d)" %
> (len(commits), num_shelves))
>
> - hooks_path = gitConfig("core.hooksPath")
> - if len(hooks_path) <= 0:
> - hooks_path = os.path.join(os.environ.get("GIT_DIR", ".git"), "hooks")
> -
> - hook_file = os.path.join(hooks_path, "p4-pre-submit")
> - if os.path.isfile(hook_file) and os.access(hook_file, os.X_OK) and subprocess.call([hook_file]) != 0:
> + try:
> + if not run_git_hook("p4-pre-submit"):
> + print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nYou can skip " \
> + "this pre-submission check by adding\nthe command line option '--no-verify', " \
> + "however,\nthis will also skip the p4-changelist hook as well.")
> + sys.exit(1)
> + except Exception as e:
> + print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\
> + "with the error '{0}'".format(e.message) )
> sys.exit(1)If I am reading the patches correctly, we do not have the "--no-verify" option at this point in the series. Shouldn't this step limit itself to replace the removed lines we see above with just a singlie liner:
if not run_git_hook("p4-pre-submit"):
sys.exit(1)instead?
Also, af the end of these 6-patch series, I do not see a change to guard this part of the code with "if not self.no_verify" like the previous round did.