[PATCH] D80978: Add a git hook script that can be manually setup to run some checks on every push

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 00:29:31 PDT 2020


mehdi_amini added a comment.

In D80978#2103899 <https://reviews.llvm.org/D80978#2103899>, @MaskRay wrote:

> Without `git pull --rebase origin master`, my local `master` branch was stale. This script said:
>
>   % git push origin HEAD:master                                                                                                                   
>   `git rev-list 4171f80d5416eccbeebe8864410d576d7dc61eaa..bb67f1a4400a19318713375655999f733418a33b` returned 128    
>   fatal: Invalid revision range 4171f80d5416eccbeebe8864410d576d7dc61eaa..bb67f1a4400a19318713375655999f733418a33b
>


Thanks for catching this! I think the script should just ignore this case and let git fails. I added the check.



================
Comment at: llvm/utils/git/pre-push.py:137
+
+def program_exists(cmd):
+    if sys.platform == 'win32' and not cmd.endswith('.exe'):
----------------
MaskRay wrote:
> mehdi_amini wrote:
> > mehdi_amini wrote:
> > > MaskRay wrote:
> > > > shutil.which
> > > Does it handle the `.exe` suffix addition here?
> > Seems like it would work, but requires 3.3, not sure if we should require this?
> > 
> > 
> Python 3.4 was released 6 years ago. I think we don't need to care about 3.3 on Windows.
Note: this isn't about windows, using this puts the requirement everywhere


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80978/new/

https://reviews.llvm.org/D80978





More information about the llvm-commits mailing list