summaryrefslogtreecommitdiff
path: root/bin/git-landed
blob: 78c0e8dd87793e49a304067d71bd561c5074c7c6 (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