跳至主要内容

博文

目前显示的是标签为“git”的博文

Fedora 40 on my old laptop

由于去年CentOS RIP的事情,很多企业都改用了另一种发行版。自用的一台老旧的MBP (2012年)已经很久没有更新了,干脆装了Fedora Linux。 时隔多年又安装Fedora,实际上是去年底就用了38,中间升级到了39但是年初的时候不知为何kernel出了问题,grub也没法回退到可用的状态。前几周有时间干脆完全重装了Fedora 40。还刚好试了试 [Ventoy](https://www.ventoy.net/) 的 Multi ISO files 特性,挺好。 ## 已解决的配置 1. Yakuake terminal 习惯了使用快捷键来触发下拉式命令窗口,参考[搜索结果](https://fedoramagazine.org/use-a-drop-down-terminal-for-fast-commands-in-fedora/)试了试 Yakuake 还不错。它还是基于 Kconsole 的,用户不需要做太多改动,直接就可以上手。 2. 倒腾 Git Repo 遇到了小问题 为了速度转移一些 Git Projects,没有逐个 clone,而是直接从另一台笔记本弄了 tar.gz 过去。不知道是不是 MacOS 自带的 tar 命令与 GNU 的水土不服,过去之后,除了一致的额外隐藏文件 (ie .DS_Store) 居然Git还报了另一种问题 “index file is too small”! 仔细查找后总算是找到了[解决方法](https://joemaller.com/1283/git-error-index-file-is-too-small/)。 ``` git config repack.usedeletabaoffset false git repack -a -d ``` 3. 安装一些趁手的工具 `dnf install exa bat ripgrep fzf pass` 配上已有的 dot files 基本解决了问题。这套配置在 MacOS 和 Linux 差别度不大。 4. 外接显示器分辨率的设置 不知为何,外接显示器居然找不到应有的 ratio。参考[一篇博客文章](https://www.wenjinyu.me/solve-the-problem-of-gnome-des...

阅读笔记:Git 源码 (0)

GitHub上检出代码,跳转到第一个commit,那是2005年4月提交的 `e83c5163316f89bfbde7d9ab23ca2e25604af290`。 需要认真复习我的C语言知识了,不过重点不是在于语言,而是这个工具本身的设计。 CACHE_H这个头文件就挺精彩,数据结构直接是基于硬件结构来设计的,注释写的很清楚“根本不考虑可移植性,因为这仅仅是个cache,一切以效率为优先考量”。 ``` /* * Basic data structures for the directory cache * * NOTE NOTE NOTE! This is all in the native CPU byte format. It's * not even trying to be portable. It's trying to be efficient. It's * just a cache, after all. */ #define CACHE_SIGNATURE 0x44495243 /* "DIRC" */ struct cache_header { unsigned int signature; unsigned int version; unsigned int entries; unsigned char sha1[20]; }; /* * The "cache_time" is just the low 32 bits of the * time. It doesn't matter if it overflows - we only * check it for equality in the 32 bits we save. */ struct cache_time { unsigned int sec; unsigned int nsec; }; ``` 此外,作为最基础的数据结构,CACHE_H也定义了一组接口函数。 ``` /* Initialize the cache information */ extern int read_cache(void); /* Return a statically all...