mirror of
				https://git.suyu.dev/suyu/suyu.git
				synced 2025-11-04 12:34:39 +08:00 
			
		
		
		
	force no-tab/trailing spaces with git hook
Remove unneeded stuff from pre-commit script The check against an empty commit was not needed (it is only a security for the 1st commit after git init). It could also possibly pose problems because of the redirection to /dev/null on some windows systems. newline at EOF & fixed indent
This commit is contained in:
		
							parent
							
								
									513f6a277e
								
							
						
					
					
						commit
						85183a702a
					
				
							
								
								
									
										2
									
								
								.gitconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitconfig
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
[core]
 | 
			
		||||
    whitespace = blank-at-eol,trailing-space,tab-in-indent
 | 
			
		||||
@ -4,6 +4,13 @@ cmake_minimum_required(VERSION 2.8.11)
 | 
			
		||||
 | 
			
		||||
project(citra)
 | 
			
		||||
 | 
			
		||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
 | 
			
		||||
    message(STATUS "Copying pre-commit hook")
 | 
			
		||||
    file(COPY hooks/pre-commit
 | 
			
		||||
        DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks
 | 
			
		||||
        FILE_PERMISSIONS WORLD_EXECUTE )
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if (NOT MSVC)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
 | 
			
		||||
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								hooks/pre-commit
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								hooks/pre-commit
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
#check the config, in case the user really wants to allow tabs...
 | 
			
		||||
allowtabs=$(git config hooks.allowtabs)
 | 
			
		||||
if [ "$allowtabs" != "true" ] &&
 | 
			
		||||
   git diff --cached | egrep '^\+.*	'
 | 
			
		||||
then
 | 
			
		||||
   cat<<END;
 | 
			
		||||
Error: This commit would contain a tab, which is against this repo's policy.
 | 
			
		||||
END
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# If there are whitespace errors, print the offending file names and fail.
 | 
			
		||||
if
 | 
			
		||||
# Use git built-in checks for trailing whitespaces
 | 
			
		||||
    ! git diff --check --cached
 | 
			
		||||
then
 | 
			
		||||
   cat<<END;
 | 
			
		||||
Error: This commit would contain trailing spaces, which is against this repo's policy.
 | 
			
		||||
END
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user