-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply merge conflict handling to decoupled workflow (#154)
this can/should probably be abstracted out with a common file and the differences passed via parameters
- Loading branch information
1 parent
06c308a
commit e5e245f
Showing
1 changed file
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,11 +94,25 @@ for commit in "${commits[@]}"; do | |
fi | ||
echo "Adding $commit:" | ||
git --no-pager log --format=%B -n 1 "$commit" | ||
git cherry-pick -rn -X theirs "$commit" 2>&1 | ||
if ! git cherry-pick -rn -X theirs -m 1 "$commit"; then | ||
echo "Conflict detected in $commit. Checking for deleted files." | ||
conflicted_files=$(git diff --name-only --diff-filter=U) | ||
for file in $conflicted_files; do | ||
if ! git ls-tree -r "$commit" --name-only | grep -q "^$file$"; then | ||
echo "File $file was deleted in the cherry-picked commit. Resolving by keeping the deletion." | ||
git rm "$file" | ||
else | ||
echo "Conflict required manual resolution for $file." | ||
fi | ||
done | ||
|
||
# Stage the changes and continue the cherry-pick | ||
git add -u | ||
git commit --no-edit || echo "No changes to commit. Continuing." | ||
fi | ||
# Product request - single commit per release | ||
# The commit message from the last commit will be used. | ||
git log --format=%B -n 1 "$commit" > /tmp/commit_message | ||
# git commit --amend --no-edit --author='Pantheon Automation <[email protected]>' | ||
done | ||
|
||
echo "Executing decoupledpatch.sh" | ||
|