mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	We record Git details about the merge-base with upstream branches in the zulip-git-version file, if the upstream repository is available. Note that the first Git upgrade after merging the parent commit will not include the merge-base details, since the upstream repository will not have been available. Co-authored-by: Tim Abbott <tabbott@zulip.com> Signed-off-by: Anders Kaseorg <anders@zulip.com>
		
			
				
	
	
		
			14 lines
		
	
	
		
			489 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			489 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
set -eu
 | 
						|
 | 
						|
cd "$(dirname "$0")/.."
 | 
						|
remote="$(git config zulip.zulipRemote)" || remote=upstream
 | 
						|
{
 | 
						|
    git describe --always --tags --match='[0-9]*'
 | 
						|
    branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/master" "refs/remotes/$remote/*.x")"
 | 
						|
    mapfile -t branches <<<"$branches"
 | 
						|
    if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then
 | 
						|
        git describe --always --tags --match='[0-9]*' -- "$merge_base"
 | 
						|
    fi
 | 
						|
} >zulip-git-version
 |