Solution of GIT Commit History Divergence due to case-sensitive renaming operations Papers in systems nice about dynamic conservatism


This post is usually a hint of itself because I have already solved this, but have no notes. I also hope that the publication on my website could save a few minutes or hours in the future.

Brief summary

If your commit history has fall-sensitive renaming operations and you run around with history, you may need to change the value of git config core.ignorecase. If git ignores the case and you have a case sensitively in history, the commit will not be properly preserved (in my case a renaming became a deletion) and the history will deviate.

You can use:

git config core.ignorecase

If trueYou can use the case sensitivity to the repository with:

git config core.ignorecase false

You could use something like git-filter-repoWhat sets ignorecase=false When performing his operations. In my case I got together git-filter-repo Code and had deactivated this for some reason that I didn’t record.

Problem background

We switched to a model of Develop development code in a monorepo, but divided specific sub -projects for distribution in independent repository. If we would like to publish new changes to an independent repository, we filter out the commit history in order to only record the desired directory tree, to rewrite the file path and to restore disabled commitment signatures. If we have done it right, we can create the original source tree perfectly and move new commits.

After I had set up a new computer, I noticed that I was able to do this “split-and-push” ornament for most repositories, but for one (one (), but (one () (a (a (a (a (one)libc) Leaned my pressure due to a deviation in history.

The difference in the fortress history

I have the separation to a certain commit (with the help of git merge-base HEAD libc/master) what gave me the last common commit. Then I looked at the following commit in both trees to recognize the difference.

The original repository/history has the following commit:

commit 25dc8b01274beeb8f530f43d5e39c3bf5cdf82f4
Author: Phillip Johnston <[email protected]>
Date:   Mon Jul 8 12:15:39 2019 -0700

    Rename crt0.S to address build failure when case-sensitive filenames are used

    Damn you, OS X.

diff --git a/arch/arm/src/crt0.s b/arch/arm/src/crt0.S
similarity index 100%
rename from arch/arm/src/crt0.s
rename to arch/arm/src/crt0.S

After rewriting the Monorepo story for publication libc Changes (with core.ignorecase == true), the commit has changed to a deletion:

commit 251baeaef2e64217f7b012bf355f6c3d42d9ad39
Author: Phillip Johnston <[email protected]>
Date:   Mon Jul 8 12:15:39 2019 -0700

    Rename crt0.S to address build failure when case-sensitive filenames are used

    Damn you, OS X.

diff --git a/arch/arm/src/crt0.s b/arch/arm/src/crt0.s
deleted file mode 100644
index 5a24cd4fca..0000000000
--- a/arch/arm/src/crt0.s
+++ /dev/null
@@ -1,276 +0,0 @@
-/* Check for targets supporting only Thumb instructions (eg. ARMv6-M) or
-   supporting Thumb-2 instructions, since ARM instructions may not be available */
-#if __thumb2__ || (__thumb__ && !__ARM_ARCH_ISA_ARM)
-# define PREFER_THUMB
-#endif
-
-/* Identify processors only capable of executing Thumb-1 instructions.  */
-#if __ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM

And so we deviate in history.

The solution

I had to define them core.ignorecase Configuration option too false Return the commit status for the repository and carry out the process of history again. This correctly reproduced the complete fortress history, and I was able to successfully advance changes.

One thing I note is that this setting is automatically used when creating or cloning a repository on case-inensitive file systems. This option was determined in my original repository, but a fresh clone had restored the option.

Core.ignorecase

Internal variable with which various problems enable git in file systems that are not sensitive, such as APFs, Hfs+, FAT, NTFS etc., for example when a directory list finds “makefile” when git “makefile” awaits, git, git, GIT is expected to assume that it is really the same file and continues to remember as a “make -free”.

The standard is wrong, except that Git clone (1) or Git-init (1) Addiction and sets Core.ignecase True if necessary when the repository is created.

Git is based on the correct configuration of these variables for your operating and file system. Change this value can lead to unexpected behavior.

References



Source link