I could not find a source for the magic z40 in the .git/hooks/pre-push.sample file. A quick google search threw up this.
z40 is a regular expression matching the empty blob/commit/tree
SHA: “0000000000000000000000000000000000000000”. found here https://github.com/git-lfs/git-lfs/blob/master/git/rev_list_scanner.go
Hopefully somebody can comment and let me know of a more detailed explanation.