Skip to content

Instantly share code, notes, and snippets.

@AndrewSmart
Created January 8, 2015 19:19
Show Gist options
  • Save AndrewSmart/5ef45b3cebfc8e4540ab to your computer and use it in GitHub Desktop.
Save AndrewSmart/5ef45b3cebfc8e4540ab to your computer and use it in GitHub Desktop.
Non-interactive test for Issue#15
#!/usr/bin/env bash
set -e
if [ "$1" == 'ReRun' ]; then
set -x
else
$0 ReRun 2>&1 | tee log
exit 0
fi
mkdir -p a b
git init a
git init b
(
cd a
git init
echo "one" >> file
echo "two" >> file
echo "three" >> file
git add file
git commit -m "Add file"
)
(
cd b
git init
echo whatever > file
git add file
git commit -m "First commit"
echo 'whatever 2' > file
git add file
git commit -m "Second commit"
echo 'whatever 3' > file
git add file
git commit -m "third commit"
git subrepo clone ../a sub
echo 'whatever 4' > file
git add file
git commit -m "fourth commit"
## Tell rebase to merge commit 3 into commit 2 ###
GIT_EDITOR=true GIT_SEQUENCE_EDITOR="sed -i -e '2s/^pick/squash/g'" git rebase -i HEAD~4
)
(
cd a
### replace "two" with "two++"
sed -i -e 's/two/two++/g' file
git add file
git commit -m "Update file"
)
(
cd b
git subrepo pull sub/
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment