Skip to content
Snippets Groups Projects
Commit 511ff06e authored by nimrod's avatar nimrod
Browse files

- Fix tests.

- Fix issue when diff is empty.
- Forgot --stdout in patch generation.
- Fix issue when it's the same branch.
parent dee94cb4
Branches
Tags
No related merge requests found
...@@ -4,6 +4,10 @@ set -eu ...@@ -4,6 +4,10 @@ set -eu
dest="${1:-master}" dest="${1:-master}"
current="$(git symbolic-ref --short HEAD)" current="$(git symbolic-ref --short HEAD)"
[ "$current" != "$dest" ] || exit [ "$current" != "$dest" ] || exit 0
git format-patch "$(git merge-base HEAD "$dest")..$dest" --stdout | git apply --check - patch="$(git format-patch "$(git merge-base HEAD "$dest")..$dest" --stdout)"
[ "$patch" != "" ] || exit 0
echo "$patch" | git apply --check -
...@@ -9,16 +9,16 @@ export repo="$BATS_TMPDIR/testrepo" ...@@ -9,16 +9,16 @@ export repo="$BATS_TMPDIR/testrepo"
git init "$repo" git init "$repo"
cd "$repo" cd "$repo"
echo 1 > file echo 1 > file
git -C "$repo" add "$repo/file" git add file
git -C "$repo" commit -m "Initial commit." git commit -m "Initial commit."
git -C "$repo" checkout -b master2 git checkout -b master2
git -C "$repo" checkout -b no-conflict git checkout -b no-conflict
git -C "$repo" checkout -b conflict git checkout -b conflict
echo 2 > "$repo/file" echo 2 > file
git -C "$repo" commit file -m "Conflict with master." git commit file -m "Conflict with master."
git -C "$repo" checkout master git checkout master
echo 3 > "$repo/file" echo 3 > file
git -C "$repo" commit file -m "Conflict with the conflict branch." git commit file -m "Conflict with the conflict branch."
fi fi
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment