summaryrefslogtreecommitdiff
path: root/bin/git-landed
blob: 420d6ac7d572e581b86fd7fcca8a86550ea527e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash 
 
# shows the commit that "landed" a branch on HEAD 
# 
#  git landed $commit-on-branch [ $head-to-land-on ] [ git-log options ] 
 
declare -a revs
declare -a flags
 
for p in "$@"; do
    if [[ $p =~ ^- ]]; then
        flags+=( "$p" )
    else
        revs+=( "$p" )
    fi
done
 
there="${revs[0]:?need a commitish}"
here="${revs[1]:-HEAD}"
 
git log "$here" ^"$there" --ancestry-path --merges --reverse -z "${flags[@]}" \
    | head -z -n 1