]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-p4: add p4-pre-submit exit text
authorBen Keene <seraphire@gmail.com>
Tue, 11 Feb 2020 18:58:00 +0000 (18:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Feb 2020 20:04:05 +0000 (12:04 -0800)
When the p4-pre-submit exits with a non-zero exit code, the application
will abort the process with no additional information presented to the
user. This can be confusing for new users as it may not be clear that
the p4-pre-submit action caused the error.

Add text to explain why the program aborted the submit action.

Signed-off-by: Ben Keene <seraphire@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py

index 4eccea3fa581601cf8cfeeabb5e43e06ea676136..b1c86678fc602eafbbde353541cb42022ceae849 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -2405,7 +2405,15 @@ class P4Submit(Command, P4UserMap):
             sys.exit("number of commits (%d) must match number of shelved changelist (%d)" %
                      (len(commits), num_shelves))
 
-        if not run_git_hook("p4-pre-submit"):
+        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)
 
         #