# JGit

## Features

- Fetch: Basic support for protocol v2 of the fetch-pack/upload-pack protocol. This protocol is described in the Git project in "Documentation/technical/protocol-v2.txt". Notes:
  - bug 534847 AdvertiseRefsHook is not executed for v2, to be replaced by an appropriate hook
  - change 120007 support for shallow fetch using protocol v2 is not complete
- Add protocol v2 support in jgit daemon. With this patch, a server spawned by jgit daemon can be accessed using protocol v2 from a Git client that supports it (for example, "git" with the appropriate patches, to be released with git 2.18). This is only activated if the repository's config has "protocol.version" be 2.
- Store in IndexChangedEvent if it was caused by JGit itself. This allows to differentiate if index was changed by an external git command or by JGit itself.
- bug 358206 Handle Gerrit Change-Ids for merge commits
- UploadPack: basic support for filtering by blob size. This is incomplete in that the filter-by-sparse-specification feature also supported by Git is not included yet.
- Implement --force option in FetchCommand and CLI fetch command

## Performance Improvements

- bug 388582 Skip ignored directories in FileTreeIterator
- bug 532300 Significantly speed up FileTreeIterator on Windows
- Configure WindowCache settings to use in JGit CLI. Set the same defaults as in EGit. Use mmap to map git packfiles into memory. Avoids allocating JGit buffer cache on the Java heap.

## Fixes

0 enhancement requests and 6 bugs were closed

- bug 423206 Make JGit describe behaves same as c-git for lightweight tags
- bug 535672 Ensure Jsch checks all configured algorithms
- bug 535655 Validate branch names on branch creation
- bug 533549 Don't prune symbolic refs when fetch.prune = true
- Use a secure random generator to seed nonce for digest authentication
- Retry stale NFS file handles on .git/config file ( https://git.eclipse.org/r/#/c/120973/)
- bug 529463 ssh: Kill the external process when we're done instead of waiting forever
- Allow '@' as last character of ref. Previously @ was allowed e.g. in branch names, but not as the last character.
- Don't throw an exception if a pre-push hook is ignored.
- LFS: Fix potential NPE in LfsPrePushHook
- FS#runProcess: Fix OutputStream left unclosed after IOException

## Incompatible Changes

- Remove deprecated Repository#notifyIndexChanged. Implementors should now override Repository#notifyIndexChanged(boolean)
- Remove deprecated LfsProtocolServlet#getLargeFileRepository. Use LfsProtocolServlet##getLargeFileRepository(LfsRequest, String, String) instead.
- Remove deprecated Lfs#Lfs(Path). Use Lfs#Lfs(Repository) instead.
- Remove deprecated StreamCopyThread#flush
- Remove deprecated SafeBufferedOutputStream. Use Java 8 BufferedOutputStream instead.
- Remove deprecated EolCanonicalizingInputStream. Use AutoLFInputStream instead.
- Remove deprecated FileUtils#relativize(String, String). Use the more-clearly-named FileUtils#relativizeNativePath(String, String) instead, or directly call FileUtils#relativizePath(String, String, String, boolean).
- Remove deprecated FileUtil using Java 7 NIO
- Remove deprecated TreeWalk#getEolStreamType. Use TreeWalk#getEolStreamType(OperationType) instead.
- Remove deprecated FileTreeIterator(WorkingTreeIterator, File, FS). Use FileTreeIterator#FileTreeIterator(FileTreeIterator, File, FS) instead.
- Remove deprecated TransportHttp#httpOpen(String, URL). Use TransportHttp#httpOpen(String, URL, AcceptEncoding) instead.
- Remove deprecated ResolveMerger#processEntry method
- Remove deprecated Repository#getRef. Use Repository#exactRef(String) or Repository#findRef(String) instead.
- Remove deprecated BitmapBuilder#add. Use BitmapBuilder#or or BitmapBuilder#addObject instead.
- Remove deprecated LockFile(File, FS) constructor. Use org.eclipse.jgit.internal.storage.file.LockFile#LockFile(File) instead.
- Remove deprecated IgnoreNode#isIgnored method. Parameter negateFirstMatch is not honored anymore
- Remove deprecated Statistics, UploadPackLogger, UploadPackLoggerChain. Use PackStatistics and PostUploadHook and PostUploadHookChain instead.
- Remove UploadPack#getPackStatistics. Use #getStatistics instead
- Remove UploadPack#getLogger and UploadPack#setLogger
- Remove deprecated StoredObjectRepresentationnotAvailableException constructor. Use #StoredObjectRepresentationNotAvailableException(ObjectToPack, Throwable) instead.
- Remove deprecated ArchiveCommand#putEntry method. Use #putEntry(Closeable, ObjectId, String, FileMode, ObjectLoader)} instead.
- Fix misspelled class name: EmtpyCommitException -> EmptyCommitException
- RemoteAddCommand#setName(String) and #setUri(URIish): return RemoteAddCommand to allow chaining.

## Build and Release Engineering

- Update to latest Photon Orbit R20180606145124
- Update maven plugins to fix Zip Slip vulnerability
- Bazel: Add a target to build jgit commandline tool
- Use eclipse compiler in Maven build. Define profiles "ecj" for using Eclipse compiler and "javac" for using javac including errorprone. By default ecj will be used.
- Upgrade error_prone_core to 2.3.1
- Update SUA to current version.

## Contributors

The following 17 contributors worked on this release:

Carsten Pfeiffer, Christian Halstrick, Dave Borowitz, David Pursehouse, David Turner, Han-Wen Nienhuys, Jonathan Nieder, Jonathan Tan, Marcel Trautwein, Markus Duft, Masaya Suzuki, Matthias Sohn, Michael Keppler, Mincong HUANG, Minh Thai, Nasser Grainawi, Thomas Wolf