a. The evaluation of a tool, how to choose the best tool for one's purpose, and how to make a tool work effectively in a presentation.b. The concept of the markup language, and the experience of thinking in terms of contents and forms.c. How to learn something new from reading technical documents.
a. When preparing a presentation, knowing the resolution of the projector is important. Students prepared their presentation on their laptop with full resolution, but the projector in the classroom could not display the pictures in its entirety.b. Google Earth heavily relies on the internet to load its map data, so it is crucial to have a stable and fast internet in the room. Reserving a computer lab may be a better in this case.c. Google Earth's tour mode is still buggy. Any file operations performed while the tour mode panel is opened will crash Google Earth. Let's hope Google fixes that one some time soon.
And let's say we want to make a change to the function so the system will call our version instead.
Namely, we only want statement 4 to be executed but we'd like to keep statement 1-3 around for future reference.
And now the upstream base of the original code has an update:
Namely, they added statement1.5 and statement 5.
Supposedly, we should get a conflict since the semantics of the code has changed; however, since git deals with only chunks of diffs, and the determination of conflict has to happen onto the same chunk of code, i.e. consecutive lines, git will not see this as conflict waiting to be resolved. It gives us the wrong merge result (suppose we don't want statement 5 in our environment):
Let's look closely at what happened here. First, in MT2, there are two sections that got changed from VERSION MT1, i.e. the addition of statement1.5, and the addition of statement5 are simply two additions. In PSU1, we changed the function name from func to _func, and then inserted brackets and another function name between statement 3 and 4. So from git's point of view, the first chunk of diff is the change of function name (from func to _func. It's independent and will pass the automatic conflict resolution. The second chunk of diff is the insertion of statement 1.5. Same, it's independent and will pass automatic merge. The 3rd chunk is insertion of two brackets and a function name -- independent and will pass check. The 4th chunk is insertion of statement 5 -- independent and will pass check.
There is no way that git will know that we only want statement 4 to be execute and statement 5 is irrelevant to us.
There are two potential solutions:
The first solution is the common standard. Don't do any trick like changing the function name; instead, just delete the original code and write out our target:
git will not resolve the conflict but at least it'll tell us that it can't so we can do it manually. The principle here is: when we have a mod that changes program logic like this, we want to make sure that our mod will create conflict.
The second solution is also about creating intentional conflict. We can comment out the original code and add our mod after that, so it looks like we both added and deleted something and will require manual intervention.
The manual merge will still be a lot of work, but at least git won't create hidden problems that lead to infinite debugging time.
Recent Comments