lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] git: committing content and mode changes together


From: Vadim Zeitlin
Subject: Re: [lmi] git: committing content and mode changes together
Date: Fri, 4 Nov 2016 16:30:52 +0100

On Fri, 4 Nov 2016 14:33:00 +0000 Greg Chicares <address@hidden> wrote:

GC> I hesitate to set this:
GC>   git config core.filemode true
GC> because, if that's set, then changing a file's mode really does require
GC> 'update-index --chmod', doesn't it?

 No, "true" is the default and corresponds to the normal git behaviour and
doesn't need to be changed on Unix systems. It is, IME, useful to change it
to "false" when using Cygwin to tell git not to trust the file system
permissions because, as I said, they're really not to be trusted there as
soon as you mix Cygwin and native programs which is more or less
inevitable.

GC> And I hesitate to suggest setting it
GC> for msw (cygwin) only because that would make the same command behave
GC> differently on different systems. Instead, I think the One True Way is
GC> to install a pre-commit hook that validates the mode of every file.

 Yes, having either a pre-commit or update (server-side) hook for checking
for the wrong permissions is definitely useful. I could send you the update
hook I use for this purpose if you'd like to configure it for Savannah
repository.

GC> > GC> but my problem is the opposite: I want to commit them together. What's
GC> > GC> the simple, obvious sequence of steps to do that?
GC> 
GC> It seems that you answered that above:
GC>   change the file's mode with /bin/chmod (not 'update-index --chmod');
GC>   change the file's contents (before or after changing the mode); then
GC>   git commit

 Yes, this is really simple. I appreciate having learnt about update-index
--chmod option because this is useful when (not if) you get into a mess
with the MSW permissions under Cygwin to _avoid_ committing permission
changes with the text changes, otherwise I had to do "git stash", then
"chmod -x" and "git commit" and then "git stash pop", which is definitely
less convenient.

 So even if your experience might have ended being not very useful for you,
it definitely was useful for me, thanks,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]