Sha256: a358b14ef47d4986a0286ab2f85ba21ee708d786817de91014d129853ace19dc

Contents?: true

Size: 1.35 KB

Versions: 268

Compression:

Stored size: 1.35 KB

Contents

#!/bin/bash

set -x

# Take some random github repo
repo=${1:-ingydotnet/boolean-pm}

# Delete test dir
rm -fr test-repo

# Clone repo into test dir
git clone "git@github.com:$repo" test-repo

(
  # cd into test-repo
  cd test-repo
  # Tag original head
  git tag o
  # Pick a commit in the middle of the commit history
  S=$(git rev-parse HEAD^^^^)
  # Reset to the middle commit
  git reset --hard $S
  # Tag that history as 'a'
  git tag a
  # Reset to original
  git reset --hard o
  # Take the tail of the history.
  git filter-branch -f --parent-filter "sed 's/-p $S//'" $S..HEAD
  # Mark that sequence as 'b'
  git tag b
  # Reset to a
  git reset --hard a
  # Add a commit
  echo foobar >> README
  git commit README -m 'a change'
  # Tag as a2
  git tag a2
  # Find commits for top of 'a' and root of 'b'
  A=$(git rev-parse a)
  RB=$(git rev-list --max-parents=0 b)
  # Graft them together
  echo "$RB $A" >> .git/info/grafts

  git rebase --abort; git rebase -s recursive -X patience a2 b
#   # Make the graft permanent. ie join head+tail
#   # The commits should rewrite to match original history
#   git filter-branch -f $RB^..b
#   # Get commits for new 'b' and original
#   B=$(git rev-parse b)
#   O=$(git rev-parse o)
#   # Check to see if it works
#   if [ "$B" == "$O" ]; then
#     echo "It worked: $B"
#   else
#     echo "If failed: $B, $O"
#   fi
  bash
)

Version data entries

268 entries across 268 versions & 4 rubygems

Version Path
eac_tools-0.86.5 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.86.4 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.86.3 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_git-0.16.0 vendor/git-subrepo/note/test.sh
eac_tools-0.86.2 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_git-0.15.0 vendor/git-subrepo/note/test.sh
eac_tools-0.84.2 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.84.1 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.84.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.83.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.82.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.81.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.80.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.79.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.78.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.77.1 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.77.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.76.1 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.76.0 sub/eac_git/vendor/git-subrepo/note/test.sh
eac_tools-0.75.2 sub/eac_git/vendor/git-subrepo/note/test.sh