8

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.

Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
  • Git is **distributed** version control system, so solution #2 is not possible. You can do a shallow clone (`git clone --depth=0 `) to get only current history. Some of what you want is possible via gitweb (git.kernel.org). – Jakub Narębski Nov 15 '09 at 14:15

3 Answers3

11

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

Jakub Narębski
  • 309,089
  • 65
  • 217
  • 230
  • I don't suppose you could provide a template URL for diffing two arbitrary version of an arbitrary file? – Robert S. Barnes Nov 16 '09 at 08:58
  • 1
    This answer is outdated (kernel.org switched to cgit and the old urls no longer work). Anyone know the new correct answer? – R.. GitHub STOP HELPING ICE Jun 06 '14 at 04:22
  • @R.. added "How to find it" section, with an example using current kernel.org web interface using cgit. HTH – Jakub Narębski Jun 06 '14 at 16:46
  • @JakubNarębski: Thanks! Does cgit have any way to fetch the diff as raw text rather than html, so you can download and apply it? FYI my interest in this came from CVE-2014-3153 where the available patches aren't clean for applying to most kernel versions; I initially figured kernel.org's cgit would be an easy way to get patches that apply against different versions, but I couldn't get it to work. – R.. GitHub STOP HELPING ICE Jun 06 '14 at 17:04
  • 1
    @R..: I didn't see the link to 'patch' view (maybe it is there in some normal view), but examining cgit sources shown that there is **rawdiff** action... – Jakub Narębski Jun 06 '14 at 18:10
  • @JakubNarębski: Actually I tried rawdiff, but it seems to ignore the pathname and produces a huge diff for the whole repository... – R.. GitHub STOP HELPING ICE Jun 06 '14 at 18:36
  • @JakubNarębski thank you very much for the rawdiff git.kernel.org option. – Vladimir Kunschikov Nov 17 '16 at 08:27
0

The system which creates the diff (whether that might be your webserver or your local system) must have a full copy (clone) of the git repo.

So you cannot do "remote diffs".

So, if you want to avoid doing a git clone of the whole kernel, why not just point your web browser to http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary?

ndim
  • 35,870
  • 12
  • 47
  • 57
  • That doesn't make any sense. On projects where I've used CVS I could remotely diff any two revisions of a particular file. Why wouldn't I be able to do that with GIT, which is supposed to be light years ahead of CVS? – Robert S. Barnes Nov 15 '09 at 13:02
  • Because CVS is **centralized** version control system (where most actions need network access), and Git is **distributed** version control system (where almost all actions are on local clone of repository). See also http://stackoverflow.com/questions/802573/difference-between-git-and-cvs/824241#824241 – Jakub Narębski Nov 15 '09 at 14:11
0

Since 2013, the reworked kernel.org website uses cgit to browse repositories.

As an example of cgit URL for a diff between two tags:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?id=v3.19-rc2&id2=v3.19-rc1&dt=2


That is also why Git 2.38 (Q3 2022) modified gitweb: gitweb had legacy URL shortener that is specific to the way projects hosted on kernel.org. It used to (but no longer) work, and has been removed.

See commit 75707da (26 Jul 2022) by Julien Rouhaud (rjuju).
(Merged by Junio C Hamano -- gitster -- in commit dcdcc37, 05 Aug 2022)

gitweb: remove title shortening heuristics

Signed-off-by: Julien Rouhaud

Those heuristics are way outdated and too specific to the kernel project to be useful outside of kernel.org.
Since kernel.org doesn't use gitweb anymore and at least one project complained about incorrect behavior, entirely remove them.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250