8 #include "UnicodeUtils.h"
11 #include <sys/types.h>
18 g_Git.StringAppend(&m_FileName,(BYTE*)entry->name,CP_ACP,Big2lit(entry->flags)&CE_NAMEMASK);\
19 this->m_Flags=Big2lit(entry->flags);\
20 this->m_ModifyTime=Big2lit(entry->mtime.sec);\
21 this->m_IndexHash=(char*)(entry->sha1);
23 int CGitIndex::FillData(ondisk_cache_entry
* entry
)
29 int CGitIndex::FillData(ondisk_cache_entry_extended
* entry
)
32 this->m_Flags
|= ((int)Big2lit(entry
->flags2
))<<16;
36 int CGitIndex::Print()
38 _tprintf(_T("0x%08X 0x%08X %s %s\n"),
39 (int)this->m_ModifyTime
,
41 this->m_IndexHash
.ToString(),
47 CGitIndexList::CGitIndexList()
49 this->m_LastModifyTime
=0;
52 int CGitIndexList::ReadIndex(CString IndexFile
)
54 HANDLE hfile
=INVALID_HANDLE_VALUE
;
55 HANDLE hmap
= INVALID_HANDLE_VALUE
;
66 hfile
= CreateFile(IndexFile
,
68 FILE_SHARE_READ
|FILE_SHARE_DELETE
|FILE_SHARE_WRITE
,
71 FILE_ATTRIBUTE_NORMAL
,
75 if(hfile
== INVALID_HANDLE_VALUE
)
81 hmap
= CreateFileMapping(hfile
, NULL
, PAGE_READONLY
,0,0,NULL
);
82 if(hmap
== INVALID_HANDLE_VALUE
)
88 buffer
= (BYTE
*)MapViewOfFile(hmap
,FILE_MAP_READ
,0,0,0);
96 header
= (cache_header
*) buffer
;
98 if( Big2lit(header
->hdr_signature
) != CACHE_SIGNATURE
)
103 p
+= sizeof(cache_header
);
105 int entries
= Big2lit(header
->hdr_entries
);
108 for(int i
=0;i
<entries
;i
++)
110 ondisk_cache_entry
*entry
;
111 ondisk_cache_entry_extended
*entryex
;
112 entry
=(ondisk_cache_entry
*)p
;
113 entryex
=(ondisk_cache_entry_extended
*)p
;
114 int flags
=Big2lit(entry
->flags
);
115 if( flags
& CE_EXTENDED
)
117 GitIndex
.FillData(entryex
);
118 p
+=ondisk_ce_size(entryex
);
121 GitIndex
.FillData(entry
);
122 p
+=ondisk_ce_size(entry
);
125 this->push_back(GitIndex
);
134 UnmapViewOfFile(buffer
);
136 if(hmap
!= INVALID_HANDLE_VALUE
)
139 if(hfile
!= INVALID_HANDLE_VALUE
)
145 int CGitIndexList::GetFileStatus(const CString
&gitdir
,const CString
&path
,git_wc_status_kind
*status
,__int64 time
,FIll_STATUS_CALLBACK callback
,void *pData
, CGitHash
*pHash
)
149 int start
=SearchInSortVector(*this, ((CString
&)path
).GetBuffer(), path
.GetLength());
150 ((CString
&)path
).ReleaseBuffer();
154 *status
= git_wc_status_unversioned
;
166 if( time
== at(index
).m_ModifyTime
)
168 *status
= git_wc_status_normal
;
171 *status
= git_wc_status_modified
;
174 if(at(index
).m_Flags
& CE_STAGEMASK
)
175 *status
= git_wc_status_conflicted
;
176 else if(at(index
).m_Flags
& CE_INTENT_TO_ADD
)
177 *status
= git_wc_status_added
;
180 *pHash
= at(index
).m_IndexHash
;
185 if(callback
&& status
)
186 callback(gitdir
+_T("\\")+path
,*status
,false, pData
);
190 int CGitIndexList::GetStatus(const CString
&gitdir
,const CString
&pathParam
, git_wc_status_kind
*status
,
191 BOOL IsFull
, BOOL IsRecursive
,
192 FIll_STATUS_CALLBACK callback
,void *pData
,
196 git_wc_status_kind dirstatus
= git_wc_status_none
;
199 CString path
= pathParam
;
204 result
= g_Git
.GetFileModifyTime(gitdir
,&time
,&isDir
);
206 result
= g_Git
.GetFileModifyTime( gitdir
+_T("\\")+path
, &time
, &isDir
);
210 *status
= git_wc_status_deleted
;
212 callback(gitdir
+_T("\\")+path
,git_wc_status_deleted
,false, pData
);
220 if( path
.Right(1) != _T("\\"))
223 int len
=path
.GetLength();
225 for(int i
=0;i
<size();i
++)
227 if( at(i
).m_FileName
.GetLength() > len
)
229 if(at(i
).m_FileName
.Left(len
) == path
)
233 *status
= git_wc_status_normal
;
235 callback(gitdir
+_T("\\")+path
,*status
,false, pData
);
240 result
= g_Git
.GetFileModifyTime( gitdir
+_T("\\")+at(i
).m_FileName
, &time
);
244 *status
= git_wc_status_none
;
245 GetFileStatus(gitdir
,at(i
).m_FileName
,status
,time
,callback
,pData
);
246 if( *status
!= git_wc_status_none
)
248 if( dirstatus
== git_wc_status_none
)
250 dirstatus
= git_wc_status_normal
;
252 if( *status
!= git_wc_status_normal
)
254 dirstatus
= git_wc_status_modified
;
263 if( dirstatus
!= git_wc_status_none
)
269 *status
= git_wc_status_unversioned
;
272 callback(gitdir
+_T("\\")+path
,*status
,false, pData
);
278 GetFileStatus(gitdir
,path
,status
,time
,callback
,pData
,pHash
);
284 int CGitIndexFileMap::Check(const CString
&gitdir
, bool *isChanged
)
290 IndexFile
=gitdir
+_T("\\.git\\index");
291 /* Get data associated with "crt_stat.c": */
292 result
= g_Git
.GetFileModifyTime( IndexFile
, &time
);
297 SHARED_INDEX_PTR pIndex
;
298 pIndex
= this->SafeGet(gitdir
);
300 if(pIndex
.get() == NULL
)
306 if(pIndex
->m_LastModifyTime
== time
)
319 int CGitIndexFileMap::LoadIndex(const CString
&gitdir
)
323 SHARED_INDEX_PTR
pIndex(new CGitIndexList
);
325 if(pIndex
->ReadIndex(gitdir
+_T("\\.git\\index")))
328 this->SafeSet(gitdir
,pIndex
);
337 int CGitIndexFileMap::GetFileStatus(const CString
&gitdir
, const CString
&path
, git_wc_status_kind
*status
,BOOL IsFull
, BOOL IsRecursive
,
338 FIll_STATUS_CALLBACK callback
,void *pData
,
340 bool isLoadUpdatedIndex
)
344 CheckAndUpdate(gitdir
, isLoadUpdatedIndex
);
346 SHARED_INDEX_PTR pIndex
= this->SafeGet(gitdir
);
347 if(pIndex
.get() != NULL
)
349 pIndex
->GetStatus(gitdir
,path
,status
,IsFull
,IsRecursive
,callback
,pData
,pHash
);
359 int CGitIndexFileMap::IsUnderVersionControl(const CString
&gitdir
, const CString
&path
, bool isDir
,bool *isVersion
, bool isLoadUpdateIndex
)
369 CString subpath
=path
;
370 subpath
.Replace(_T('\\'), _T('/'));
374 CheckAndUpdate(gitdir
, isLoadUpdateIndex
);
376 SHARED_INDEX_PTR pIndex
= this->SafeGet(gitdir
);
380 *isVersion
= (SearchInSortVector(*pIndex
, subpath
.GetBuffer(), subpath
.GetLength()) >= 0);
390 int CGitHeadFileList::GetPackRef(const CString
&gitdir
)
392 CString PackRef
= gitdir
;
393 PackRef
+= _T("\\.git\\packed-refs");
396 if( g_Git
.GetFileModifyTime(PackRef
, &mtime
))
398 CAutoWriteLock
lock(&this->m_SharedMutex
);
399 //packed refs is not existed
400 this->m_PackRefFile
.Empty();
401 this->m_PackRefMap
.clear();
404 }else if(mtime
== m_LastModifyTimePackRef
)
410 CAutoWriteLock
lock(&this->m_SharedMutex
);
411 this->m_PackRefFile
= PackRef
;
412 this->m_LastModifyTimePackRef
= mtime
;
417 CAutoWriteLock
lock(&this->m_SharedMutex
);
419 this->m_PackRefMap
.clear();
421 HANDLE hfile
= CreateFile(PackRef
,
423 FILE_SHARE_READ
|FILE_SHARE_DELETE
|FILE_SHARE_WRITE
,
426 FILE_ATTRIBUTE_NORMAL
,
430 if(hfile
== INVALID_HANDLE_VALUE
)
436 int filesize
= GetFileSize(hfile
,NULL
);
439 buff
= new char[filesize
];
441 ReadFile(hfile
,buff
,filesize
,&size
,NULL
);
452 for(int i
=0;i
<filesize
;i
++)
458 while(buff
[i
] != '\n')
469 while(buff
[i
] != ' ')
471 hash
.AppendChar(buff
[i
]);
481 while(buff
[i
] != '\n')
483 ref
.AppendChar(buff
[i
]);
493 this->m_PackRefMap
[ref
] = hash
;
503 if( hfile
!= INVALID_HANDLE_VALUE
)
509 int CGitHeadFileList::ReadHeadHash(CString gitdir
)
511 CString HeadFile
= gitdir
;
512 HeadFile
+= _T("\\.git\\HEAD");
515 HANDLE hfile
=INVALID_HANDLE_VALUE
;
516 HANDLE href
= INVALID_HANDLE_VALUE
;
521 m_HeadFile
= HeadFile
;
523 if( g_Git
.GetFileModifyTime(m_HeadFile
,&m_LastModifyTimeHead
))
528 CAutoWriteLock
lock(&this->m_SharedMutex
);
532 hfile
= CreateFile(HeadFile
,
534 FILE_SHARE_READ
|FILE_SHARE_DELETE
|FILE_SHARE_WRITE
,
537 FILE_ATTRIBUTE_NORMAL
,
540 if(hfile
== INVALID_HANDLE_VALUE
)
546 DWORD size
=0,filesize
=0;
547 unsigned char buffer
[40] ;
548 ReadFile(hfile
,buffer
,4,&size
,NULL
);
555 if(strcmp((const char*)buffer
,"ref:") == 0)
557 filesize
= GetFileSize(hfile
,NULL
);
559 unsigned char *p
= (unsigned char*)malloc(filesize
-4);
561 ReadFile(hfile
,p
,filesize
-4,&size
,NULL
);
563 m_HeadRefFile
.Empty();
564 g_Git
.StringAppend(&this->m_HeadRefFile
,p
,CP_ACP
,filesize
-4);
565 CString ref
= this->m_HeadRefFile
;
568 ref
=ref
.Tokenize(_T("\n"),start
);
570 m_HeadRefFile
=gitdir
+_T("\\.git\\")+m_HeadRefFile
.Trim();
571 m_HeadRefFile
.Replace(_T('/'),_T('\\'));
574 if(g_Git
.GetFileModifyTime(m_HeadRefFile
,&time
,NULL
))
576 m_HeadRefFile
.Empty();
577 if( GetPackRef(gitdir
))
582 if(this->m_PackRefMap
.find(ref
) == m_PackRefMap
.end())
587 this ->m_Head
= m_PackRefMap
[ref
];
592 href
= CreateFile(m_HeadRefFile
,
594 FILE_SHARE_READ
|FILE_SHARE_DELETE
|FILE_SHARE_WRITE
,
597 FILE_ATTRIBUTE_NORMAL
,
600 if(href
== INVALID_HANDLE_VALUE
)
602 m_HeadRefFile
.Empty();
604 if( GetPackRef(gitdir
))
610 if(this->m_PackRefMap
.find(ref
) == m_PackRefMap
.end())
615 this ->m_Head
= m_PackRefMap
[ref
];
619 ReadFile(href
,buffer
,40,&size
,NULL
);
625 this->m_Head
.ConvertFromStrA((char*)buffer
);
627 this->m_LastModifyTimeRef
= time
;
631 ReadFile(hfile
,buffer
+4,40-4,&size
,NULL
);
637 m_HeadRefFile
.Empty();
639 this->m_Head
.ConvertFromStrA((char*)buffer
);
647 if(hfile
!= INVALID_HANDLE_VALUE
)
649 if(href
!= INVALID_HANDLE_VALUE
)
655 bool CGitHeadFileList::CheckHeadUpdate()
657 if(this->m_HeadFile
.IsEmpty())
662 if( g_Git
.GetFileModifyTime(m_HeadFile
,&mtime
))
665 if(mtime
!= this->m_LastModifyTimeHead
)
668 if(!this->m_HeadRefFile
.IsEmpty())
670 if(g_Git
.GetFileModifyTime(m_HeadRefFile
,&mtime
))
673 if(mtime
!= this->m_LastModifyTimeRef
)
677 if(!this->m_PackRefFile
.IsEmpty())
679 if(g_Git
.GetFileModifyTime(m_PackRefFile
,&mtime
))
682 if(mtime
!= this->m_LastModifyTimePackRef
)
688 int CGitHeadFileList::ReadTree()
691 if( this->m_Head
.IsEmpty())
696 CAutoLocker
lock(g_Git
.m_critGitDllSec
);
697 CAutoWriteLock
lock1(&this->m_SharedMutex
);
699 if(m_Gitdir
!= g_Git
.m_CurrentDir
)
701 g_Git
.SetCurrentDir(m_Gitdir
);
702 SetCurrentDirectory(g_Git
.m_CurrentDir
);
709 ret
= git_read_tree(this->m_Head
.m_hash
,CGitHeadFileList::CallBack
,this);
720 int CGitHeadFileList::CallBack(const unsigned char *sha1
, const char *base
, int baselen
,
721 const char *pathname
, unsigned mode
, int stage
, void *context
)
723 #define S_IFGITLINK 0160000
725 CGitHeadFileList
*p
= (CGitHeadFileList
*)context
;
728 if( (mode
&S_IFMT
) != S_IFGITLINK
)
729 return READ_TREE_RECURSIVE
;
732 unsigned int cur
= p
->size();
733 p
->resize(p
->size()+1);
734 p
->at(cur
).m_Hash
= (char*)sha1
;
735 p
->at(cur
).m_FileName
.Empty();
738 g_Git
.StringAppend(&p
->at(cur
).m_FileName
,(BYTE
*)base
,CP_ACP
,baselen
);
740 g_Git
.StringAppend(&p
->at(cur
).m_FileName
,(BYTE
*)pathname
,CP_ACP
);
742 //p->at(cur).m_FileName.Replace(_T('/'),_T('\\'));
744 p
->m_Map
[p
->at(cur
).m_FileName
]=cur
;
746 if( (mode
&S_IFMT
) == S_IFGITLINK
)
749 return READ_TREE_RECURSIVE
;
752 int CGitIgnoreItem::FetchIgnoreList(const CString
&projectroot
, const CString
&file
)
754 CAutoWriteLock
lock(&this->m_SharedMutex
);
756 if(this->m_pExcludeList
)
758 free(m_pExcludeList
);
762 this->m_BaseDir
.Empty();
763 if( projectroot
.GetLength() < file
.GetLength())
765 CString base
= file
.Mid(projectroot
.GetLength()+1);
766 base
.Replace(_T('\\'), _T('/'));
767 if(base
!= _T(".git/info/exclude"))
769 int start
=base
.ReverseFind(_T('/'));
772 base
=base
.Left(start
);
773 this->m_BaseDir
= CUnicodeUtils::GetMulti(base
,CP_ACP
) ;
779 if(g_Git
.GetFileModifyTime(file
,&m_LastModifyTime
))
782 if(git_create_exclude_list(&this->m_pExcludeList
))
786 HANDLE hfile
= CreateFile(file
,
788 FILE_SHARE_READ
|FILE_SHARE_DELETE
|FILE_SHARE_WRITE
,
791 FILE_ATTRIBUTE_NORMAL
,
795 if(hfile
== INVALID_HANDLE_VALUE
)
800 DWORD size
=0,filesize
=0;
802 filesize
=GetFileSize(hfile
,NULL
);
804 if(filesize
== INVALID_FILE_SIZE
)
810 BYTE
*buffer
= new BYTE
[filesize
+1];
818 if(! ReadFile( hfile
, buffer
,filesize
,&size
,NULL
) )
821 return GetLastError();
827 for(int i
=0;i
<size
;i
++)
829 if( buffer
[i
] == '\n' || buffer
[i
] =='\r' || i
==(size
-1) )
831 if (buffer
[i
] == '\n' || buffer
[i
] =='\r')
836 if(p
[0] != '#' && p
[0] != 0)
837 git_add_exclude((const char*)p
,
838 this->m_BaseDir
.GetBuffer(),
839 m_BaseDir
.GetLength(),
840 this->m_pExcludeList
);
845 /* Can't free buffer, exluced list will use this buffer*/
852 bool CGitIgnoreList::CheckFileChanged(const CString
&path
)
856 int ret
=g_Git
.GetFileModifyTime(path
, &time
);
858 this->m_SharedMutex
.AcquireShared();
859 bool cacheExist
= (m_Map
.find(path
) != m_Map
.end());
860 this->m_SharedMutex
.ReleaseShared();
862 if (!cacheExist
&& ret
== 0)
864 CAutoWriteLock
lock(&this->m_SharedMutex
);
865 m_Map
[path
].m_LastModifyTime
= 0;
866 m_Map
[path
].m_SharedMutex
.Init();
868 // both cache and file is not exist
869 if( (ret
!= 0) && (!cacheExist
))
872 // file exist but cache miss
873 if( (ret
== 0) && (!cacheExist
))
876 // file not exist but cache exist
877 if( (ret
!= 0) && (cacheExist
))
881 // file exist and cache exist
884 CAutoReadLock
lock(&this->m_SharedMutex
);
885 if( m_Map
[path
].m_LastModifyTime
== time
)
892 bool CGitIgnoreList::CheckIgnoreChanged(const CString
&gitdir
,const CString
&path
)
899 temp
.Replace(_T('/'), _T('\\'));
901 while(!temp
.IsEmpty())
905 if(CGit::GitPathFileExists(temp
))
907 CString gitignore
=temp
;
908 gitignore
+= _T("ignore");
909 if( CheckFileChanged(gitignore
) )
912 temp
+=_T("\\info\\exclude");
914 if( CheckFileChanged(temp
) )
921 if( CheckFileChanged(temp
) )
927 for( i
=temp
.GetLength() -1;i
>=0;i
--)
929 if(temp
[i
] == _T('\\'))
941 int CGitIgnoreList::FetchIgnoreFile(const CString
&gitdir
, const CString
&gitignore
)
943 if(CGit::GitPathFileExists(gitignore
)) //if .gitignore remove, we need remote cache
945 CAutoWriteLock
lock(&this->m_SharedMutex
);
946 if(m_Map
.find(gitignore
) == m_Map
.end())
947 m_Map
[gitignore
].m_SharedMutex
.Init();
949 m_Map
[gitignore
].FetchIgnoreList(gitdir
,gitignore
);
953 CAutoWriteLock
lock(&this->m_SharedMutex
);
954 if(m_Map
.find(gitignore
) != m_Map
.end())
955 m_Map
[gitignore
].m_SharedMutex
.Release();
957 m_Map
.erase(gitignore
);
962 int CGitIgnoreList::LoadAllIgnoreFile(const CString
&gitdir
,const CString
&path
)
970 temp
.Replace(_T('/'), _T('\\'));
972 while(!temp
.IsEmpty())
976 if(CGit::GitPathFileExists(temp
))
978 CString gitignore
= temp
;
979 gitignore
+= _T("ignore");
980 if( CheckFileChanged(gitignore
) )
982 FetchIgnoreFile(gitdir
,gitignore
);
985 temp
+=_T("\\info\\exclude");
987 if( CheckFileChanged(temp
) )
989 return FetchIgnoreFile(gitdir
,temp
);
997 if( CheckFileChanged(temp
) )
999 FetchIgnoreFile(gitdir
,temp
);
1005 for( i
=temp
.GetLength() -1;i
>=0;i
--)
1007 if(temp
[i
] == _T('\\'))
1014 temp
= temp
.Left(i
);
1018 int CGitIgnoreList::GetIgnoreFileChangeTimeList(const CString
&path
, std::vector
<__int64
> &timelist
)
1021 CString ignore
=temp
;
1025 CAutoReadLock
lock(&this->m_SharedMutex
);
1028 ignore
+=_T("\\.gitignore");
1029 std::map
<CString
, CGitIgnoreItem
>::iterator itMap
;
1030 itMap
= m_Map
.find(ignore
);
1031 if(itMap
== m_Map
.end())
1033 timelist
.push_back(0);
1037 timelist
.push_back(itMap
->second
.m_LastModifyTime
);
1041 ignore
+= _T("\\.git\\info\\exclude");
1043 itMap
= m_Map
.find(ignore
);
1044 if(itMap
== m_Map
.end())
1049 timelist
.push_back(itMap
->second
.m_LastModifyTime
);
1054 ignore
+=_T("\\.git");
1056 if(CGit::GitPathFileExists(ignore
))
1059 start
= temp
.ReverseFind(_T('\\'));
1061 temp
=temp
.Left(start
);
1068 bool CGitIgnoreList::IsIgnore(const CString
&path
,const CString
&projectroot
)
1072 str
.Replace(_T('\\'),_T('/'));
1075 ret
= CheckIgnore(path
, projectroot
);
1078 int start
=str
.ReverseFind(_T('/'));
1082 str
=str
.Left(start
);
1083 ret
= CheckIgnore(str
, projectroot
);
1088 int CGitIgnoreList::CheckIgnore(const CString
&path
,const CString
&projectroot
)
1092 CString temp
=projectroot
+_T("\\")+path
;
1093 temp
.Replace(_T('/'), _T('\\'));
1097 patha
= CUnicodeUtils::GetMulti(path
,CP_ACP
) ;
1098 patha
.Replace('\\','/');
1100 if(g_Git
.GetFileModifyTime(temp
,&time
,&dir
))
1109 while(!temp
.IsEmpty())
1112 x
=temp
.ReverseFind(_T('\\'));
1116 temp
+=_T("\\.gitignore");
1120 patha
.Replace('\\', '/');
1121 int pos
=patha
.ReverseFind('/');
1122 base
= pos
>=0? patha
.GetBuffer()+pos
+1:patha
.GetBuffer();
1124 CAutoReadLock
lock(&this->m_SharedMutex
);
1126 if(this->m_Map
.find(temp
) == m_Map
.end() )
1133 if(m_Map
[temp
].m_pExcludeList
)
1134 ret
= git_check_excluded_1( patha
, patha
.GetLength(), base
, &type
, m_Map
[temp
].m_pExcludeList
);
1142 temp
= temp
.Left(temp
.GetLength()-11);
1143 temp
+=_T("\\.git\\info\\exclude");
1145 if(this->m_Map
.find(temp
) == m_Map
.end() )
1152 if(m_Map
[temp
].m_pExcludeList
)
1153 ret
= git_check_excluded_1( patha
, patha
.GetLength(), base
, &type
, m_Map
[temp
].m_pExcludeList
);
1162 temp
= temp
.Left(temp
.GetLength()-18);
1168 int CGitHeadFileMap::CheckHeadUpdate(const CString
&gitdir
)
1170 m_SharedMutex
.AcquireShared();
1171 if( find(gitdir
) == end())
1173 m_SharedMutex
.ReleaseShared();
1174 m_SharedMutex
.AcquireExclusive();
1175 (*this)[gitdir
].m_LastModifyTimeRef
= 0; /* Insert new item*/
1176 (*this)[gitdir
].m_SharedMutex
.Init();
1177 m_SharedMutex
.ReleaseExclusive();
1180 m_SharedMutex
.ReleaseShared();
1183 m_SharedMutex
.AcquireShared();
1184 int ret
= (*this)[gitdir
].CheckHeadUpdate();
1185 m_SharedMutex
.ReleaseShared();
1190 int CGitHeadFileMap::GetHeadHash(const CString
&gitdir
, CGitHash
&hash
)
1192 if(CheckHeadUpdate(gitdir
))
1194 CAutoReadLock(&this->m_SharedMutex
);
1195 (*this)[gitdir
].ReadHeadHash(gitdir
);
1199 CAutoReadLock(&this->m_SharedMutex
);
1200 hash
= (*this)[gitdir
].m_Head
;
1206 int CGitStatus::GetStatus(const CString
&gitdir
, const CString
&path
, git_wc_status_kind
*status
, BOOL IsFull
, BOOL IsRecursive
, FIll_STATUS_CALLBACK callback
, void *pData
)
1212 git_wc_status_kind dirstatus
= git_wc_status_none
;
1215 g_Git
.GetFileModifyTime(path
,&time
,&dir
);
1223 result
= _tstat64( gitdir
, &buf
);
1225 result
= _tstat64( gitdir
+_T("\\")+path
, &buf
);
1230 if(buf
.st_mode
& _S_IFDIR
)
1234 if( path
.Right(1) != _T("\\"))
1237 int len
=path
.GetLength();
1239 for(int i
=0;i
<size();i
++)
1241 if( at(i
).m_FileName
.GetLength() > len
)
1243 if(at(i
).m_FileName
.Left(len
) == path
)
1247 *status
= git_wc_status_normal
;
1249 callback(gitdir
+_T("\\")+path
,*status
,pData
);
1254 result
= _tstat64( gitdir
+_T("\\")+at(i
).m_FileName
, &buf
);
1258 *status
= git_wc_status_none
;
1259 GetFileStatus(gitdir
,at(i
).m_FileName
,status
,buf
,callback
,pData
);
1260 if( *status
!= git_wc_status_none
)
1262 if( dirstatus
== git_wc_status_none
)
1264 dirstatus
= git_wc_status_normal
;
1266 if( *status
!= git_wc_status_normal
)
1268 dirstatus
= git_wc_status_modified
;
1277 if( dirstatus
!= git_wc_status_none
)
1279 *status
= dirstatus
;
1283 *status
= git_wc_status_unversioned
;
1286 callback(gitdir
+_T("\\")+path
,*status
,pData
);
1292 GetFileStatus(gitdir
,path
,status
,buf
,callback
,pData
);