Re: Distributed Git not compiled under Cygwin?

2012-01-05 Thread cxira


Jeremy Bopp-3 wrote:
 
 That's not bad, but I don't think you should need start at all.  Yes,
 it will run something in the background, but the chmod command should
 return almost instantly, and it would be good to know if it errors out
 for some reason.  You would lose any way to detect that if you spin it
 off to the background. 
 
 You should also use the cygpath program to convert your paths if
 possible.
I tried it without start and I do see a command prompt. The other thing is,
it won't pause with an error regardless. You make a good point though, so I
tweaked the command. Additionally, I can't believe I didn't know about
cygpath. There are numerous times that would have been tremendously useful.
Now using:

silent execute !start C:\\cygwin\\bin\\run.exe /usr/bin/chmod 0644
\`/usr/bin/cygpath ' . expand(afile) . '`\ 2 ~/.vim/error

Since my .vim folder is under source control, I'll see if the error file
pops up.
-- 
View this message in context: 
http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33084760.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



Re: Distributed Git not compiled under Cygwin?

2012-01-04 Thread Jeremy Bopp
On 12/29/2011 04:31 PM, cxira wrote:
 
 
 Jeremy Bopp-3 wrote:

 Good stuff.  You can avoid the window that pops up by using the run.exe
 program to kick off your chmod command rather than bash.  It's available
 in the run package.

 I think the window is actually cmd.exe since this is a Windows gVim. That
 said, I switched the bash to run and tried the command prompt start (like
  in Unix) and it actually doesn't even appear at all now. Beautiful!
 
 silent execute !start C:\\cygwin\\bin\\run.exe /usr/bin/chmod 0644 ' .
 substitute(expand(afile), ^\\(.\\):/, /cygdrive/\\1/, ) . '

That's not bad, but I don't think you should need start at all.  Yes,
it will run something in the background, but the chmod command should
return almost instantly, and it would be good to know if it errors out
for some reason.  You would lose any way to detect that if you spin it
off to the background.  The run program should do all you need to
ensure that a Windows console doesn't pop up.  I don't have Windows and
gVim available at the moment though, so I can't confirm that.

You should also use the cygpath program to convert your paths if
possible.  Your solution for conversion will fail if you ever work on a
machine with a nonstandard cygdrive prefix.  You probably won't run into
it on your machines, but you may one day share your configuration with
someone who will. :-)

-Jeremy

--
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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread Jeremy Bopp
On 12/29/2011 04:38 AM, cxira wrote:
 
 
 Jeremy Bopp-3 wrote:

 I don't see any way around this except to either build your own Git that
 doesn't include the Cygwin changes or run a git config command to set
 core.filemode after cloning or initializing a repository.  Sorry if I
 got your hopes up.  Hopefully, the Cygwin changes aren't really a
 problem for you.

 Thanks a ton, actually. I appreciate the amount of time you spent looking
 into this. The link you provided answers my question exactly as to why they
 did it this way, as files created within the Cygwin environment adhere to
 the expected permissions. I realize now that my problem is more the
 exception than the rule, as I use the Windows gVim due to the better
 integration, which creates files with incorrect permissions. It seems that
 the best solution would be stick to compiling it myself or perhaps
 investigate to see if I can tweak gVim so that it will save files with the
 correct permissions.

I never had a problem with the native gVim cooperating with Cygwin's Git
(more accurately file permissions) either.  Can you provide more detail
about your situation?  How exactly are the permissions broken, and for
which application(s) are they broken?

-Jeremy

--
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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread cxira


Jeremy Bopp-3 wrote:
 
 I don't see any way around this except to either build your own Git that
 doesn't include the Cygwin changes or run a git config command to set
 core.filemode after cloning or initializing a repository.  Sorry if I
 got your hopes up.  Hopefully, the Cygwin changes aren't really a
 problem for you.
 
Thanks a ton, actually. I appreciate the amount of time you spent looking
into this. The link you provided answers my question exactly as to why they
did it this way, as files created within the Cygwin environment adhere to
the expected permissions. I realize now that my problem is more the
exception than the rule, as I use the Windows gVim due to the better
integration, which creates files with incorrect permissions. It seems that
the best solution would be stick to compiling it myself or perhaps
investigate to see if I can tweak gVim so that it will save files with the
correct permissions.
-- 
View this message in context: 
http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33049604.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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread cxira


Jeremy Bopp-3 wrote:
 I never had a problem with the native gVim cooperating with Cygwin's Git
 (more accurately file permissions) either.  Can you provide more detail
 about your situation?  How exactly are the permissions broken, and for
 which application(s) are they broken?

Here's what I see:
$ gvim temp
:wq
$ ls -al temp
-rwx--+ 1 Doug None 0 Dec 29 15:21 temp

Expected:
$ touch temp2
$ ls -al temp2
-rw-r--r--+ 1 Doug None 0 Dec 29 15:22 temp2

It isn't a problem that causes a conflict with anything, but if I commit
these files to the repository with their file modes as 0700, other people
that use the repository may have problems with them (not to mention the show
in as green executables in ls). I actually pushed these files to an Apache
webserver for production one time and the entire site was not working for a
bit because of that.
-- 
View this message in context: 
http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33052021.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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread Jeremy Bopp
On 12/29/2011 02:28 PM, cxira wrote:
 
 
 Jeremy Bopp-3 wrote:
 I never had a problem with the native gVim cooperating with Cygwin's Git
 (more accurately file permissions) either.  Can you provide more detail
 about your situation?  How exactly are the permissions broken, and for
 which application(s) are they broken?
 
 Here's what I see:
 $ gvim temp
 :wq
 $ ls -al temp
 -rwx--+ 1 Doug None 0 Dec 29 15:21 temp
 
 Expected:
 $ touch temp2
 $ ls -al temp2
 -rw-r--r--+ 1 Doug None 0 Dec 29 15:22 temp2
 
 It isn't a problem that causes a conflict with anything, but if I commit
 these files to the repository with their file modes as 0700, other people
 that use the repository may have problems with them (not to mention the show
 in as green executables in ls). I actually pushed these files to an Apache
 webserver for production one time and the entire site was not working for a
 bit because of that.

The execute bit is the only permission that Git actually records:

http://book.git-scm.com/1_the_git_object_model.html

Unfortunately, it's the only one that's giving you grief here.  You
might try setting the noacl mount option for the Cygwin mount containing
your repository:

http://cygwin.com/cygwin-ug-net/using.html#mount-table

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.

-Jeremy

--
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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread cxira


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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread Jeremy Bopp
On 12/29/2011 03:44 PM, cxira wrote:
 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.

Good stuff.  You can avoid the window that pops up by using the run.exe
program to kick off your chmod command rather than bash.  It's available
in the run package.

-Jeremy

--
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



Re: Distributed Git not compiled under Cygwin?

2011-12-29 Thread cxira


Jeremy Bopp-3 wrote:
 
 Good stuff.  You can avoid the window that pops up by using the run.exe
 program to kick off your chmod command rather than bash.  It's available
 in the run package.
 
I think the window is actually cmd.exe since this is a Windows gVim. That
said, I switched the bash to run and tried the command prompt start (like
 in Unix) and it actually doesn't even appear at all now. Beautiful!

silent execute !start C:\\cygwin\\bin\\run.exe /usr/bin/chmod 0644 ' .
substitute(expand(afile), ^\\(.\\):/, /cygdrive/\\1/, ) . '
-- 
View this message in context: 
http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33052477.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



Distributed Git not compiled under Cygwin?

2011-12-28 Thread cxira

I noticed when using the Git that is distributed under the Cygwin setup (Git
v1.7.5.1-1) that, when creating a new repository, the core.filemode local
setting is set to true. Being under Windows, this should be false because of
how file permissions are handled. I started digging through the Git source,
and found this:

builtin/init-db.c:15
  #ifdef NO_TRUSTABLE_FILEMODE
  #define TEST_FILEMODE 0
  #else
  #define TEST_FILEMODE 1
  #endif

builtin/init-db.c:259
  git_config_set(core.filemode, filemode ? true : false);

This is where Git intelligently sets the filemode setting under a new
project, but it depends on the NO_TRUSTABLE_FILEMODE preprocessor
definition. Looking further, I found it here:

Makefile:936
  ifeq ($(uname_O),Cygwin)
...
NO_TRUSTABLE_FILEMODE = UnfortunatelyYes

So as you can see, if uname -o is equal to Cygwin, it sets this flag which
in turn correctly causes Git to set filemode to false when a new repository
is created. To confirm, I built the source myself under Cygwin, and sure
enough, creating a new repository sets the filemode setting to false. Just
to be clear here, the version of Git that I built is working as intended,
whereas the version of Git that is distributed through the Cygwin setup is
not.

My question is this: Why is the git package that is distributed with Cygwin
not built as I have above? Is there somewhere more formal to submit this to
have it reviewed? I feel it is something important that should be included,
as I'm not a fan of installing 20 dependencies just to build Git correctly
on every system I use Cygwin on.
-- 
View this message in context: 
http://old.nabble.com/Distributed-Git-not-compiled-under-Cygwin--tp33047124p33047124.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



Re: Distributed Git not compiled under Cygwin?

2011-12-28 Thread Jeremy Bopp
On 12/28/2011 03:14 PM, cxira wrote:
 
 I noticed when using the Git that is distributed under the Cygwin setup (Git
 v1.7.5.1-1) that, when creating a new repository, the core.filemode local
 setting is set to true. Being under Windows, this should be false because of
 how file permissions are handled.

While lacking detail, the announcement about that version of Git
mentions that there are some changes included to work around choices
made upstream regarding file permissions management under Cygwin:

http://cygwin.com/ml/cygwin/2011-05/msg00205.html

This is nothing new for Cygwin's Git.  There's a good chance that if you
build from the Git sources distributed via setup.exe rather than the
upstream sources, you will get a Git that behaves the same as the one
shipped by setup.exe.

All that said, I've never run into file permission issues using Cygwin's
Git.  You probably won't either as long as you don't need to host your
repositories on FAT or FAT32 filesystems.

If you would still prefer to have that setting set as per upstream while
avoiding local builds, I believe you can set it as you need in
/etc/gitconfig, and all repositories should inherit that setting unless
the user explicitly overrides it in global or local config settings.

I also remember reading somewhere once that you should be able create a
configuration template that would be used by new repositories created by
git init or git clone that can set the property as you need.  I can't
find any links for that at the moment though. :-/

-Jeremy

--
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



Re: Distributed Git not compiled under Cygwin?

2011-12-28 Thread Jeremy Bopp
On 12/28/2011 03:53 PM, Jeremy Bopp wrote:
 I also remember reading somewhere once that you should be able create a
 configuration template that would be used by new repositories created by
 git init or git clone that can set the property as you need.  I can't
 find any links for that at the moment though. :-/

The manpages for git init and git clone have the information about the
template directory.  See the --template option for both commands.

Sadly, neither this option nor the system-wide /etc/gitconfig file will
work in this case because apparently core.filemode is always set in the
local config for the repository being created as determined by the build
time settings.  This overrides the setting from the template as well as
the system-wide setting in /etc/gitconfig.

I don't see any way around this except to either build your own Git that
doesn't include the Cygwin changes or run a git config command to set
core.filemode after cloning or initializing a repository.  Sorry if I
got your hopes up.  Hopefully, the Cygwin changes aren't really a
problem for you.

-Jeremy

--
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