Coder Social home page Coder Social logo

tawman / git-unite Goto Github PK

View Code? Open in Web Editor NEW
126.0 126.0 18.0 20.59 MB

Git Unite fixes case sensitive file paths present in a git repository index on Windows.

Home Page: http://www.woodcp.com/2013/01/git-unite-fix-case-sensitive-file-paths-on-windows/

License: MIT License

C# 29.85% PowerShell 69.05% Batchfile 1.10%
c-sharp case-folding dotnet git windows

git-unite's People

Contributors

bsilvereagle avatar dsparkplug avatar tawman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

git-unite's Issues

Delete files

After run the tool some files will be deleted.

image

image

image

This is something expected? It is expected that we manually copy again the deleted files in the remaining steps?

Remote: fatal: Error in object '.'

Reported from http://stackoverflow.com/questions/16863012/how-safely-remove-entry-from-git-tree and recreated locally:

C:\demo [master]> C:\@WCP\Git.Unite\src\Git.Unite\bin\Debug\Git.Unite.exe .
C:\demo [master +0 ~1 -0 | +1 ~0 -0 !]> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       renamed:    Where/is/broken -> ./Where/Is/broken
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       Where/Is/broken
C:\demo [master +0 ~1 -0 | +1 ~0 -0 !]> git commit -m "Git.Unite the broken"
[master a17aaf5] Git.Unite the broken
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename {Where/is => ./Where/Is}/broken (100%)
C:\demo [master +1 ~0 -0 !]> git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       Where/Is/broken
nothing added to commit but untracked files present (use "git add" to track)

C:\demo\Where\Is [master +1 ~0 -0 !]> git push
Counting objects: 7, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 379 bytes, done.
Total 5 (delta 1), reused 0 (delta 0)
remote: error: object abe1e80ac153c69aa6a90185737ff9a3e4e77c01:contains '.'
remote: fatal: Error in object
error: unpack failed: index-pack abnormal exit
To [email protected]:tawman/waldo.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '[email protected]:tawman/waldo.git'
C:\demo\Where\Is [master +1 ~0 -0 !]>

Crash: Sequence contains no elements

Any idea what could be causing this? It started doing this when I added it to the path. Tried doing a clean build again but to no avail.

Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at LibGitUnite.GitUnite.UniteFolderCasing(UniteRepository repo, List`1 folders) in c:\Users\TimKist\Documents\GitHub\git-unite\src\LibGitUnite\GitUnite.cs:line 79
   at LibGitUnite.GitUnite.Process(String gitPath, OptionFlags options) in c:\Users\TimKist\Documents\GitHub\git-unite\src\LibGitUnite\GitUnite.cs:line 50
   at Git.Unite.Program.Main(String[] args) in c:\Users\TimKist\Documents\GitHub\git-unite\src\Git.Unite\Program.cs:line 54

Crash on running on git repository in Win 10

Hey! I tried this a few years ago and really helped! Tried using again, but I can't. Executed Git.Unite.exe <git repo>

Compiled OK with some warnings, Running on Windows 10 64-bit.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at LibGit2Sharp.Core.NativeMethods.git_threads_init()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_repository_open(RepositorySafeHandle& repository, FilePath path)
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options)
   at LibGitUnite.UniteRepository..ctor(String path, OptionFlags options) in c:\Users\TimKist\Documents\GitHub\git-unite\src\LibGitUnite\UniteRepository.cs:line 32
   at LibGitUnite.GitUnite.Process(String gitPath, OptionFlags options) in c:\Users\TimKist\Documents\GitHub\git-unite\src\LibGitUnite\GitUnite.cs:line 44
   at Git.Unite.Program.Main(String[] args) in c:\Users\TimKist\Documents\GitHub\git-unite\src\Git.Unite\Program.cs:line 53

partial duplicate paths are not united

The duplicate parent folder path i had was "Infrastructure/Data/Entity/" and "Infrastructure/data/Entity/". The files that were not united were in the folder "Infrastructure/data/Entity/Interceptors/". The "Interceptors/" folder existed only in the parent directory "Infrastructure/data/Entity/", and "Infrastructure/Data/Entity/" did not have an "Interceptors/" folder.

After doing a git mv for a single file from "Infrastructure/data/Entity/Interceptors/" to "Infrastructure/Data/Entity/Interceptors/", Git.Unite then identified and moved the remaining duplicates.

git unite does not work with worktrees

Hey Guys,
I noticed that git-unite does not work with the git worktrees. Please see the screenshot bellow. As you can see I can query the status of repository. But if try to run git unite, it give me an error.

image

exception when building

cloned dir
cd to new dir run build.
get the following:

Custom PowerShell Environment Loaded
psake version 4.6.0
Copyright (c) 2010-2014 James Kovacs & Contributors

Error: 2019-02-19 9:47:02 AM:

  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Assert: Could not find the build file .\default.ps1.
    

Performance improvement

Hi,

I was using this tool to fixup some directory casing problems, IE:
git-unite -d

And found that it was very slow progress. This appears to be due to the code for indexEntries being quite slow, as we've 40-50k files in the index, and paths.

I did a bit of an optimization, and altered the code here:
https://github.com/tawman/git-unite/blob/master/src/LibGitUnite/UniteRepository.cs#L156

To

var indexEntries =
                _gitRepository.Index.Where(f =>
                {
                    var lastSeparator = f.Path.LastIndexOf(CharSeparator);

                    if (lastSeparator == -1)
                        return false;

                    var directoryPath = f.Path.Substring(0, lastSeparator);

                    return !foldersFullPathMap.Any(s => s.Contains(directoryPath));

                    //return f.Path.LastIndexOf(Separator, StringComparison.Ordinal) != -1
                    //       &&
                    //       !foldersFullPathMap.Any(s =>
                    //           s.Contains(f.Path.Substring(0,
                    //               f.Path.LastIndexOf(Separator, StringComparison.Ordinal))));
                });

Note that I also added a CharSeparator:
private const char CharSeparator = '\';

Testing on an i9-9900k with ssd, git-unite 2.1 takes 6m25s

With the above optimizations it takes 2m26s. I did wonder if more can be done, eg make the foldersFullPathMap only have the git paths in, rather than the full path.

Still it's a 50% reduction.

Suggestion: Attach precompiled binaries to releases

Some of us are not able to compile your software as the running of powershell scripts is disabled on our systems, and we don't have the permissions necessary to change it. It would be really handy if you included precompiled binaries on Github's releases page,

Invalid expression term '.', failing to build

Microsoft (R) Build Engine version 4.8.4084.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 21/05/2021 07:12:02.
Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite.sln" on node 1 (build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "DEBUG|Mixed Platforms".
Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite.sln" (1) is building "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite\Gi
t.Unite.Console.csproj" (2) on node 1 (default targets).
RestorePackages:
"C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src.nuget\nuget.exe" install "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite\packages.conf
ig" -source "" -RequireConsent -solutionDir "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\ "
All packages listed in packages.config are already installed.
Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite\Git.Unite.Console.csproj" (2) is building "C:\Users\diede\OneDrive\Documents\Utility\git-unite-ma
ster\src\LibGitUnite\LibGitUnite.csproj" (4) on node 1 (default targets).
RestorePackages:
"C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src.nuget\nuget.exe" install "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\packages.co
nfig" -source "" -RequireConsent -solutionDir "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\ "
All packages listed in packages.config are already installed.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /unsafe+ /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva- /referenc
e:C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\packages\LibGit2Sharp.0.23.1\lib\net40\LibGit2Sharp.dll /reference:"C:\Program Files (x86)\Reference Assemblies
Microsoft\Framework.NETFramework\v4.0\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll" /refere
nce:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framew
ork.NETFramework\v4.0\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.dll" /refere
nce:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.
NETFramework\v4.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Xml.Linq.dll" /debug+ /debug:full /fileal
ign:512 /optimize- /out:obj\Debug\LibGitUnite.dll /resource:C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\packages\LibGit2Sharp.NativeBinaries.1.0.164\build\..
\libgit2\libgit2_hash.txt,LibGitUnite.libgit2_hash.txt /resource:C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\packages\LibGit2Sharp.NativeBinaries.1.0.164\buil
d\..\libgit2\libgit2_filename.txt,LibGitUnite.libgit2_filename.txt /target:library /utf8output OptionFlags.cs Properties\AssemblyInfo.cs UniteRepository.cs "C:\Users\diede\AppD
ata\Local\Temp.NETFramework,Version=v4.0.AssemblyAttributes.cs"
UniteRepository.cs(223,28): error CS1525: Invalid expression term '.' [C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj]
UniteRepository.cs(223,29): error CS1003: Syntax error, ':' expected [C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj]
Done Building Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj" (default targets) -- FAILED.

Done Building Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite\Git.Unite.Console.csproj" (default targets) -- FAILED.

Done Building Project "C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite.sln" (build target(s)) -- FAILED.

Build FAILED.

"C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite.sln" (build target) (1) ->
"C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\Git.Unite\Git.Unite.Console.csproj" (default target) (2) ->
"C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj" (default target) (4) ->
(CoreCompile target) ->
UniteRepository.cs(223,28): error CS1525: Invalid expression term '.' [C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj]
UniteRepository.cs(223,29): error CS1003: Syntax error, ':' expected [C:\Users\diede\OneDrive\Documents\Utility\git-unite-master\src\LibGitUnite\LibGitUnite.csproj]

0 Warning(s)
2 Error(s)

Time Elapsed 00:00:01.33

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.