| 
     1 #!/bin/sh
    2 
    3 # git branch -D upstream/rewritten-prev upstream/master upstream/rewritten filter-state      
    4 
    5 set -e
    6 
    7 export SCRIPTS=$(dirname $(readlink -f $0))
    8 
    9 export FILTER_BRANCH_SQUELCH_WARNING=1
   10 
   11 UPSTREAM_MASTER=upstream/master
   12 UPSTREAM_REWRITTEN=upstream/dts
   13 
   14 LAST=$(git show-ref -s refs/heads/$UPSTREAM_MASTER||true)
   15 if [ -n "$LAST" ] ; then
   16     RANGE="$LAST..$UPSTREAM_REWRITTEN"
   17 else
   18     # This must be a new conversion...
   19     RANGE="$UPSTREAM_REWRITTEN"
   20 fi
   21 
   22 FETCH_HEAD=$(git rev-parse FETCH_HEAD)
   23 if [ "$LAST" = "$FETCH_HEAD" ] ; then
   24         echo "Nothing new in FETCH_HEAD: $FETCH_HEAD"
   25         exit 0
   26 fi
   27 
   28 rm -f .git/refs/original/refs/heads/${UPSTREAM_REWRITTEN}
   29 
   30 git branch -f $UPSTREAM_REWRITTEN FETCH_HEAD
   31 
   32 git filter-branch --force \
   33         --index-filter ${SCRIPTS}/index-filter.sh \
   34         --msg-filter 'cat && /bin/echo -e "\n[ upstream commit: $GIT_COMMIT ]"' \
   35         --tag-name-filter 'while read t ; do /bin/echo -n $t-dts-raw ; done' \
   36         --parent-filter 'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"' \
   37         --prune-empty --state-branch refs/heads/filter-state \
   38         -- $RANGE
   39 
   40 git branch -f $UPSTREAM_MASTER FETCH_HEAD
Cache object: a5ed9f167df3ff430d9b477f9d703488 
 
 |