jgit/org.eclipse.jgit.pgm
Thomas Wolf 3ed4cdda6b AddCommand: ability to switch off renormalization
JGit's AddCommand always renormalizes tracked files. C git does so only
on git add --renormalize. Especially for git add . and the JGit
equivalent git.add().addFilepattern(".").call() this can make a big
difference if there are many files, or large files.

Add a "renormalize" option to AddCommand. To maintain compatibility with
existing uses, this option is "true" by default, and the behavior of
AddCommand is as it has always been in JGit.

If set to "false", use an IndexDiffFilter (in addition to a path filter,
if any). This skips any unchanged files (that are not racily clean) from
content checks. Note that changes in CRLF settings or in filters will be
ignored for such files if renormalize == false.

Add the "--renormalize" option to the Add command in the JGit command
line program. For the command-line program, the default is as in C git:
renormalize is off by default and enabled only if the option is given.
Note that --renormalize implies --update in the command line program, as
in C git. In AddCommand, the two settings are independent.

Additionally, avoid opening input streams unnecessarily in
WorkingTreeIterator.getEntryContentLength() and fix some bogus
indentation.

Add a simple test that adds 1000 files of 10kB in 10 directories twice
and that fails if the second invocation (without any changes) with
renormalize=false is not significantly faster.

Locally, I observe for that second invocation

* git.add().addFilepattern(".").call()                        ~660ms
* git.add().addFilepattern(".").setRenormalize(false).call()   ~16ms

Bug: 494323
Change-Id: I30f9d518563fa55d7058a48c27c425f3b60aeb4c
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-04-28 17:04:47 -04:00
..
.settings Enable compiler option --release 2021-09-29 17:13:01 +02:00
META-INF Prepare 6.6.0-SNAPSHOT builds 2023-03-01 15:40:45 +01:00
resources AddCommand: ability to switch off renormalization 2023-04-28 17:04:47 -04:00
src/org/eclipse/jgit AddCommand: ability to switch off renormalization 2023-04-28 17:04:47 -04:00
.classpath Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
.gitignore Finish removing Apache Felix maven-bundle-plugin 2010-01-12 11:46:55 -08:00
.project Enforce the use of Java5 API:s only (with a few exceptions) 2011-12-16 01:01:36 +01:00
BUILD pgm/BUILD: Add dependencty to java EWAH 2022-10-05 19:12:45 -04:00
about.html Add missing about.html files to all shipped bundles 2011-06-08 21:51:51 +02:00
build.properties Use slf4j-simple instead of log4j for logging 2021-12-31 01:09:52 +01:00
jgit.sh Enable passing java options to jgit command line executable 2020-04-28 13:57:42 +02:00
plugin.properties Fix bundle localization of Apache SSH bundle 2019-06-21 17:54:06 +02:00
pom.xml Prepare 6.6.0-SNAPSHOT builds 2023-03-01 15:40:45 +01:00