We now start to get smart about git folders as we understand its simply an invisible folder we can check for.
Handlers
Handlers in model_Git:
--> Git | Init
-
function git_GetInit repoName
-- put the git_Folder of stack projectName into gitFolder
-- put git_GetCheckoutFolder (repoFolder) into repoRootFolder
put git_InvisibleFolder (repoName) into gitInvisibleFolder
return gitInvisibleFolder is not empty
end git_GetInit
command git_SetInit repoFolder
put the defaultfolder into oDefault
set the defaultfolder to repoFolder
--
put git_PathToCommandLine() into gitPath
put gitPath & "git init" into someShell
put shell (someShell) into sResult
--
set the defaultfolder to oDefault
return sResult
end git_SetInit
command git_InitFolder gitRootFolder, pDontAdd
put the defaultfolder into oDefault
set the defaultfolder to gitRootFolder
git_AddIgnore gitRootFolder
git_SetInit repoFolder
put the result into shellResult
lcw_Notify shellResult
get word 1 to 5 of shellResult
if it is not "Initialized empty Git repository in" and it is not "Reinitialized existing Git repository in" then
lcw_Notify shellResult
set the defaultfolder to oDefault
exit to top
end if
if pDontAdd is not true then
git_AddEverything gitRootFolder
put the result into shellResult
if shellResult is not empty then
lcw_Notify shellResult
breakpoint
-- exit to top
end if
end if
-- git_SetRootFolder gitRootFolder
git_AddRootFolderToIndex gitRootFolder
set the defaultfolder to oDefault
return gitRootFolder
end git_InitFolder
command git_AddIgnore gitRootFolder
text_AddTrailing gitRootFolder, slash
put ".DS_Store" into gitIgnoreText
put gitIgnoreText into url ("file:" & gitRootFolder & ".gitignore")
end git_AddIgnore
command git_RemoveDsStore
put "find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch" into someShell
end git_RemoveDsStore