* Cloned repository has file changes -> bug? @ 2018-01-27 19:35 Filip Jorissen 2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason 2018-01-28 15:28 ` brian m. carlson 0 siblings, 2 replies; 10+ messages in thread From: Filip Jorissen @ 2018-01-27 19:35 UTC (permalink / raw) To: git Dear all, I think our git repository is bugged. The reason why I say this is the following. When cloning the repository, the newly cloned repository immediately has file changes. Steps to reproduce and illustration is at the end of this email. Git checkout does not work to remove the file changes. This behavior seems to be reproducible across multiple computers. Is this a bug? How can I fix the repository? Thanks in advance for the support! Filip MacBook-Pro-van-Filip:git filip$ git clone git@github.com:open-ideas/IDEAS.git Cloning into 'IDEAS'... remote: Counting objects: 48419, done. remote: Compressing objects: 100% (198/198), done. remote: Total 48419 (delta 134), reused 217 (delta 97), pack-reused 48108 Receiving objects: 100% (48419/48419), 42.32 MiB | 1.81 MiB/s, done. Resolving deltas: 100% (32847/32847), done. MacBook-Pro-van-Filip:git filip$ cd IDEAS MacBook-Pro-van-Filip:IDEAS filip$ git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_SaturationPressure.txt no changes added to commit (use "git add" and/or "git commit -a") ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-01-27 19:35 Cloned repository has file changes -> bug? Filip Jorissen @ 2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason 2018-01-28 7:57 ` Torsten Bögershausen 2018-01-28 15:28 ` brian m. carlson 1 sibling, 1 reply; 10+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2018-01-27 19:59 UTC (permalink / raw) To: Filip Jorissen; +Cc: git On Sat, Jan 27 2018, Filip Jorissen jotted: > I think our git repository is bugged. The reason why I say this is the > following. When cloning the repository, the newly cloned repository > immediately has file changes[...]. If you run this: git ls-files | tr '[:upper:]' '[:lower:]' | sort | uniq -D | grep '^' You'll see that the reason is that you have files that differ only in case. You are using a Mac, and Macs by default think that files that are different binary strings are the same file, since they don't consider case to be relevant. The file FOO, foo and FoO and fOo are all the same file as far as your Mac is concerned, but would be 4 different files on Linux. > How can I fix the repository? You could check it out on a OS that considers files that differ in case to be different files, e.g. on Linux, move them around, push it, and new clones should work on your Mac. Alternatively I hear that you can create a loopback case-sensitive FS image on Macs. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason @ 2018-01-28 7:57 ` Torsten Bögershausen 2018-02-06 13:09 ` Filip Jorissen 0 siblings, 1 reply; 10+ messages in thread From: Torsten Bögershausen @ 2018-01-28 7:57 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: Filip Jorissen, git On Sat, Jan 27, 2018 at 08:59:50PM +0100, Ævar Arnfjörð Bjarmason wrote: > > On Sat, Jan 27 2018, Filip Jorissen jotted: > > > I think our git repository is bugged. The reason why I say this is the > > following. When cloning the repository, the newly cloned repository > > immediately has file changes[...]. > > If you run this: > > git ls-files | tr '[:upper:]' '[:lower:]' | sort | uniq -D | grep '^' > > You'll see that the reason is that you have files that differ only in > case. > > You are using a Mac, and Macs by default think that files that are > different binary strings are the same file, since they don't consider > case to be relevant. The file FOO, foo and FoO and fOo are all the same > file as far as your Mac is concerned, but would be 4 different files on > Linux. > > > How can I fix the repository? > > You could check it out on a OS that considers files that differ in case > to be different files, e.g. on Linux, move them around, push it, and new > clones should work on your Mac. > > Alternatively I hear that you can create a loopback case-sensitive FS > image on Macs. You can even fix the repo locally. There are 2 files with uppercase/lowercase collisions. I show you how to fix one off these, the other one goes similar. After that, do a commit and a push and pull request. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt no changes added to commit (use "git add" and/or "git commit -a") user@mac:/tmp/IDEAS> git ls-files -s | grep -i IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt 100644 f56cfcf14aa4b53dfc5ecfb488366f721c94c8e2 0 IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt 100644 e345e1372111d034b4c5a1c75eb791340b93f55e 0 IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt user@mac:/tmp/IDEAS> git mv IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt user@mac:/tmp/IDEAS> git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) renamed: IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt -> IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt user@mac:/tmp/IDEAS> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-01-28 7:57 ` Torsten Bögershausen @ 2018-02-06 13:09 ` Filip Jorissen 2018-02-06 13:19 ` Duy Nguyen 2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason 0 siblings, 2 replies; 10+ messages in thread From: Filip Jorissen @ 2018-02-06 13:09 UTC (permalink / raw) To: Torsten Bögershausen; +Cc: Ævar Arnfjörð Bjarmason, git Hi all, Thank you for your quick responses. I was able to resolve the problem based on your feedback! Based on this experience, I would like to suggest that git is somehow able to avoid these problems by doing a case check itself rather than relying on the host OS for this? Kind regards! Filip > Op 28 jan. 2018, om 08:57 heeft Torsten Bögershausen <tboegi@web.de> het volgende geschreven: > > On Sat, Jan 27, 2018 at 08:59:50PM +0100, Ævar Arnfjörð Bjarmason wrote: >> >> On Sat, Jan 27 2018, Filip Jorissen jotted: >> >>> I think our git repository is bugged. The reason why I say this is the >>> following. When cloning the repository, the newly cloned repository >>> immediately has file changes[...]. >> >> If you run this: >> >> git ls-files | tr '[:upper:]' '[:lower:]' | sort | uniq -D | grep '^' >> >> You'll see that the reason is that you have files that differ only in >> case. >> >> You are using a Mac, and Macs by default think that files that are >> different binary strings are the same file, since they don't consider >> case to be relevant. The file FOO, foo and FoO and fOo are all the same >> file as far as your Mac is concerned, but would be 4 different files on >> Linux. >> >>> How can I fix the repository? >> >> You could check it out on a OS that considers files that differ in case >> to be different files, e.g. on Linux, move them around, push it, and new >> clones should work on your Mac. >> >> Alternatively I hear that you can create a loopback case-sensitive FS >> image on Macs. > > You can even fix the repo locally. > There are 2 files with uppercase/lowercase collisions. > I show you how to fix one off these, the other one goes similar. > After that, do a commit and a push and pull request. > > > > Changes not staged for commit: > (use "git add <file>..." to update what will be committed) > (use "git checkout -- <file>..." to discard changes in working directory) > > modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt > > no changes added to commit (use "git add" and/or "git commit -a") > user@mac:/tmp/IDEAS> git ls-files -s | grep -i IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > 100644 f56cfcf14aa4b53dfc5ecfb488366f721c94c8e2 0 IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > 100644 e345e1372111d034b4c5a1c75eb791340b93f55e 0 IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > user@mac:/tmp/IDEAS> git mv IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt > user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt > user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > user@mac:/tmp/IDEAS> git status > On branch master > Your branch is up to date with 'origin/master'. > > Changes to be committed: > (use "git reset HEAD <file>..." to unstage) > > renamed: IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt -> IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt > > Changes not staged for commit: > (use "git add <file>..." to update what will be committed) > (use "git checkout -- <file>..." to discard changes in working directory) > > modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt > > user@mac:/tmp/IDEAS> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-02-06 13:09 ` Filip Jorissen @ 2018-02-06 13:19 ` Duy Nguyen 2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason 1 sibling, 0 replies; 10+ messages in thread From: Duy Nguyen @ 2018-02-06 13:19 UTC (permalink / raw) To: Filip Jorissen Cc: Torsten Bögershausen, Ævar Arnfjörð Bjarmason, git On Tue, Feb 6, 2018 at 8:09 PM, Filip Jorissen <filip.jorissen@kuleuven.be> wrote: > Hi all, > > Thank you for your quick responses. I was able to resolve the problem based on your feedback! > > Based on this experience, I would like to suggest that git is somehow able to avoid these problems by doing a case check itself rather than relying on the host OS for this? Git itself can't resolve the problem. Case checking is just a side problem. You have two paths, only one of which can be checked out by your OS. How can Git know which one to checkout? Git could pick one at random and hide the other (using sparse checkout, behind the scene). But that can still surprise the user "how come I see this content (of file "AAA") while the other user see another content (of file "aaa")?" I don't see a good solution for this. I think the best we could do is warn earlier at clone time "trouble ahead! Your repository and your OS don't like each other!" so that users won't get puzzled at "git status" later. Would that help? > Kind regards! > > Filip -- Duy ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-02-06 13:09 ` Filip Jorissen 2018-02-06 13:19 ` Duy Nguyen @ 2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason 2018-02-06 14:14 ` Jeff King 1 sibling, 1 reply; 10+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2018-02-06 13:24 UTC (permalink / raw) To: Filip Jorissen; +Cc: Torsten Bögershausen, git On Tue, Feb 06 2018, Filip Jorissen jotted: > Hi all, > > Thank you for your quick responses. I was able to resolve the problem based on your feedback! > > Based on this experience, I would like to suggest that git is somehow able to avoid these problems by doing a case check itself rather than relying on the host OS for this? I think it would make a lot of sense for git to ship with some standard library of hooks for people to enable that covered common cases like that. But it's important to realize that: 1) That's all this would be, this check would just be something you can do via a pre-receive hook now (or in this case, that big hosting providers like Github could offer as a pre-receive hook). 2) Case collisions are just a subset of these issues, if you look at my CACBZZX4qH-w3YevoaW8RXAoFrjpfGerLWpBhetrO2tV-FGr3cQ@mail.gmail.com here on-list you'll see an issue relating to unicode normalizing that triggers a similar problem. 3) Such hooks slow down pushes, especially on big repos, you can optimize things a bit (e.g. only look in the same directories), but pathologically you end up needing to compare the cross-product of changed files v.s. all existing files for each changed file. 4) It's not something hosting providers like Github, Gitlab etc. can just enable, because some people want it like this. There's a lot of repos that have e.g. case collisions or other problems that only manifest on some OS-specific limitation (e.g. paths that are too long for VMS), and none of the users care because they don't use the repo on those systems. So it's not something that can be enabled by default, even for the most common case of case collisions. Right now you're probably best off setting up a CI check on Github that checks whether someone commits a colliding file, and poking Github about maybe providing some opt-in feature to check for this. I think the most performant way of checking this is: git --icase-pathspecs ls-files -- <changed files> Which should never emit more lines than you give to it, you'd run that either for the tip of the push, or if you want to be more thorough for each pushed commit. If someone can think of a better way to check for this I'd love to hear about it, I'll probably add a check like this to some of our internal repos soon. We semi-regularly have Mac users up in arms because someone pushed a case-colliding file on Linux. >> Op 28 jan. 2018, om 08:57 heeft Torsten Bögershausen <tboegi@web.de> het volgende geschreven: >> >> On Sat, Jan 27, 2018 at 08:59:50PM +0100, Ævar Arnfjörð Bjarmason wrote: >>> >>> On Sat, Jan 27 2018, Filip Jorissen jotted: >>> >>>> I think our git repository is bugged. The reason why I say this is the >>>> following. When cloning the repository, the newly cloned repository >>>> immediately has file changes[...]. >>> >>> If you run this: >>> >>> git ls-files | tr '[:upper:]' '[:lower:]' | sort | uniq -D | grep '^' >>> >>> You'll see that the reason is that you have files that differ only in >>> case. >>> >>> You are using a Mac, and Macs by default think that files that are >>> different binary strings are the same file, since they don't consider >>> case to be relevant. The file FOO, foo and FoO and fOo are all the same >>> file as far as your Mac is concerned, but would be 4 different files on >>> Linux. >>> >>>> How can I fix the repository? >>> >>> You could check it out on a OS that considers files that differ in case >>> to be different files, e.g. on Linux, move them around, push it, and new >>> clones should work on your Mac. >>> >>> Alternatively I hear that you can create a loopback case-sensitive FS >>> image on Macs. >> >> You can even fix the repo locally. >> There are 2 files with uppercase/lowercase collisions. >> I show you how to fix one off these, the other one goes similar. >> After that, do a commit and a push and pull request. >> >> >> >> Changes not staged for commit: >> (use "git add <file>..." to update what will be committed) >> (use "git checkout -- <file>..." to discard changes in working directory) >> >> modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt >> modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt >> >> no changes added to commit (use "git add" and/or "git commit -a") >> user@mac:/tmp/IDEAS> git ls-files -s | grep -i IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt >> 100644 f56cfcf14aa4b53dfc5ecfb488366f721c94c8e2 0 IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt >> 100644 e345e1372111d034b4c5a1c75eb791340b93f55e 0 IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt >> user@mac:/tmp/IDEAS> git mv IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt >> user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt >> user@mac:/tmp/IDEAS> git checkout IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt >> user@mac:/tmp/IDEAS> git status >> On branch master >> Your branch is up to date with 'origin/master'. >> >> Changes to be committed: >> (use "git reset HEAD <file>..." to unstage) >> >> renamed: IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt -> IDEAS/Resources/ReferenceResults/Dymola/ideas_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump2.txt >> >> Changes not staged for commit: >> (use "git add <file>..." to update what will be committed) >> (use "git checkout -- <file>..." to discard changes in working directory) >> >> modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_saturationPressure.txt >> >> user@mac:/tmp/IDEAS> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason @ 2018-02-06 14:14 ` Jeff King 2018-02-06 14:30 ` Filip Jorissen 2018-02-06 14:36 ` Junio C Hamano 0 siblings, 2 replies; 10+ messages in thread From: Jeff King @ 2018-02-06 14:14 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason Cc: Filip Jorissen, Torsten Bögershausen, git On Tue, Feb 06, 2018 at 02:24:25PM +0100, Ævar Arnfjörð Bjarmason wrote: > 3) Such hooks slow down pushes, especially on big repos, you can > optimize things a bit (e.g. only look in the same directories), but > pathologically you end up needing to compare the cross-product of > changed files v.s. all existing files for each changed file. I think you could just complain about any tree that contains entries that have duplicate entries after normalization. I.e.: git rev-list --objects $new --not $old | awk '{print $1}' | git cat-file --batch-check='%(objecttype) %(objectname)' | awk '/^tree/ {print $2}'| while read tree; do dups=$(git ls-tree $tree | cut -f 2- | tr A-Z a-z | sort | uniq -d) test -z "$dups" || echo "$tree has duplicates: $dups" done That gives reasonable algorithmic complexity, but of course the shell implementation is horrific. One could imagine that this could be implemented as part of fsck_tree(), though, which is already reading through all the entries (unfortunately it requires auxiliary storage linear with the size of a given tree object, but that's not too bad). But it would probably need: 1. To be enabled as an optional fsck warning, possibly even defaulting to "ignore". 2. That "tr" could be any arbitrary transformation. Case-folding is the obvious one, but in theory you could match the normalization behavior of certain popular filesystems. I'm not entirely convinced it's worth all of this effort, but I think it would be _possible_ at least. -Peff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-02-06 14:14 ` Jeff King @ 2018-02-06 14:30 ` Filip Jorissen 2018-02-06 14:36 ` Junio C Hamano 1 sibling, 0 replies; 10+ messages in thread From: Filip Jorissen @ 2018-02-06 14:30 UTC (permalink / raw) To: Jeff King Cc: Ævar Arnfjörð Bjarmason, Torsten Bögershausen, git I’m not git expert but, from a user point of view, the following would make sense. When adding a file, git could check whether a different file is already in the repository with the same name (case-insensitive check). Then simply report that this may be a mistake and request to use ‘git add -f’ to force the ‘add’. Perhaps this coincides with what was suggested in earlier replies. From my point of view the check should be enabled by default, but it could be optional too. Filip > Op 6 feb. 2018, om 15:14 heeft Jeff King <peff@peff.net> het volgende geschreven: > > On Tue, Feb 06, 2018 at 02:24:25PM +0100, Ævar Arnfjörð Bjarmason wrote: > >> 3) Such hooks slow down pushes, especially on big repos, you can >> optimize things a bit (e.g. only look in the same directories), but >> pathologically you end up needing to compare the cross-product of >> changed files v.s. all existing files for each changed file. > > I think you could just complain about any tree that contains entries > that have duplicate entries after normalization. I.e.: > > git rev-list --objects $new --not $old | > awk '{print $1}' | > git cat-file --batch-check='%(objecttype) %(objectname)' | > awk '/^tree/ {print $2}'| > while read tree; do > dups=$(git ls-tree $tree | cut -f 2- | tr A-Z a-z | sort | uniq -d) > test -z "$dups" || echo "$tree has duplicates: $dups" > done > > That gives reasonable algorithmic complexity, but of course the shell > implementation is horrific. One could imagine that this could be > implemented as part of fsck_tree(), though, which is already reading > through all the entries (unfortunately it requires auxiliary storage > linear with the size of a given tree object, but that's not too bad). > > But it would probably need: > > 1. To be enabled as an optional fsck warning, possibly even defaulting > to "ignore". > > 2. That "tr" could be any arbitrary transformation. Case-folding is > the obvious one, but in theory you could match the normalization > behavior of certain popular filesystems. > > I'm not entirely convinced it's worth all of this effort, but I think it > would be _possible_ at least. > > -Peff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-02-06 14:14 ` Jeff King 2018-02-06 14:30 ` Filip Jorissen @ 2018-02-06 14:36 ` Junio C Hamano 1 sibling, 0 replies; 10+ messages in thread From: Junio C Hamano @ 2018-02-06 14:36 UTC (permalink / raw) To: Jeff King Cc: Ævar Arnfjörð Bjarmason, Filip Jorissen, Torsten Bögershausen, git Jeff King <peff@peff.net> writes: > I'm not entirely convinced it's worth all of this effort, but I think it > would be _possible_ at least. I thought that the original poster wants to have a knob that the project can ask its participants to enable in their clones of the repository that wars this situation when they "git add". When a projects considers that macOS users must dictate the world order because its source must be checked out on case insensitive HFS+, it may be sensible to force participants on other platforms whose filesystem does not guarantee that two paths that "normalize" to the same string will not enter in the project history to spend application cycles to do so instead. That admittedly is quite a macOS centric view, and it is not a very pleasant one, as it means almost all individual _applications_ on other platforms that conceivably could be used to work on a project macOS folks would want to be treated as first-class citizens would need to learn about the peculiar filesystem limitation of one particular platform they otherwise may not necessarily care about. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Cloned repository has file changes -> bug? 2018-01-27 19:35 Cloned repository has file changes -> bug? Filip Jorissen 2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason @ 2018-01-28 15:28 ` brian m. carlson 1 sibling, 0 replies; 10+ messages in thread From: brian m. carlson @ 2018-01-28 15:28 UTC (permalink / raw) To: Filip Jorissen; +Cc: git [-- Attachment #1: Type: text/plain, Size: 1489 bytes --] On Sat, Jan 27, 2018 at 07:35:49PM +0000, Filip Jorissen wrote: > I think our git repository is bugged. The reason why I say this is the following. When cloning the repository, the newly cloned repository immediately has file changes. Steps to reproduce and illustration is at the end of this email. Git checkout does not work to remove the file changes. This behavior seems to be reproducible across multiple computers. Is this a bug? How can I fix the repository? > > Changes not staged for commit: > (use "git add <file>..." to update what will be committed) > (use "git checkout -- <file>..." to discard changes in working directory) > > modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Fluid_HeatExchangers_GroundHeatExchangers_Borefield_Examples_MultipleBoreholesWithHeatPump.txt > modified: IDEAS/Resources/ReferenceResults/Dymola/IDEAS_Utilities_Psychrometrics_Functions_Examples_SaturationPressure.txt This repository has multiple files that differ only in case. I take it from your hostname that you're on a Mac, and by default macOS uses a case-insensitive file system. Since the two files aren't identical, one or the other will show as modified. You probably want to adjust the repository so that it doesn't have files differing only in case or use a case-sensitive file system. -- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 867 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-02-06 14:36 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-01-27 19:35 Cloned repository has file changes -> bug? Filip Jorissen 2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason 2018-01-28 7:57 ` Torsten Bögershausen 2018-02-06 13:09 ` Filip Jorissen 2018-02-06 13:19 ` Duy Nguyen 2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason 2018-02-06 14:14 ` Jeff King 2018-02-06 14:30 ` Filip Jorissen 2018-02-06 14:36 ` Junio C Hamano 2018-01-28 15:28 ` brian m. carlson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).