利用者:Frnchfrgg/Transplant/Replace

提供: wiki
移動先: 案内検索
replaced=1

while [[ $replaced = 1 ]]; do

replaced=0

for c in $(git rev-list mybranch --grep "git-svn-id"); do
    git --no-replace-objects merge-base --is-ancestor $c master || continue

    date=$(git show -s $c --format="format:%aD" 2>/dev/null)
    log=$(git show -s $c --format="format:%B" | head -n 1 2>/dev/null)

    [[ -z $date ]] && break
    echo "Found commit: $date - $log"

    other=$(git rev-list -1 blender/master \
                         -F --grep="$log" \
                         --before="$date" \
                         --after="$date")

    [[ -z $other ]] && break
    echo "Found replacement"

    for x in $c $(git rev-list --all \
                         -F --grep="$log" \
                         --before="$date" \
                         --after="$date"); do
        [[ $x == $other ]] || echo "Replacing $x with $other"
        [[ $x == $other ]] || git replace -f $x $other
    done

    replaced=1
    break
done
done