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
Pull from English stream overwrites some translated files like if there weren't conflict #348
Comments
I am working on MY fork, so I have 2 upstreams enstream https://github.com/javascript-tutorial/en.javascript.info.git (fetch) fetch, then merge upstream/master (spanish) merge enstream/master (english) (on my master, dont mind) I am willing to deal with 300+ files... but not this: (task: ok, solution: overwritten) so, merge reset I coudnt help them about cherrypicking from EN, but the job is done so I put myself out of the way. I didnt try "ours", I dont think it would work as git considers there is no conflict to work with I think the difference between task and sol is: task has "new" commits (from where? EN-EN?) and shows conflict in the line commited alone I couldn teach myself more, I couldn't help. |
After looking into the history, I guess git lost track of the content due to renames. That's why it considers the English version to be a full rewrite. P.S. The command to show log with changes and follow renames is: git log -p --follow 1-js/99-js-misc/04-reference-type/3-why-this/solution.md |
We agreed the "guess why"
Still a bug I think, the full rewrite should only be done if they had the same, unchanged seed. So. How to fix. Besides, One time job? Is it a real fix? I dont know how it works. I was trying because future syncs would be far easier to do. |
Surely that's important. And, as we can see, git doesn't help here. We need an alternative mechanism of merging/updating from upstream. |
I'm too new in git... if: one is unchanged, the other is newer (commits ahead), newest wins What gives me hope is the inconsistency of the behavior. sol.md is overwritten, task.md is not. So, bug. I can ask Linus... 🤣🤣🤣 |
@joaquinelio Here's the story. TL;DR: the file was deleted in one commit, and then added independently in the next one, so TL;DR 2: Please make upstream merges in 1 commit, to avoid such a split. TL;DR 3: The recipe is at the end. ======= When Git merges a file, the 3-way merge has 3 sources.
Let's get the merge base: /js/es.javascript.info master ⇣
❯ git merge-base master enstream/master
74e6955587c79199fea1d11af83805efc3e1b657 That's the commit where the Spanish Now let's see what was the file at that time:
Nothing! There was no such file. But Git doesn't give up yet, it tries to find if the file was renamed. If a new file is more than 50% (the number can be configured) similar with an another one that was deleted, then it's considered a rename. So Although here, if we trace the file history, we can find two commits:
That's the command that I used to track it:
My guess is that Here's what it shows in the
That means, it considers the file to be:
RecipeTwo possible ways to fix the situation.
The latter will take both Spanish and English versions into the merged file. Maybe better for I'd suggest to take the 1st way. Thanks for the reading, I hope it helps =) |
That's why you showed me " --follow " sorry I was too dumb to follow. Still hard to get. Could you take a look to the next lines and watch for oddities ? I'll try to stay focused. So: Git lost track because of: Then 240 "regular" conflicted files to fix. In a single merge. After fixing, merges will be safe provided future renames are in the same commit. Then FIX... I want to leave the repo with a short, clean and safe process for EASY updating. Already exists: "pull". I'll skip the weekend to take a breath. Any suggestion... Edit: |
The history is already screwed up by these multi-commit renames. Btw, for git "only name rename" and "path rename" is the same thing - just a rename. Internally, a rename is deletion/creation of a same/very similar file, I guess, if done in 1 commit, git tracks it better. So you can modify the files properly and commit. P.S. Another option is not to use
This shows all the changes, you can integrate them without any merge and be free of git artifacts. Looks like there was no sync for 1.5 years, that's why there are many changes. Many of them are renames/minor fixes though. |
Got that. I just wanted to understand what happened. Knowing the "why" helps to avoid bad things in the future.
You mean to stay this way? Correct me: Magic. I don't get how commit stamps work. I wish I knew before. We were, we are, a hard working team doing our best with what we had. Fixing. |
I'm not sure what kind of "pull magic" you're talking about, that you're going to loose, so I can't answer well enough, sorry.
So what I'm suggesting is that you manually examine the diff, update the Spanish version. Without any merges. |
Sorry if I bother you again,
ever?
new stuff only... from 1,5 years ago and then the same next diff. 1,6 years...
that's important.
I know that, sorry I added the new word
update with the help of the diff, so The real question here is I dont wanna bother you, I just wanted to help. ...The very hard way. |
Try |
Indeed so, rename detection works if the rename can be traced by git. And the line is detected correctly if line spacings are the same. |
oh, the one you suggested not to. : ) |
Yes, we keep line numbers and spacing in translations I need to sleep |
-norename, 406 file changed up today. Can I edit a merge? drop changes (like I could do if they were not from merge but mine)? So the resolve/commit are done on a reduce set of files. To be clear on magic. |
I suppose you could merge partially, e.g. up to the state like 50 commits ago, and then continue merging... Never tried that though. |
That... seems possible. I would never do that with real code. This is just text, no version conflicts expected. |
It worked
Anyway, no matter if PR survives or not, if it doesnt get a review, if it has a review then rejected because it is too bugged... ... the issue is solved. (with --no-rename just once) |
Pulling from English upstream
tries to OVERWRITE SOME traslated files.
No idea why, NO conflicts shown.
I have 3 remotes, origin, upstrem (es) enstream (en)
merge upstream, ok
then
merge enstream, lots of conflicts, ok...
but some files are replaced by english version with no conflict at all
example
D:\js\es.javascript.info\1-js\99-js-misc\04-reference-type\3-why-this\task.md
D:\js\es.javascript.info\1-js\99-js-misc\04-reference-type\3-why-this\solution.md
task.md , ok - (cant remember, either goes staged or shows conflict, but it IS OK).
solution.md - goes straight to the merge like no 3way was there, Spanish is lost.
Can't say way
The text was updated successfully, but these errors were encountered: