Re: [Request] Git reset should be able to ignore file permissions

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [Request] Git reset should be able to ignore file permissions

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:57:48

Alexander Nestorov [off-list ref] writes:
echo "test" > myfile
chmod 777 myfile
git add myfile && git commit -m "Test" && git push
chmod 775 myfile
git reset --hard origin/master
This doesn't tell what the permissions are in origin/master.

If the last line was "git reset --hard HEAD", then it wouldn't touch
myfile (it's executable in the worktree and in HEAD, so Git doesn't need
to change it). Neither the x bit, nor the ctime or mtime.

If you reset the file to a point where it was not executable, then Git
changes its executable bit, and I don't see why it would do otherwise:
Git tracks the executable bit, so when you say "reset the file to how it
was in this revision", this includes the content and executability.

Reading your message, I don't understand why you need to be able to
ignore the x bit.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [Request] Git reset should be able to ignore file permissions

From: Alexander Nestorov <hidden>
Date: 2016-06-15 22:57:48

Git does preserve file permissions, that is, git is aware of the
permissions you can set with chmod.

I'm not trying to ignore the x bit, what I'm trying to do is make
"git reset" checkout only the files that actually changed instead
of checking out all the files with different permissions than the
ones git thinks they should have.

Said with other word: when you run "git reset", git does a "status"
and checkouts all the files that showed up from the "status".
That's exactly what I'm trying to avoid, as "status" is aware of both
content changes and permissions changes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help