Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] False positive on merge conflict #12

Open
tony19 opened this issue Jul 22, 2022 · 1 comment
Open

[bug] False positive on merge conflict #12

tony19 opened this issue Jul 22, 2022 · 1 comment

Comments

@tony19
Copy link
Contributor

tony19 commented Jul 22, 2022

Ryu-Cho failed to merge a commit, indicating that there were conflicts:

New commit on head repo: "docs: fix deploy type var (#9290)"
Issue created: https://github.com/tony19/vite-docs-template/issues/18
Conflicts occurred. Please make a pull request by yourself.

However, I was able to cherry-pick the commit without any conflicts.

This also occurred with tony19/vite-docs-template#19, where the cherry-pick was fine.

@tony19
Copy link
Contributor Author

tony19 commented Jul 24, 2022

It seems this can also occur when the cherry-pick contains files that are not present in the target repo. The Ryu-Cho logs don't show the exact error, but running git am locally to cherry-pick the commit from vite reveals this error:

error: could not build fake ancestor

For this instance, the cherry-pick contains a change for packages/vite/src/node/constants.ts, which does not exist in vite-docs-template.

To resolve this manually from the command line, I have to specify git am --include paths for which files to accept during the merge. I created a couple scripts to do this:

  1. Create gitcp.sh:
#!/bin/bash -ex
REPO_DIR=$1
SHA1=$2
GIT_AM_PARMS=${@:3}

git --git-dir=$REPO_DIR/.git \
format-patch -k -1 --stdout $SHA1 | \
git am -3 -k $GIT_AM_PARMS
  1. Create vitedocs-cp.sh:
#!/bin/bash -ex
SHA1=$1
GIT_AM_PARMS=--include=docs/\*\.md
VITE_REPO_DIR=$HOME/src/vite

pushd $VITE_REPO_DIR
git pull origin main
popd

$HOME/bin/gitcp.sh $VITE_REPO_DIR $SHA1 $GIT_AM_PARMS ${@:2}
  1. Use the script, e.g., to cherry-pick b82ee5d from vite to your translations repo:
cd $HOME/src/my-translations-repo
sh vitedocs-cp.sh b82ee5d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant