# How can I force git to recognize a change change in file modes?

8 messages from 2009-02-28 to 2009-02-28. Participants: Brent Goodrick, Jan Krüger, Lars Noschinski, Jay Soffian, Todd Zullinger.
Thread: https://gitlist.dev/t/18055

## Brent Goodrick, 2009-02-28 01:17

Subject: How can I force git to recognize a change change in file modes?
Message-ID: <e38bce640902271717s46cf47f9i7c6bf5aac0d5f273@mail.gmail.com>
URL: https://gitlist.dev/e/e38bce640902271717s46cf47f9i7c6bf5aac0d5f273%40mail.gmail.com

```
Hi,

I checked in a slew of scripts, only to realize that the file
permissions were too open (I want them to be chmod 700, not chmod
755).  Somehow I thought that git was tracking those permission bits,
but simply using "chmod 700 <fileset>; git add <fileset>" did not add
the change of file modes, well, at least git status output doesn't
show it. Is there a way to do this?

Thanks,
Brent

```

## Lars Noschinski, 2009-02-28 01:25

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <20090228012524.GB17106@lars.home.noschinski.de>
URL: https://gitlist.dev/e/20090228012524.GB17106%40lars.home.noschinski.de
In-Reply-To: <e38bce640902271717s46cf47f9i7c6bf5aac0d5f273@mail.gmail.com>

```
* Brent Goodrick <bgoodr@gmail.com> [09-02-28 02:17]:
> I checked in a slew of scripts, only to realize that the file
> permissions were too open (I want them to be chmod 700, not chmod
> 755).  Somehow I thought that git was tracking those permission bits,
> but simply using "chmod 700 <fileset>; git add <fileset>" did not add
> the change of file modes, well, at least git status output doesn't
> show it. Is there a way to do this?

Git does only track the executable bit.

```

## Jan Krüger, 2009-02-28 03:55

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <20090228045531.14399ebf@perceptron>
URL: https://gitlist.dev/e/20090228045531.14399ebf%40perceptron
In-Reply-To: <e38bce640902271717s46cf47f9i7c6bf5aac0d5f273@mail.gmail.com>

```
Hi,

> I checked in a slew of scripts, only to realize that the file
> permissions were too open (I want them to be chmod 700, not chmod
> 755).  Somehow I thought that git was tracking those permission bits,
> but simply using "chmod 700 <fileset>; git add <fileset>" did not add
> the change of file modes, well, at least git status output doesn't
> show it. Is there a way to do this?

git doesn't track permissions quite that closely; all it remembers is
whether the file should be executable or not.

-Jan

```

## Brent Goodrick, 2009-02-28 16:24

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <e38bce640902280824x3ae41d95qab1f1a450235e096@mail.gmail.com>
URL: https://gitlist.dev/e/e38bce640902280824x3ae41d95qab1f1a450235e096%40mail.gmail.com
In-Reply-To: <20090228045531.14399ebf@perceptron>

```
> git doesn't track permissions quite that closely; all it remembers is
> whether the file should be executable or not.

Thanks Jan.  Was this choice made due to the conditional coding
required to track the permission bits content between *NIX and
non-*NIX platform(s)?

bg

```

## Jay Soffian, 2009-02-28 16:52

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <76718490902280852y2f2657ck7459c138205bb874@mail.gmail.com>
URL: https://gitlist.dev/e/76718490902280852y2f2657ck7459c138205bb874%40mail.gmail.com
In-Reply-To: <e38bce640902280824x3ae41d95qab1f1a450235e096@mail.gmail.com>

```
On Sat, Feb 28, 2009 at 11:24 AM, Brent Goodrick <bgoodr@gmail.com> wrote:
> Thanks Jan.  Was this choice made due to the conditional coding
> required to track the permission bits content between *NIX and
> non-*NIX platform(s)?

The short answer is: because Git was designed to track content. The
long answer is more complicated. Here's one of the more useful past
discussions:

http://thread.gmane.org/gmane.comp.version-control.git/91783

I'm sure you can find others by searching the git list for "metadata".

j.

```

## Brent Goodrick, 2009-02-28 17:34

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <e38bce640902280934u3d9da650ke64865d7149b3c66@mail.gmail.com>
URL: https://gitlist.dev/e/e38bce640902280934u3d9da650ke64865d7149b3c66%40mail.gmail.com
In-Reply-To: <76718490902280852y2f2657ck7459c138205bb874@mail.gmail.com>

```
> The short answer is: because Git was designed to track content. The
> long answer is more complicated. Here's one of the more useful past
> discussions:
>
> http://thread.gmane.org/gmane.comp.version-control.git/91783
>
> I'm sure you can find others by searching the git list for "metadata".

I read that thread you showed above. Sounds like a big squirmy
can-o-worms, and I see that thread died on the vine because of it. :)

All I want to do in my case is just chmod 700 a bunch of scripts after
they are checked out or updated.  I'll need to re-read the git-hooks
man page more closely.

Thanks for your help!
bg

```

## Todd Zullinger, 2009-02-28 18:34

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <20090228183427.GN4505@inocybe.teonanacatl.org>
URL: https://gitlist.dev/e/20090228183427.GN4505%40inocybe.teonanacatl.org
In-Reply-To: <e38bce640902280934u3d9da650ke64865d7149b3c66@mail.gmail.com>

```
Brent Goodrick wrote:
> All I want to do in my case is just chmod 700 a bunch of scripts
> after they are checked out or updated.  I'll need to re-read the
> git-hooks man page more closely.

You may want to check contrib/hooks/setgitperms.perl as well, if you
haven't seen it already.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Problems are opportunity in work clothes.


```

## Brent Goodrick, 2009-02-28 22:43

Subject: Re: How can I force git to recognize a change change in file modes?
Message-ID: <e38bce640902281443x69bd64ebuf4aa784be220b6bb@mail.gmail.com>
URL: https://gitlist.dev/e/e38bce640902281443x69bd64ebuf4aa784be220b6bb%40mail.gmail.com
In-Reply-To: <20090228183427.GN4505@inocybe.teonanacatl.org>

```
On Sat, Feb 28, 2009 at 10:34 AM, Todd Zullinger <tmz@pobox.com> wrote:
> You may want to check contrib/hooks/setgitperms.perl as well, if you
> haven't seen it already.

Yes I did see that. I'll be varying that approach a bit since I won't
need to preserve perm bits before and after the git operation, but
just force them to be a specific value all the time after checkout and
update.

bg

```
