mkottman / lua-git

An attempt to implement the basics of Git in pure Lua
40 stars 10 forks source link

Directory to which refs should be written doesn't exist on Windows #7

Closed mnicky closed 11 years ago

mnicky commented 11 years ago

When running this test on Windows, I was getting:

C:\luadist\_install\>bin\lua.exe ..\test_fetch.lua
Counting objects: 32, done.
Compressing objects: 100% (32/32), done.
Total 32 (delta 4), reused 23 (delta 0)
bin\lua.exe: ..._install\bin\..\lib\lua\git\protocol.lua:119: C:\tmp\test.git/refs/heads/master: No such file or directory
stack traceback:
        [C]: in function 'assert'
        ..._install\bin\..\lib\lua\git\protocol.lua:119: in function 'git_fetch'
        ..._install\bin\..\lib\lua\git\protocol.lua:132: in function 'fetch'
        ..\..\..\test_fetch.lua:8: in main chunk
        [C]: ?

The problem is caused probably by c990394 where the path separator / is used and the directory (in which the file that's about to be opened should be located) isn't created before. I don't know why the latter doesn't cause error also on Linux though...

I'm also adding the Windows test file for future use...