-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Make sure the original SP-Forth/4 repository is available as the spf4
remote and it's updated:
git remote -v
git fetch spf4
Or add this remote if it's absent:
git remote add spf4 https://github.com/rufig/spf.git
git fetch spf4
Let the branch spf4.mark
point to the last imported commit in the original spf4 repo, that is available as remotes/spf4/master
.
It can be initially (when the branches are synced) created as:
git branch spf4.mark remotes/spf4/master
Another way is to find the commit id in the remote spf4/master
by the last commit message as:
git pull --ff-only # make sure it's updated
git log -1 --oneline --fixed-strings --grep="$(git log --format=format:'%s' -1)" spf4/master
git branch spf4.mark <commit-id>
The commands to import the new commits from the spf4 original repo are as follows:
# (in the root of the working directory)
# the current branch is master
# just to check:
git status
# fetch new commits (if they were not fetched yet)
git fetch spf4
# import
git format-patch -k --stdout spf4.mark..spf4/master | sed -r 's/\r$//' | iconv --from-code=Windows-1251 --to-code=UTF-8 | git am -k --committer-date-is-author-date
# send to the github server
git push
# If all is right, update the branch `spf4.mark`:
git fetch . spf4/master:spf4.mark
# "." means that the local repository is used as a remote.
NB: If some changed file is already encoded in UTF-8, the iconv
command will produce incorrect patch for the corresponding commit. And then an error will occur on applying this patch. It can be fixed manually as
git format-patch -k --stdout -1 {commit-id} | git apply
git am --continue
Another way is to generate patch separately for each commit and translate encoding via enconv
(that detects the source encoding automatically).
But it does not help if the patch file contains fragments in different encodings.
If git am
has failed due to this problem, with an error message like:
error: patch failed: devel/~micro/AUTOPUSH/interface.f:15
error: devel/~micro/AUTOPUSH/interface.f: patch does not apply
Patch failed at 0018 FAC devel -- refactoring, migration to name tokens API
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
Then the following commands can be also used in the clean working directory:
wiggle --merge --replace --patch .git/rebase-apply/0018 # the number from error message
git diff # ensure that all changes are correctly applied
find . -not -path './.git/*' -type f -name '*.porig' -delete # remove orig copies
git add -a
git am --continue