在git中显示索引文件的权限 [英] Show the permission of a indexed file in git

查看:115
本文介绍了在git中显示索引文件的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与我最近询问的有关存储非裸存储库的另一个问题有关Dropbox ,以便在计算机之间轻松移动,所以它可能会有助于阅读该问题的背景。



要点是, fileMode 不断报告一些文件的差异。我无法找到一贯的方式重现它,但它经常发生。我注意到的是,在两台机器上拥有644权限的文件通常在其中一台机器上报告755的差异。这让我觉得Git认为可执行位已经设置好了,但我无法弄清楚我是否可以实际看到 Git如何设置该位。

解决方案

要查看git在提交和索引中实际考虑的文件,请使用 git ls-tree< tree> git ls-files -s

只查看可执行位,并假设 644 用于其他任何事情。查看 cache.h中的create_ce_mode if你想尝试调试这个奇怪的问题。


This is related to another question I recently asked about storing a non-bare repository in Dropbox for easy movement between computers, so it may be helpful to read that question for background.

The gist is that the fileMode keeps reporting a diff for some number of files. I can't find a way to reproduce it consistently, but it happens frequently. What I've noticed is that the file, which has 644 permissions on both machines often reports a diff from 755 on one of the machines. This makes me think that Git believes the executable bit is set, but I can't figure out whether I can actually see how Git has that bit set.

解决方案

To see what git actually thinks about your files in commits and the index, use git ls-tree <tree> and git ls-files -s <path> respectively.

By the way, it seems that git only looks at the executable bit, and assumes 644 for everything else. Look at create_ce_mode in cache.h if you want to try debugging this weird issue.

这篇关于在git中显示索引文件的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆