免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2460 | 回复: 5
打印 上一主题 下一主题

[其他] git如何跟踪字符文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-02-05 15:29 |只看该作者 |倒序浏览
由于某种原因,我需要使用git跟踪根文件系统,根文件系统里有自己mknod的字符设备文件
但是我发现使用git根本无法跟踪这种文件,请教大家这是为什么,怎么才能跟踪呢?

以下是我自己做的实验:
root@System:/work# mkdir test
root@System:/work# cd test/
root@System:/work/test# git init .
Initialized empty Git repository in /work/dongyulong/test/.git/
root@System:/work/test# mknod char_dev c 1 2
root@System:/work/test# ll
总用量 12
drwxr-xr-x  3 root root 4096  2月  5 15:25 ./
drwxr-xr-x 12 root root 4096  2月  5 15:25 ../
crw-r--r--  1 root root 1, 2  2月  5 15:25 char_dev
drwxr-xr-x  7 root root 4096  2月  5 15:25 .git/
root@System:/work/test# git st
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
root@System:/work/test#

论坛徽章:
0
2 [报告]
发表于 2015-02-05 17:28 |只看该作者
没人帮我啊 大牛们 帮忙分析一下吧

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
3 [报告]
发表于 2015-02-05 19:41 |只看该作者
回复 2# dylasd


    git add呀。

论坛徽章:
0
4 [报告]
发表于 2015-02-06 08:29 |只看该作者
回复 3# Tinnal

add不进去,早就试过了


   

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
5 [报告]
发表于 2015-02-06 21:02 |只看该作者
回复 4# dylasd


   
恩,查了一下,确定加不进去。git只加目录、常规文件、符号文件。

No, Git will not track device files at all (currently). Here's a comment from dir.c, read_directory_recursive (v1.7.8.5) function which is used when you do git add .:

* Read a directory tree. We currently ignore anything but
* directories, regular files and symlinks. That's because git
* doesn't handle them at all yet. Maybe that will change some
* day.
Git tracks contents, not files. So trying to make it track device files doesn't really fit - they don't really have content in a traditional sense.

An approach that would work is to create a script that creates/"installs" the device files your application/project needs (including fifos or whatever else you might need). Git can track that very effectively, and it's a handy form to have that in for an installer (or for other people using your tree).



http://superuser.com/questions/440873/git-unable-add-device-file

论坛徽章:
0
6 [报告]
发表于 2015-02-07 14:07 |只看该作者
回复 5# Tinnal

感谢帮助,曲线救国了,每次打包rootfs的时候用shell脚本mknod
   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP