mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 00:28:52 +02:00 
			
		
		
		
	kbuild: fix scripts/setlocalversion with git
When using trees like wireless-testing, which have untagged tags,
scripts/setlocalversion does not display any git indication for
localversion.
This patch fixes it: If git is available, but no usable tag is found,
it uses -g${head}. It skips the detection of unanottated tags via
git name-rev.
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
			
			
This commit is contained in:
		
							parent
							
								
									99e3a1eb3c
								
							
						
					
					
						commit
						a182ad3d0f
					
				
					 1 changed files with 6 additions and 7 deletions
				
			
		|  | @ -10,13 +10,12 @@ cd "${1:-.}" || usage | ||||||
| 
 | 
 | ||||||
| # Check for git and a git repo. | # Check for git and a git repo. | ||||||
| if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | ||||||
| 	# Do we have an untagged version? | 	# Do we have an untagged tag? | ||||||
| 	if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then | 	if atag=`git describe 2>/dev/null`; then | ||||||
| 		if tag=`git describe 2>/dev/null`; then | 		echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | ||||||
| 			echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | 	# add -g${head}, if there is no usable tag | ||||||
| 		else | 	else | ||||||
| 			printf '%s%s' -g $head | 		printf '%s%s' -g $head | ||||||
| 		fi |  | ||||||
| 	fi | 	fi | ||||||
| 
 | 
 | ||||||
| 	# Is this git on svn? | 	# Is this git on svn? | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Nico Schottelius
						Nico Schottelius