Do not close ArchiveOutputStream on error

If we encounter an I/O error while writing an archive (for example due
to the reader of an HTTP stream closing the connection), the result is
an archive with unclosed entries, causing
TarArchiveOutputStream.finish() to throw IOException("This archives
contains unclosed entries"), hiding the IOException that caused the
early termination.

The unclosed entries are fine: the same exception that occured in the
first place will probably prevent closing the entries before finishing
this partial archive that should be discarded anyway.

It would be nicer to call TarArchiveOutputStream.finish and leave the
underlying OutputStream unclosed --- all callers close it already ---
but that would be a more invasive change so we hold off for now.

Change-Id: I328ced19aa8a1888e5353cdbb6106a85fd72d5d7
Signed-off-by: Jonathan Nieder <jrn@google.com>
Revert "Close unfinished archive entries on error"

This reverts commit 75d9b31f14d6226a535a80c05cffda29e55d2ceb.
Now that we do not try to close the ArchiveOutputStream in the error
path, there is no need to artificially close partial entries from
before the error.

Change-Id: I1f1cb08ec4e9b14c79bf4621f3fa959463034b82
Signed-off-by: Jonathan Nieder <jrn@google.com>
Added the git-describe implementation

CQ: 7609
Bug: 339246
Change-Id: I689bc0578ce3a430b9800ad84122e221c69829f4
Signed-off-by: Kohsuke Kawaguchi <kk@kohsuke.org>
Also-By: Robin Stocker<robin@nibor.org>
Also-By: Matthias Sohn <matthias.sohn@sap.com>
Also-By: Christian Halstrick <christian.halstrick@sap.com>
Merge "Added the git-describe implementation"
Merge branch 'stable-3.1'

* stable-3.1:
  Prepare post 3.1.0 builds
  JGit v3.1.0.201310021548-r
  Fix order of commits in rebase todo file header
  Prepare post 3.1.0 RC1 builds
  JGit v3.1.0.201309270735-rc1
  Attempt to fix graph layout when new heads are introduced
  Prepare re-signing pgm's ueberjar to avoid SecurityException
  Use full branch name when getting ref in BranchTrackingStatus

Change-Id: Ida30175d0c058048cbe4b563aae7f85cd008db29
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Prepare 3.2.0-SNAPSHOT builds

Change-Id: Iac6cf7a5bb6146ee3fe38abe8020fc3fc4217584
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Propagate IOException where possible when getting refs.

Currently, Repository.getAllRefs() and Repository.getTags() silently
ignores an IOException and instead returns an empty map. Repository
is a public API and as such cannot be changed until the next major
revision change. Where possible, update the internal jgit APIs to
use the RefDatabase directly, since it propagates the error.

Change-Id: I4e4537d8bd0fa772f388262684c5c4ca1929dc4c
Add constructors that take Throwable to ServiceMayNotContinueException.

ServiceMayNotContinueException usually wraps an underlying exception.
Add convenience constructors that take Throwable. In the case a
string is not provided, the message defaults to "internal server error",
since it may be reported to the client.

Change-Id: I15dc20306826c352f69e88afb7ed6927c12b6c1f
Fix ServiceMayNotContinueException constructors for Java 1.5

IOException did not add a (String, Throwable) constructor until 1.5.
Instead use the String super constructor and initCause to initialize
the exception.

Fixes bug 418889

Change-Id: Ide735ecfc7d04884981b79b57a4275863ce17006
Add support for --version in JGit CLI

Bug: 419000
Change-Id: I43f5267182ea69d1f9abbff33136e0491c629071
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Add resources/ as source folder in build.properties

This allows correct export of org.eclipse.jgit.pgm via the PDE Export
wizard.

Bug: 419089
Change-Id: I98765208edd7df59e262001dd01ed2b43e4475a9
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Merge "Add support for --version in JGit CLI"
List all supported formats in archive command's help

Change-Id: I4bd271cb348914642069239853488f4960444746
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Allow to set target of DescribeCommand

Change-Id: I04805ce20cc203f5e491406c39b71e7017553b37
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Describe HEAD if no explicit target was set

Change-Id: I5a5a238709df813ec07278bb3b4f9ea5c85c0883
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Add describe command to JGit command line interface

Change-Id: I1560fd2be417361b3d2df15a27618053031bd873
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
CLI version command falls back to Bundle-Version

If the version command cannot read the Implementation-Version of the
containing JAR fall back to read the Bundle-Version header in
MANIFEST.MF. This makes the command working also from the
org.eclipse.jgit.pgm bundle and during development in a host IDE.

Bug: 419087
Change-Id: I4269d1cbd9bf9fd8be6fb4463aecc1c434aa387b
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Scripts to publish jgit artifacts on Maven central

- you need an account on oss.sonatype.org and permissions for group id
  org.eclipse.jgit, see [1]
- install ruby [2] if necessary
- run download.rb to download the Maven artifacts from repo.eclipse.org
- then run deploy.rb to stage the artifacts on oss.sonatype.org
- follow [3] to close the staging repository which triggers some sanity
checks on Nexus
- ask community to test artifacts from staging repository
- if tests are ok release the staging repository as described in [4]

[1] https://issues.sonatype.org/browse/OSSRH-2758
[2] https://www.ruby-lang.org/en/downloads/
[3]
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-7b.StageExistingArtifacts
[4]
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8a.ReleaseIt

Change-Id: I830f2392b9234e585b01dbb4a5a369edd88796a2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Merge changes I5a5a2387,I04805ce2

* changes:
  Describe HEAD if no explicit target was set
  Allow to set target of DescribeCommand
Fix failed tests when the tmp directory is a symlink

On Mac OS X /tmp is by default a symbolic link.

Change-Id: I0913ee5ee8db5c5918a9e41abbbfe125b6c70783
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>