3 // Windows GIT wrapper (under msysgit)
\r
5 // This is NOT a full git API, it only exposes a few helper functions that
\r
6 // third party windows apps might find useful, to avoid having to parse
\r
7 // console output from the command-line tools.
\r
9 // Make sure wingit.dll is placed in the bin directory of the msysgit installation.
\r
11 // Created by Georg Fischer
\r
16 #define WG_VERSION "0.1.6"
\r
19 #define DLLIMPORT __declspec(dllimport) __stdcall
\r
20 #define DLLEXPORT __declspec(dllexport) __stdcall
\r
22 #ifdef WINGIT_EXPORTS
\r
23 #define WINGIT_API DLLEXPORT
\r
24 #else // GAME_EXPORTS
\r
25 #define WINGIT_API DLLIMPORT
\r
26 #endif // GAME_EXPORTS
\r
33 // Flags for wgEnumFiles
\r
34 enum WGENUMFILEFLAGS
\r
36 WGEFF_NoRecurse = (1<<0), // only enumerate files directly in the specified path
\r
37 WGEFF_FullPath = (1<<1), // enumerated filenames are specified with full path (instead of relative to proj root)
\r
38 WGEFF_DirStatusDelta= (1<<2), // include directories, in enumeration, that have a recursive status != WGFS_Normal (may have a slightly better performance than WGEFF_DirStatusAll)
\r
39 WGEFF_DirStatusAll = (1<<3), // include directories, in enumeration, with recursive status
\r
40 WGEFF_EmptyAsNormal = (1<<4), // report sub-directories, with no versioned files, as WGFS_Normal instead of WGFS_Empty
\r
41 WGEFF_SingleFile = (1<<5) // indicates that the status of a single file or dir, specified by pszSubPath, is wanted
\r
44 // NOTE: Special behavior for directories when specifying WGEFF_SingleFile:
\r
46 // * when combined with WGEFF_SingleFile the returned status will only reflect the immediate files in the dir,
\r
47 // NOT the recusrive status of immediate sub-dirs
\r
48 // * unlike a normal enumeration where the project root dir always is returned as WGFS_Normal regardless
\r
49 // of WGEFF_EmptyAsNormal, the project root will return WGFS_Empty if no immediate versioned files
\r
50 // unless WGEFF_EmptyAsNormal is specified
\r
51 // * WGEFF_DirStatusDelta and WGEFF_DirStatusAll are ignored and can be omitted even for dirs
\r
69 WGFF_Directory = (1<<0) // enumerated file is a directory
\r
75 const char *sFileName; // filename or directory relative to project root (using forward slashes)
\r
76 int nStatus; // the WGFILESTATUS of the file
\r
77 int nStage; // the stage number of the file (0 if unstaged)
\r
78 int nFlags; // a combination of WGFILEFLAGS
\r
80 const BYTE* sha1; // points to the BYTE[20] sha1 (NULL for directories, WGFF_Directory)
\r
84 // Application-defined callback function for wgEnumFiles, returns TRUE to abort enumeration
\r
85 // NOTE: do NOT store the pFile pointer or any pointers in wgFile_s for later use, the data is only valid for a single callback call
\r
86 typedef BOOL (__cdecl WGENUMFILECB)(const struct wgFile_s *pFile, void *pUserData);
\r
89 // Init git framework
\r
90 BOOL WINGIT_API wgInit(void);
\r
92 // Get the lib version
\r
93 LPCSTR WINGIT_API wgGetVersion(void);
\r
95 // Get the git version that is used in this lib
\r
96 LPCSTR WINGIT_API wgGetGitVersion(void);
\r
98 // Enumerate files in a git project
\r
99 // Ex: wgEnumFiles("C:\\Projects\\MyProject", "src/core", WGEFF_NoRecurse, MyEnumFunc, NULL)
\r
100 BOOL WINGIT_API wgEnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);
\r
102 // Get the SHA1 of pszName (NULL is same as "HEAD", "HEAD^" etc. expression allowed), returns NULL on failure
\r
103 // NOTE: do not store returned pointer for later used, data must be used/copied right away before further wg calls
\r
104 LPBYTE WINGIT_API wgGetRevisionID(const char *pszProjectPath, const char *pszName);
\r