如何直接从 Linux 内核 GIT 存储库中区分文件? [英] How to Diff Files Directly from the Linux Kernel GIT Repository?

查看:27
本文介绍了如何直接从 Linux 内核 GIT 存储库中区分文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够直接从 Linux 内核 GIT 存储库中区分文件/目录,而无需下载完整的源代码.

具体来说,我对两种可能的解决方案感兴趣:

  1. 能够通过网络浏览器 (firefox) 进行差异化
  2. 适用于 Ubuntu 的 GUI 实用程序,可以执行远程差异.
  3. 如何设置选项 #2 的教程

编辑

作为我正在寻找的示例,我曾经使用 CrossVC 作为CVS 存储库中的上述任务.

解决方案

Gitweb 在内核.org 允许查看任意提交之间的差异,例如,参见以下链接了解 v2.6.32-rc6 和 v2.6.32-rc7 之间的差异:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hp=refs/tags/v2.6.32-rc6;h=refs/tags/v2.6.32-rc7(使用 patch 链接以获得您可以应用的普通补丁),以及任意版本的文件之间/任意文件的任意版本之间,例如:

不幸的是,官方 gitweb 版本(与 Git 本身一起分发)和 kernel.org 使用的 fork 都不会生成任意提交之间的链接,因此您必须手工制作(手工创建)URL 以提供给 gitweb.在 commitdiff 视图(动作)的情况下,您需要的 iparameters 是 'h'(哈希)和 'hp'(哈希父级);在 blobdiff 视图的情况下,它们是 'hb'(哈希基)和 'hpb'(哈希父基),还有 'f'(文件名)和 'fp'(父文件).

模板

请注意,核心 gitweb(但不是 kernel.org 使用的 fork,目前)您可以使用 path_info 版本,例如:
http://repo.or.cz/w/git.git/blobdiff/A..B:/<文件名>

<小时>

如何找到它

  1. 在网页界面中找到一个提交,它是一个合并提交,例如
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1c5aefb5b12a90e29866c960a​​57c1f8f75def617

  2. 找到一个链接到提交和第二个父级之间的差异,例如
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=v3.15-rc8&id2=v3.15-rc7

    或生成补丁 (rawdiff)
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v3.15-rc8&id2=v3.15-rc7

I'd like to be able to diff files / directories directly from the Linux Kernel GIT repository without having to download full source.

Specifically, I'm interested in two potential solutions:

  1. The ability to do diff's via a web browser ( firefox )
  2. A GUI utility for Ubuntu that can do remote diffs.
  3. A tutorial how to setup option #2

Edit

As an example of what I'm looking for, I used to use CrossVC for the above tasks on a CVS repo.

解决方案

Gitweb at kernel.org allows to view diff between arbitrary commits, see for example the following link for diff between v2.6.32-rc6 and v2.6.32-rc7:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hp=refs/tags/v2.6.32-rc6;h=refs/tags/v2.6.32-rc7 (use patch link to get plain patch that you can apply), and between arbitrary versions of file / between arbitrary versions of arbitrary files, e.g.: diff to current link in history view.

Unfortunately neither official gitweb version (distributed together with Git itself), nor the fork used by kernel.org generates links between arbitrary commits, so you would have to handcraft (create by hand) URLs to give to gitweb. In the case of commitdiff view (action) the iparameters you need are 'h' (hash) and 'hp' (hash parent); in the case of blobdiff view they are 'hb' (hash base) and 'hpb' (hash parent base), and also 'f' (filename) and 'fp' (file parent).

Templates

Note that core gitweb (but not the fork used by kernel.org, currently) you can use path_info version, e.g.:
http://repo.or.cz/w/git.git/blobdiff/A..B:/<filename>


How to find it

  1. Find in a web interface a commit which is a merge commit, for example
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1c5aefb5b12a90e29866c960a57c1f8f75def617

  2. Find a link to diff between a commit and a second parent, for example
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=1c5aefb5b12a90e29866c960a57c1f8f75def617&id2=54a217887a7b658e2650c3feff22756ab80c7339

  3. Replace SHA-1 of compared commits with revision names or revision identifiers you want to compare, for example to generate diff between v3.15-rc8 and v3.15-rc7
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=v3.15-rc8&id2=v3.15-rc7

    or to generate patch (rawdiff)
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v3.15-rc8&id2=v3.15-rc7

这篇关于如何直接从 Linux 内核 GIT 存储库中区分文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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