mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	/bin/sh and /usr/bin/env are the only two binaries that NixOS provides at a fixed path (outside a buildFHSUserEnv sandbox). This discussion was split from #11004. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
		
			
				
	
	
		
			23 lines
		
	
	
		
			639 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			639 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
# This hook runs gitlint on your commit message.
 | 
						|
 | 
						|
# If your machine contains a provisioned Zulip development environment, the
 | 
						|
# linter will be invoked through `vagrant ssh`.
 | 
						|
 | 
						|
# Do not invoke gitlint if commit message is empty
 | 
						|
if grep -q '^[^#]' "$1"; then
 | 
						|
    lint_cmd="cd ~/zulip && python -m gitlint.cli"
 | 
						|
    if \
 | 
						|
        if [ -z "$VIRTUAL_ENV" ] && command -v vagrant > /dev/null && [ -e .vagrant ]; then
 | 
						|
            ! vagrant ssh -c "$lint_cmd"
 | 
						|
        else
 | 
						|
            ! eval "$lint_cmd"
 | 
						|
        fi < "$1"
 | 
						|
    then
 | 
						|
        echo "WARNING: Your commit message does not match Zulip's style guide."
 | 
						|
    fi
 | 
						|
fi
 | 
						|
 | 
						|
exit 0
 |