What's cooking (2021/06 #06)
[git] / KO
1 #!/bin/sh
2 #
3 # Not for general consumption; a script I used to make sure
4 # I do not accidentally push a rewound master to public.
5
6 MASTER=master
7
8 no_fetch= ko=ko
9 while :
10 do
11         case "$#,$1" in
12         0,*) break ;;
13         *,--no-fetch) no_fetch=t; shift ;;
14         *,--*) echo >&2 "unknown option $1"; exit 1 ;;
15         *) ko=$1; shift ;;
16         esac
17 done
18
19 if test -z "$no_fetch"
20 then
21         git fetch "$ko"
22 fi
23
24 mb=$(git merge-base $ko/$MASTER $MASTER)
25 h=$(git rev-parse $mb $ko/$MASTER | sort -u | wc -l)
26 if test "$h" != 1
27 then
28         echo "OOOOOPPPPPPPPPPPPPPSSS! $MASTER is not $ko/$MASTER fast forward."
29         exit 1
30 fi
31 git show-branch --topo-order $ko/$MASTER $MASTER
32 git show-branch --topo-order $ko/maint maint
33 git show-branch --topo-order $ko/next next
34 git show-branch --topo-order $ko/seen seen