This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Distributed Git not compiled under Cygwin?
Jeremy Bopp-3 wrote:
>
> Another option may be to hack a post-save action into gVim that uses
> Cygwin's chmod command to remove the execute bit from newly saved files:
>
> http://stackoverflow.com/questions/4627701/vim-how-to-execute-automatically-execute-a-shell-command-after-saving-a-file
>
> If all else fails, you could also install the Windows-native build of
> Git and use that instead. Cygwin's gVim may also make sense to use here
> instead of the native one, but I remember you saying that the native
> gVim integrates better for what you do.
>
I moved away from msysgit because it wasn't displaying colors properly in
mintty. As for a vim script, I put together something that executes `chmod
0644` when saving new files only:
" Change permissions on new files to be 0644 in cygwin
augroup filePerms
autocmd!
autocmd BufWritePre * call NewFileTest()
augroup END
function! NewFileTest()
if !filereadable(expand('<afile>'))
" If the file cannot be found pre-write, add a post-write command
autocmd filePerms BufWritePost * call NewFileAlter()
endif
endfunction
function! NewFileAlter()
" Remove command after it is executed once
autocmd! filePerms BufWritePost
" Change permissions
silent execute "!C:\\cygwin\\bin\\bash.exe -c \"/usr/bin/chmod 0644 '" .
substitute(expand("<afile>"), "^\\(.\\):/", "/cygdrive/\\1/", "") . "'\""
endfunction
There's a very brief appearance of the command prompt when I save a new
file, but I think it's a suitable and portable solution. Thanks for the
help.
--
View this message in context: http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33052301.html
Sent from the Cygwin list mailing list archive at Nabble.com.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple