Some Unix systems (GuixSD, NixOS) do not install programs like Bash and Python to /usr/bin, and /usr/bin/env has to be used to locate these instead. Change-Id: I7546bcb881c532adc984577ecb0ee2ec4f2efe00 Signed-off-by: Yegor Timoshenko <yegortimoshenko@riseup.net> Reviewed-on: https://review.coreboot.org/28953 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
		
			
				
	
	
		
			14 lines
		
	
	
		
			322 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			322 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| files=`git diff --cached --name-only | grep '\.[ch]$'`
 | |
| if [ -z "$files" ]; then
 | |
| 	exit 0
 | |
| fi
 | |
| # This has to be set here; otherwise a grep error seems to cause
 | |
| # us to exit with non-zero status.
 | |
| set -e
 | |
| clang-format -i $files
 | |
| git add $files
 | |
| u=`git config user.name`
 | |
| m="clang-formatted-by: $u"
 | |
| echo $m >> $1
 |