git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 0/5] jgit diff

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 3, 2009, 10:45 UTC
Message-ID
<cover.1251974493u.git.johannes.schindelin@gmx.de>
In-Reply-To
<alpine.DEB.1.00.0909030846230.8306@pacific.mpi-cbg.de>

This patch series provides a rudimentary, working implementation of "jgit diff". It does not provide all modes of "git diff" -- by far! -- but it is robust, and should provide a good starting point for further work.

Unfortunately, I lack the time to do proper profiling/benchmarking, but I verified at least that it succeeds in recreating valid patches for all commits in jgit.git with this script:

	git rev-list HEAD |
	sed '$d' |
	while read commit
	do
	        printf "\\r$commit "
	        (export GIT_INDEX_FILE=test-index &&
	         ./jgit diff $commit^ $commit > test-patch &&
	         git read-tree $commit^ &&
	         git apply --cached test-patch &&
	         git diff --exit-code --cached $commit) || break
	done
Johannes Schindelin (5):
  Add set to IntList
  Add Myers' algorithm to generate diff scripts
  Add a test class for Myers' diff algorithm
  Prepare RawText for diff-index and diff-files
  Add the "jgit diff" command
 .../services/org.spearce.jgit.pgm.TextBuiltin      |    1 +
 .../src/org/spearce/jgit/pgm/Diff.java             |  133 +++++
 .../tst/org/spearce/jgit/diff/MyersDiffTest.java   |  103 ++++
 .../tst/org/spearce/jgit/util/IntListTest.java     |   21 +
 .../src/org/spearce/jgit/diff/DiffFormatter.java   |    2 +-
 .../src/org/spearce/jgit/diff/MyersDiff.java       |  515 ++++++++++++++++++++
 .../src/org/spearce/jgit/diff/RawText.java         |   28 +-
 .../src/org/spearce/jgit/util/IntList.java         |   17 +
 8 files changed, 818 insertions(+), 2 deletions(-)
 create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Diff.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/diff/MyersDiffTest.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/MyersDiff.java
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 28 in “[JGIT] Request for help”
  1. Nasser GrainawiSep 2, 2009
  2. Johannes SchindelinSep 3, 2009
  3. Shawn O. PearceSep 3, 2009
  4. jgit diff, was Re: [JGIT] Request for helpJohannes Schindelin, Sep 3, 2009
  5. 0/5 jgit diffJohannes Schindelin, Sep 3, 2009
  6. 1/5 Add set to IntListJohannes Schindelin, Sep 3, 2009
  7. 2/5 Add Myers' algorithm to generate diff scriptsJohannes Schindelin, Sep 3, 2009
  8. 3/5 Add a test class for Myers' diff algorithmJohannes Schindelin, Sep 3, 2009
  9. 4/5 Prepare RawText for diff-index and diff-filesJohannes Schindelin, Sep 3, 2009
  10. 5/5 Add the "jgit diff" commandJohannes Schindelin, Sep 3, 2009
  11. Johannes SchindelinSep 3, 2009
  12. Shawn O. PearceOct 1, 2009
  13. Johannes SchindelinOct 1, 2009
  14. Christian HalstrickSep 3, 2009
  15. Jonas FonsecaSep 3, 2009
  16. Shawn O. PearceSep 3, 2009
  17. Jonas FonsecaSep 3, 2009
  18. Shawn O. PearceSep 3, 2009
  19. Gabe McArthurSep 4, 2009
  20. Mark StrubergSep 4, 2009
  21. Jonas FonsecaSep 4, 2009
  22. Mark StrubergSep 4, 2009
  23. Jonas FonsecaSep 4, 2009
  24. Mark StrubergSep 4, 2009
  25. Shawn O. PearceSep 3, 2009
  26. Nasser GrainawiSep 3, 2009
  27. Shawn O. PearceSep 3, 2009
  28. Nasser GrainawiSep 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.