2013-10-25 107 views
4

我創建了一個git存儲庫和一個使用libgit2(在C++中)的提交。 它工作正常,但是,結帳破壞所有本地文件。git和libgit:無法創建文件(沒有這樣的文件或目錄)

但是,他們似乎仍然存在於回購協議中。這正是我嘗試查看存儲庫時所得到的結果。

Welcome to Git (version 1.8.3-preview20130601) 


Run 'git help git' to display the help index. 
Run 'git help <command>' to display help for specific commands. 

[email protected] /C/Users/x/Desktop/poiu (master) 
$ git log 
commit a63cd37ef7d7228053b875e396531d367e2ea745 
Author: Unregistered User <[email protected]> 
Date: Fri Oct 25 13:27:21 2013 +0200 

    Project Save 

[email protected] /C/Users/x/Desktop/poiu (master) 
$ git checkout a63cd37ef7d7228053b875e396531d367e2ea745 
D  "db\\32\\879a83081b8d0b4ef41a37b9e28138" 
D  "db\\41\\930644af1f4ab6d288bf3d50829558" 
D  "db\\48\\3172d42be6ccb80e57071d5aabb584" 
D  "db\\80\\0b152a41ba2ef0bc1c55c96add4d33" 
D  "db\\c1\\3b1ce3276ed14d7ff7c6ace9b63cf3" 
D  "db\\fa\\50e29fe380a8117140463106ae67b1" 
Note: checking out 'a63cd37ef7d7228053b875e396531d367e2ea745'. 

You are in 'detached HEAD' state. You can look around, make experimental 
changes and commit them, and you can discard any commits you make in this 
state without impacting any branches by performing another checkout. 

If you want to create a new branch to retain commits you create, you may 
do so (now or later) by using -b with the checkout command again. Example: 

    git checkout -b new_branch_name 

HEAD is now at a63cd37... Project Save 

[email protected] /C/Users/x/Desktop/poiu ((a63cd37...)) 
$ git checkout -f a63cd37ef7d7228053b875e396531d367e2ea745 
error: unable to create file db\32\879a83081b8d0b4ef41a37b9e28138 (No such file or directory) 
error: unable to create file db\41\930644af1f4ab6d288bf3d50829558 (No such file or directory) 
error: unable to create file db\48\3172d42be6ccb80e57071d5aabb584 (No such file or directory) 
error: unable to create file db\80\0b152a41ba2ef0bc1c55c96add4d33 (No such file or directory) 
error: unable to create file db\c1\3b1ce3276ed14d7ff7c6ace9b63cf3 (No such file or directory) 
error: unable to create file db\fa\50e29fe380a8117140463106ae67b1 (No such file or directory) 
HEAD is now at a63cd37... Project Save 

[email protected] /C/Users/x/Desktop/poiu ((a63cd37...)) 
$ 

現在有什麼「奇怪的是,如果我手工創建db \ xx目錄,結帳-f的作品。

即使怪異,整個事情的作品原樣的MacOSX下,但不能在Windows ...

怎麼在這裏上的任何想法?

回答

3
$ git checkout a63cd37ef7d7228053b875e396531d367e2ea745 
D  "db\\32\\879a83081b8d0b4ef41a37b9e28138" 

請查閱報價? git將使用C字符串文字約定來顯示文件名中包含不常用的字符。您的repo記錄一個包含該C字符串的文件作爲其名稱 - 反斜槓。

:\/不到處無效,

$ touch "db\\32\\879a83081b8d0b4ef41a37b9e28138" 
$ ls 
db\32\879a83081b8d0b4ef41a37b9e28138 
$ git add . 
$ git ls-files 
"db\\32\\879a83081b8d0b4ef41a37b9e28138" 
$ 

但他們沒有攜帶。大致來說,Windows文件系統保留\:,Mac,:,Unix,/。可能仍有系統保留;

+0

聽起來像你釘牢它。我可以使用什麼分隔符來提交可在win,mac和linux上移植的gitlib? – Dinaiz

+0

圖書館將正斜槓解釋爲分隔符而不管系統是否正常,unix正在API上做海鰻事情,但我不確定你指的是哪一個,哪一個也不使用(任何?)他們自己,對不起。 – jthill

+0

好吧,我更改了我的代碼,並且您的解決方案能夠正常工作。我現在覺得有點愚蠢......反正,賞金是你的!謝謝 – Dinaiz

1

你可以檢查你是否在MacOSx和Windows在分離頭狀態?

另一個想法是文件系統的差異,也許你可以找到一些相關的東西?

相關問題