Automatically remove already merged ones.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 14, 2006 at 18:17 UTC
7442ed29c778e1e1a2f0c1cf0057207d9f319a0c
1 file changed
+23
-3
PU
+23
-3
@@ -3,27 +3,47 @@
3
# Rebuild "pu" from topic branches.
4
#
5
6
-git status && exit
6
+git-update-index --refresh || exit
7
+case "$(git-diff-index --name-status HEAD)" in
8
+'') ;;
9
+*) echo 2>&1 "Local modifications exist."
10
+ exit 1;;
11
+esac
12
git checkout pu &&
13
git reset --hard master &&
14
ORIG_HEAD=`git rev-parse ORIG_HEAD` || exit
15
+LF='
16
+'
17
18
case "$#" in
19
0)
20
# interactive ;-)
21
shift
22
HH=`cd .git/refs/heads && find -type f |
16
- sed -e 's/^\.\///' -e '/^master$/d' -e '/^maint$/d' -e '/^pu$/d'`
23
+ sed -e 's/^\.\///' \
24
+ -e '/^naster$/d' -e '/^master$/d' -e '/^maint$/d' -e '/^pu$/d'`
25
while test "$HH"
26
do
27
I=0
28
echo "0: done"
29
+ NHH=
30
for H in $HH
31
do
32
+ HSHA1=`git-rev-parse --verify $H` || continue
33
+ MB=`git-show-branch --merge-base pu $HSHA1`
34
+ case "$LF$MB$LF" in
35
+ *"$LF$HSHA1$LF"*) continue ;; # already merged.
36
+ esac
37
I=$(($I+1))
38
echo -n "$I: "
25
- git-show-branch --no-current $H
39
+ git-show-branch $H
40
+ NHH="${NHH}$H "
41
done
42
+ case "$I" in
43
+ 0)
44
+ break ;;
45
+ esac
46
+ HH=$NHH
47
echo -n "Merge which ones (0 to finish)? "
48
read ans
49
case "$ans" in