Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Diff Files Directly from the Linux Kernel GIT Repository?

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.

like image 561
Robert S. Barnes Avatar asked Nov 15 '09 11:11

Robert S. Barnes


People also ask

How do I clone a kernel source?

Just run the git clone command as described and git downloads and unpacks the latest source. The kernel source is typically installed in /usr/src/linux. You should not use this source tree for development because the kernel version against which your C library is compiled is often linked to this tree.

What is Linux kernel architecture?

Kernel is a small and special code which is the core component of Linux OS and directly interacts with hardware. It is the intermediate level between software and hardware which provides low level service to user mode's components.

What is kernel version in Linux?

It was conceived and created in 1991 by Linus Torvalds. Linux kernels have different support levels depending on the version. The oldest currently-supported version, 4.9, released in December 2016, was declared to have six years of Long-Term Support (LTS), followed by Super-Long-Term Support (SLTS), i.e.

How big is the Linux kernel?

“A container requires no more than 8 MB and a minimal installation to disk requires around 130 MB of storage.”, about | Alpine Linux . A container uses the kernel of the host system while a minimal installation to disk uses 130MB, so the kernel of a minimal Alpine installation would be 122MB.


1 Answers

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

  • For diff between two arbitrary commits (equivalent of git diff A B from command line) http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hp=A;h=B

  • For diff between two versions of the same file (equivalent of git diff A B <filename>). http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;f=<filename>;hpb=A;hp=B

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

like image 117
Jakub Narębski Avatar answered Sep 26 '22 15:09

Jakub Narębski