Fix post-receive-email test for USER_EMAIL variable.
[git-central.git] / scripts / gc-remerge
1 #!/bin/sh
2
3 git rev-list --first-parent "origin/stable..HEAD" | while read commit ; do
4         number_of_parents=$(git rev-list -n 1 --parents $commit | sed 's/ /\n/g' | grep -v $commit | wc -l)
5         if [[ $number_of_parents > 1 ]] ; then
6                 # For each parent
7                 git rev-list --no-walk --parents $commit | sed 's/ /\n/g' | grep -v $commit | while read parent ; do
8                         echo "merge=$commit parent=$parent"
9                         # Does this parent have any children besides us?
10                         #
11                         # List the parents of all branch commits (after stable/parent), find
12                         # those that include our parent, get their sha1, remove our merge
13                         git rev-list --parents --branches ^stable "^$parent" | grep $parent | gawk '{print $1}' | grep -v $commit | while read child ; do
14                                 echo "child $child"
15                                 git rev-list "$child" "^$commit"
16                         done
17                         # Find any commits in the parent (and another branch) but not us--that means we need it
18                         # number_missing=$(git rev-list "$parent" --branches "^HEAD" | wc -l)
19                         # if [[ $number_missing > 0 ]] ; then
20                         #       git rev-list "$parent" --branches "^HEAD" | xargs git name-rev
21                         # fi
22                 done
23         fi
24 done
25