Commit Graph

265 Commits

Author SHA1 Message Date
Matthias Sohn 4c8a4eb8fd Prepare 5.1.0-SNAPSHOT builds
Change-Id: I3d06c5237edae54b09f465f415f5a308b5e7ceff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-05 20:41:53 +02:00
Matthias Sohn e4281f1d5f JGit v5.1.0.201809051400-rc1
Change-Id: I0b53f95ee51d94da8b029c9bb10eb854ff9dd4f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-09-05 19:55:38 +02:00
Matthias Sohn a6d641a03b Prepare 5.1.0-SNAPSHOT builds
Change-Id: If57fcce14f5ba3ef2a2602515e2f89b8f22a742b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-29 13:51:08 +02:00
Matthias Sohn a7ad89e974 JGit v5.1.0.201808281540-m3
Change-Id: Ie86c46a828b55a2235056b9a5bc2c6c450b95ed0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-08-28 21:41:37 +02:00
Matthias Sohn 2f1b4ffcd2 Prepare 5.1.0-SNAPSHOT builds
Change-Id: I8523a993ae1f7b62573d7547273bc1356bf64fa7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-23 10:18:18 +02:00
David Pursehouse f07b60239c Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8
Change-Id: I6714fc3666e1bced22abba94ceb700477349586e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-11 22:46:52 +01:00
Matthias Sohn 653b31a903 Remove deprecated ArchiveCommand#putEntry method
Use #putEntry(Closeable, ObjectId, String, FileMode, ObjectLoader)}
instead.

Change-Id: I2c58c07da00c6033c583eb2dc6c3a0889661f5f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-09 23:55:43 +01:00
Matthias Sohn d0f1f5eef6 Prepare 5.0.0-SNAPSHOT builds
Change-Id: I2d2f50ed8a12f310e7cac68eed5536bd460c403f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-08 23:09:18 +01:00
Matthias Sohn f389e18a28 Prepare 4.11.1-SNAPSHOT builds
Change-Id: Id9aa6b7e8f56de5183b6cd57ef0e790ec9debd4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-08 21:10:08 +01:00
Matthias Sohn f944063517 JGit v4.11.0.201803080745-r
Change-Id: Ie24a33bc8a24c30db06fe7b175f405efb95776ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-08 13:43:46 +01:00
David Pursehouse a573dfc658 Enable warning for resources not managed by try-with-resource
Change-Id: Iefe97de6bdb62af558f1b0e77c9205a9186f9b4c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:47 +01:00
Matthias Sohn 5a4b6fd237 Prepare 4.11.0-SNAPSHOT builds
Change-Id: I5d5e2befcf530d93457d44684bd9e4fc2392e5eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-31 04:05:07 +01:00
Karsten Thoms 3832527b02 Add header Automatic-Module-Name for Java 9
Bug: 529075
Change-Id: I4532ce2c80eb91531d46026676502d636ccda706
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-23 01:00:01 +01:00
Matthias Sohn 32022e9764 Fix javadoc in org.eclipse.jgit.archive
Change-Id: Ibef80b15f17e884f3085e324283cefc738236a4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-12-17 20:05:55 +01:00
Matthias Sohn f0c119de4f Merge branch 'stable-4.9'
* stable-4.9:
  Ignore warning for minor version change without API change
  Silence boxing warning
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: Icc33d2e36f140e8714fce088379673a8834ae9de
2017-11-24 01:18:13 +01:00
Matthias Sohn 03abd1dff2 Ignore warning for minor version change without API change
- this is a new warning option in Eclipse 4.7 and higher
- we always change version of all bundles in a release to keep release
engineering simple

Change-Id: Ic7523d77b67b2802f1bab3bc70af250d712a034f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-11-24 01:12:14 +01:00
Matthias Sohn 6b544da293 Prepare 4.10.0-SNAPSHOT builds
Change-Id: I5ca462d1db18a2c5c9382cfb9c83972510fa2b88
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-10-08 11:35:54 +02:00
Matthias Sohn 8180183289 Prepare 4.9.1-SNAPSHOT builds
Change-Id: Ic49fd093d3fe4324c4d83aba74033040fcaa37a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-10-08 11:25:06 +02:00
Matthias Sohn 6877730fa0 JGit v4.9.0.201710071750-r
Change-Id: I487f6aa3d0c4ef1d57f91cdc36177d994ae24c51
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-10-07 23:46:52 +02:00
Matthias Sohn 41baa7a791 Partially revert c0ad77d8 "Enhance Eclipse save actions"
Do not automatically organize imports using a save action since this
seems to be buggy and removed some annotations org.eclipse.jgit.pgm
needs to use args4j.

Change-Id: I5a91292c3b9241ce2dde3e4ecce14ad460097129
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-30 03:07:18 +02:00
Matthias Sohn 9906f09868 Partially revert c0ad77d8 "Enhance Eclipse save actions"
Revert the following save actions which were introduced in c0ad77d8:
- always use braces around blocks
- remove unused imports

Other than I expected save actions are run globally on edited files -
and not only on edited code lines only.

Hence revert the save action "Convert control statement bodies to
blocks" which would affect a large number of code lines not affected by
the change editing some small part of a class. This would generate a
large number of changes which may lead to many unnecessary conflicts.
Total number of affected lines across jgit would be around 10k lines.

Also revert "Remove unused imports" since it erroneously removes imports
of some annotations needed by pgm classes using args4j.

Change-Id: I879a47f68e664129e6124cf25c1ae1f6a2d7a5aa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-30 01:24:47 +02:00
Matthias Sohn c0ad77d84c Enhance Eclipse save actions
Add the following Eclipse save actions executed when saving modified
lines. This should help to reduce manual work needed to maintain a clean
and consistent code style:
- organize imports
- always use braces around blocks
- add missing annotations
  - @Override including implementation of interface methods
  - @Deprecated
- remove
  - unused imports
  - unnecessary $NON-NLS$ tags
  - redundant type arguments

Also add default values for new settings that were introduced in recent
Eclipse versions up to Neon since we updated save rules the last time.

Change-Id: Idc90b249df044d0552f04edf01a5f607c4846f50
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-08-28 11:52:45 -04:00
Matthias Sohn df9ce4b981 Prepare 4.9.0-SNAPSHOT builds
Change-Id: I52a4153d573799e861ab104939f51fac1aceb9ee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-05-30 13:42:07 +02:00
David Pursehouse c80d8c5901 Bazel: Restrict src globs to Java source files
Generating the src list with an unrestricted wildcard causes all
files in the source tree to be included. This results in junk files
such as .orig (generated during merge conflict resolution) to be
included, which causes in a build error:

  in srcs attribute of java_library rule //org.eclipse.jgit:jgit:
  file '//org.eclipse.jgit:src/org/eclipse/jgit/gitrepo/RepoCommand.java.orig'
  is misplaced here (expected .java, .srcjar or .properties).

Modify the globs to only include Java source files.

Change-Id: Iaef3db33ac71d71047cd28acb0378e15cb09ece9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-13 14:14:55 +09:00
Matthias Sohn aec22e74cf Prepare 4.8.0-SNAPSHOT builds
Change-Id: Ifea6750e79d417a8a2a891b3b5f96d68c7200011
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-04-05 14:49:49 +02:00
Yasuhiro Takagi b26102469c TarFormat: Use commit time as timestamp for entries
This was already done for ZipFormat in 1448ec3.

Change-Id: Ie131938a3f640c68718dc793d18dd35be5c71e7c
Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-04-05 10:01:45 +09:00
David Pursehouse 2d0ce094b4 Remove Buck build
Buck will be replaced with Bazel

Change-Id: I3cf07d7aaaa2a58bac34e16c50af5416693254ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-03-22 01:41:21 +01:00
Jonathan Nieder bc5014faec bazel: Add explicit targets for library dependencies
This provides a place to declare visibility restrictions and
transitive dependencies for each library.

Other targets should only declare dependencies on what they directly
use, making dependencies easier to maintain.

Trim the dependencies of org.eclipse.jgit:jgit to follow that rule.
It declares dependencies on Apache httpcomponents and the servlet
API but doesn't use them.

Tested:
* 'bazel build //...' succeeds
* applying the change https://gerrit-review.googlesource.com/90843
  to a copy of Gerrit, following the instructions there, and running
  'bazel test //...' in that copy of Gerrit still succeeds

Change-Id: I3ab958ce8b3227019cdbe4cc81e0f042e1541034
2017-03-19 18:51:03 -07:00
David Pursehouse 3b4448637f Enable and fix warnings about redundant specification of type arguments
Since the introduction of generic type parameter inference in Java 7,
it's not necessary to explicitly specify the type of generic parameters.

Enable the warning in Eclipse, and fix all occurrences.

Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-02-20 22:47:23 +01:00
Shawn Pearce ff6e6c2214 Fix timestamp in Zip archives
RevCommit.getCommitTime returns time in seconds since the epoch.
ZipArchiveEntry.setTime expects time in milliseconds.

Add the missing unit conversion to get the correct result.
Correct formatting to be consistent with the rest of the code.

Change-Id: I990b92f1d996ec8538d4857755694d91b142eb53
2017-02-20 10:30:58 -08:00
David Pursehouse 7ac182f4e4 Enable and fix 'Should be tagged with @Override' warning
Set missingOverrideAnnotation=warning in Eclipse compiler preferences
which enables the warning:

  The method <method> of type <type> should be tagged with @Override
  since it actually overrides a superclass method

Justification for this warning is described in:

  http://stackoverflow.com/a/94411/381622

Enabling this causes in excess of 1000 warnings across the entire
code-base. They are very easy to fix automatically with Eclipse's
"Quick Fix" tool.

Fix all of them except 2 which cause compilation failure when the
project is built with mvn; add TODO comments on those for further
investigation.

Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-02-19 20:05:08 -04:00
Matthias Sohn 30628e3b86 Add missing @Override annotations in org.eclipse.jgit.archive
Change-Id: I51e37ca7643da6abadbd36e9187ccb58fe713833
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-02-18 10:48:58 +01:00
Naoki Takezoe 1448ec37f9 Set commit time to ZipArchiveEntry
Archived zip files for a same commit have different MD5 hash because
mdate and mdate in the header of zip entries are not specified. In
this case, Commons Compress sets an archived time.

In the original git implementation, it's set a commit time:
e2b2d6a172/archive.c (L378)

By this fix, archive command sets the commit time to ZipArchiveEntry
when RevCommit is given as an archiving target.

Change-Id: I30dd8710e910cdf42d57742f8709e9803930a123
Signed-off-by: Naoki Takezoe <takezoe@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-02-18 10:47:27 +01:00
David Pursehouse dd5e500a57 Format Bazel files with buildifier
Change-Id: I934114315d2c7cab917f1011b8e55c52367d429f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-01-22 22:34:11 +01:00
David Ostrovsky e92a0c3adc Implement initial framework of Bazel build
The initial implementation only builds the packages consumed by
Gerrit Code Review.

Test build and execution is not implemented.

We prefer to consume maven_jar custom rule from bazlets repository,
for the same reasons as in the Gerrit project:

* Caching artifacts across different clones and projects
* Exposing source classifiers and neverlink artifact

TEST PLAN:

  $ bazel build :all
  $ unzip -t bazel-genfiles/all.zip
  Archive: bazel-genfiles/all.zip
    testing: libjgit-archive.jar      OK
    testing: libjgit-servlet.jar      OK
    testing: libjgit.jar              OK
    testing: libjunit.jar             OK
  No errors detected in compressed data of bazel-genfiles/all.zip.

Change-Id: Ia837ce95d9829fe2515f37b7a04a71a4598672a0
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-01-18 19:13:16 -04:00
Matthias Sohn 5fee071f6a Prepare 4.7.0-SNAPSHOT builds
Change-Id: I20754d13007e6591d36aae5766f3a9a82b24e120
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-27 01:45:50 +01:00
Matthias Sohn 3857c3168f Prepare 4.6.1-SNAPSHOT builds
Change-Id: I6b05a6f6c3f92365c272e1bdaf76093ca01f2d58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-24 15:51:54 +01:00
Matthias Sohn 73a4325149 JGit v4.6.0.201612231935-r
Change-Id: Iaa88fe1b195dfe6be99a7b4cb064684e75563715
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-24 01:42:38 +01:00
Matthias Sohn ab79ce91c1 Change JGit minimum execution environment to JavaSE-1.8
Bug: 500059
Change-Id: I47f3f6749a67da52029f84e002d9b155ed56d2b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-09-20 11:32:36 +02:00
Matthias Sohn 9d4ffcc1ab Prepare 4.6.0-SNAPSHOT builds
Change-Id: Id2eafc331ee32c332c2a9b867b05c260beb0d10f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-09-19 17:06:42 +02:00
David Pursehouse eb7a93bb2a Archive: Make project name consistent with other subprojects'
Change-Id: I8341f3340d8129b4f966d541097269210fbf65d2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-07-26 18:58:17 +09:00
David Pursehouse 4528d5f56d Ignore 'The value of exception parameter is not used' warning
Change-Id: I50407e4a33e35b718ca40503fdd436f1f9f70fba
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-07-26 10:16:49 +09:00
Matthias Sohn 75b3301939 Prepare 4.5.0-SNAPSHOT builds
Change-Id: I572fe9fea0e5ca0bec4648c916ae95a5b1ccf125
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-06-01 23:04:07 +02:00
Matthias Sohn ccf8363693 Prepare 4.4.0-SNAPSHOT builds
Change-Id: If3162f4cc4ae6319b9f1e3293549485b039cfe7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 17:59:59 +02:00
Matthias Sohn f2ee537d55 Prepare 4.3.1-SNAPSHOT versions
Change-Id: I52c98ba8fb3a303269a1f9380af114b6dd8c5009
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:56:43 +02:00
Matthias Sohn 4f0daa3bb2 JGit v4.3.0.201604071810-r
Change-Id: I902cdf1ff92ce8c6e9d80c4965d8d5bd8b9ac6c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:10:10 +02:00
Matthias Sohn 57e6274bcf JGit v4.3.0.201604071045-r
Change-Id: Iafab78d6be34d31a13f979b7be67611135c0f8bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-07 16:41:24 +02:00
Matthias Sohn 46bef2bcb6 Prepare 4.3-SNAPSHOT builds
Change-Id: Ib831f8870938113bd5338763f90a07d5c108b1de
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-05 23:10:06 +02:00
Matthias Sohn bf32c9102f JGit v4.3.0.201603230630-rc1
Change-Id: I10835e5aa3618e5033424595942cc1649152cb24
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-23 11:27:04 +01:00
Matthias Sohn b30917ce21 Prepare 4.3.0-SNAPSHOT builds
Change-Id: Idcf0479529693b023042becd96698f9afd344bd4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 21:49:41 +01:00
David Ostrovsky 13502fef8f Implement Buck driven build
Today there are plenty of modern build tool systems available in the
wild (in no particular order):

* http://bazel.io
* https://pantsbuild.github.io
* http://shakebuild.com
* https://ninja-build.org
* https://buckbuild.com

The attributes, that all these build tools have in common, are:

* reliable
* correct
* very fast
* reproducible

It must not always be the other build tool, this project is currently
using. Or, quoting Gerrit Code Review maintainer here:

  "Friends, don't let friends use <the other build tool system>!"

This change is non-complete implementation of JGit build in Buck,
needed by Gerrit Code Review to replace its dependency with standlone
JGit cell. This is very useful when a developer is working on both
projects and is trying to integrate changes made in JGit in Gerrit.

The supported workflow is:

  $ cd jgit
  $ emacs <hack>
  $ cd ../gerrit
  $ buck build --config repositories.jgit=../jgit gerrit

With --config repositories.jgit=../jgit jgit cell is routed through
JGit development tree.

To build jgit, issue:

  $ buck build //:jgit
  [-] PROCESSING BUCK FILES...FINISHED 0,0s

Yes, you can't measure no-op build time, given that Buck daemon is
used.

Change-Id: I301a71b19fba35a5093d8cc64d4ba970c2877a44
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2015-12-31 10:08:55 -08:00
Terry Parker ca3ea18371 Update dependencies to use the JGit-internal @Nullable
Update the project-specific Eclipse settings to replace the use of the
org.eclipse.jdt.annotation.Nullable class the new JGit-specific
@Nullable annotation. I verified that Eclipse reports errors when the
return value of a method annotated with
@org.eclipse.jgit.annotations.Nullable is dereferenced without a null
check.

Also remove the Maven and MANIFEST.MF dependencies on
org.eclipse.jdt.annotation.

Eclipse null analysis uses three annotations: @Nullable, @NonNull and
@NonNullByDefault. All three are updated in this patch because it is
invalid to set the Eclipse preferences to empty values. So far only
@Nullable has been introduced in org.eclipse.jgit.annotations.

My personal preference is to follow the advice in Effective Java and
avoid the null-return idiom, and to avoid passing null values in
general. This sets the expectation is that arguments and return types
are assumed non-null unless otherwise documented. If that is the
expectation, then consistent application of @NonNull is redundant and
hurts readability by cluttering the code, obscuring the occasional
@Nullable annotation that really requires attention.

If the JGit community decides there is value in using the @NonNull and
@NonNullByDefault annotations we can add them--this change configures
Eclipse to use them.

Change-Id: I9af1b786d1b44b9b0d9c609480dc842df79bf698
Signed-off-by: Terry Parker <tparker@google.com>
2015-11-09 14:27:52 -08:00
Matthias Sohn 100179a101 Use japicmp instead of clirr to detect API changes
Clirr doesn't support Java 8 hence use japicmp instead.
See https://github.com/siom79/japicmp

Change-Id: If4b30a6d6aa849b4d6b3b0c900558c609822840c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-10-01 01:41:52 +02:00
Matthias Sohn 6664bc6f1c Prepare 4.2.0-SNAPSHOT builds
Change-Id: If559d3565b1f84c93a533e1ce18d5293605d1950
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-09-28 14:48:41 +02:00
Matthias Sohn 729f085ac2 Prepare 4.1.1-SNAPSHOT builds
Change-Id: I035f3a8d0f0de86e8b8f00e668be5ce008402e82
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-09-28 13:37:39 +02:00
Matthias Sohn fdfd6e2872 JGit v4.1.0.201509280440-r
Change-Id: I9a536870b9f5c1247c52d6c976a954115982fa1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-09-28 10:36:08 +02:00
Andrey Loskutov 847b3d1258 Enable annotation based NPE analysis in jgit
Bug: 470647
Change-Id: I14d1983bb7c208faeffee0504e0567e38d8a89f3
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2015-08-20 21:10:04 +02:00
Matthias Sohn a79168bcbb Prepare 4.1.0-SNAPSHOT builds
Change-Id: I03d08b8e2d3400d4b5cdb4ab541b312870776843
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-06-03 00:52:00 +02:00
Matthias Sohn 3ac06ca6de Fix string externalization warnings in BaseFormat
Change-Id: Ie40aa1f889191e45e4d4a7a144c3176d521f6cfa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-12 18:35:47 -07:00
Matthias Sohn 994b39a007 Add missing @since tags for new API methods in archive bundle
Change-Id: I891e2cf9ca89ae1948e9713a412d31ec66faac86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-12 18:35:46 -07:00
Markus Duft ede4b3d5a3 Fix compile error due to missing dependencies and since tags
Change-Id: I98a9f17f987c4f3ea19d107f681c44754ed83dca
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2015-03-12 15:17:27 +01:00
David Ostrovsky c0c4c6f09a ArchiveCommand: Allow to pass options to underlying stream
Current ArchiveCommand design doesn't allow to pass in options to
underlying stream implementations. To overcome this, client has to
implement custom format implementation (it cannot be derived from
the existing one, because the classes are marked as final), and set
the options using ThreadLocal, before the method

  ArchiveOutputStream createArchiveOutputStream(OutputStream s)

is get called.

This change extends the ArchiveCommand.Format by allowing to pass
option map during creation of ArchiveOutputStream.

ArchiveCommand is extended correspondingly. That way client can
easily pass options to the underlying streams:

  Map<String, Object> level = ImmutableMap.<String, Object> of(
      "level", new Integer(9));
  new ArchiveCommand(repo)
      .setFormat("zip")
      .setFormatOptions(level)
      .setTree(tree)
      .setPaths(paths)
      .setPrefix(prefix)
      .setOutputStream(sidebandOut)
      .call();

Change-Id: I1d92a1e5249117487da39d19c7593e4b812ad97a
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2015-02-20 01:40:06 +01:00
Matthias Sohn c26bc63ef1 Set minimum required Java version to Java 7
Bug: 458475
Change-Id: Iea8f2236d4e6a94a8d14bb8cc685006ea3fd1bb7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +01:00
Matthias Sohn 94ebdbfada Prepare 4.0.0-SNAPSHOT builds
Change-Id: I414ba8ccc82866d3107ba7083a567ea70c879bdf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-27 08:48:26 +01:00
Matthias Sohn cdfd22da30 Prepare 3.7.0-SNAPSHOT builds
Change-Id: Ib3e7b5f46ee1e27b9cf25b3b2d01d681a5c4904c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-24 01:17:40 +01:00
Matthias Sohn 02b0660b8b Prepare 3.6.1-SNAPSHOT builds
Change-Id: Ie620c90ffafbffc6755b4e1ed55a61a15b118a2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-23 23:38:20 +01:00
Matthias Sohn b2ca2ffd7d JGit v3.6.0.201412230720-r
Change-Id: Ic28e2bbbdb1099e948c64a005c39f6b8d8ac69a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-23 13:56:43 +01:00
Matthias Sohn 5672535360 Prepare post 3.6.0-m1 builds
Change-Id: Ie9927de64fa6b7d517f96b8cd12e57541f284ff2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 18:51:54 +01:00
Matthias Sohn 1555eeaa9c JGit v3.6.0.201411121045-m1
Change-Id: I9d789113d88cbbbdbabb8919f80c805aa4ba86fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 16:41:54 +01:00
Matthias Sohn 6ccf609e89 Prepare 3.6.0-SNAPSHOT builds
Change-Id: I2d8c3768998c0cfc8d02d11009bc5b7ed1d75778
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-05 14:32:01 +02:00
Robin Rosenberg 0bc98f17b2 Eliminate warnings for non-nls strings that will never be translated
Some of these eliminations just reduces the number of warnings on
lines where messages are constructed that can/will be translated.

Change-Id: I6eddb39ccc8f2488741bb58540d9ec5f5665e2c4
2014-09-04 11:28:03 +02:00
Robin Rosenberg c70a1f0af1 cleanup: Remove no-longer needed API compatibility warning filters
Change-Id: If534bd0aedaee6160679e965ad08ac30d5dac1c5
2014-08-03 00:22:06 +02:00
Robin Rosenberg a03bdcbbb4 Don't warn for methods that can be static
Making the methods static would gain little in performance,
make the code harder to change. Removing unncessary warnings
is more important.

Change-Id: If3e6aa9c1d92e58b4e7a8e246cf4aace237d7a7b
2014-07-02 00:36:38 +02:00
Robin Rosenberg 8032b64980 Add new default settings from Eclipse 4.4
These settings were added by Eclipse simply by touching
the project settings. Adding these makes it simpler to see
what local changes have been made.

Change-Id: Iab0aa62530312eb0c78b03b5c6a632742bcc4978
2014-07-02 00:34:41 +02:00
Robin Rosenberg 64b0531c35 Prepare 3.5.0-SNAPSHOT builds
Change-Id: I53bd500188e09ae2e007a58b3cd89aa0805d6f2a
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-06-04 18:23:29 -04:00
Matthias Sohn 0e13adb9cf Prepare post 3.4.0 RC1 builds
Change-Id: Ia8d29046439bc9134acdf7c88ab85ea49c4ddf47
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-21 22:04:43 +02:00
Matthias Sohn d2d56e9efb JGit v3.4.0.201405211411-rc1
Change-Id: Ia3834770b9719f64cbdfd0338034c392fa3ae5db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-21 20:11:56 +02:00
Matthias Sohn 7f394cf162 Fix manifests of source bundles
- don't mark them as singleton to allow coexistence of multiple versions
  in the same installation
- add missing version qualifier to Eclipse-SourceBundle header

see
https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg10524.html

Change-Id: Ie4e028038f5a1d3e18b0be06c3d2ea82e7f9068d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-07 11:32:42 +02:00
Matthias Sohn 3a47e45c32 Prepare 3.4.0-SNAPSHOT builds
Change-Id: I5cf20c875c3e92e12c2b22465774ba42513b9add
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-06 00:04:09 +02:00
Matthias Sohn f6c42684d9 JGit v3.4.0.201405051725-m7
Change-Id: I8d941d22becdf019199a1c0fe28aa5835038647d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-05 23:33:03 +02:00
Robin Rosenberg eac7175cce Making ArchiveFormats breaks the API, but that's ok
Add compatibility filters to hide the breakage.

Change-Id: Icc1fdc29f15d734d488e49c9c37a18f5ac937903
2014-04-25 18:59:20 -04:00
Jonathan Nieder d5110c32f9 Allow ArchiveCommand.registerFormat to be called twice
This should make it possible for the gitiles plugin to register its
archive formats after gerrit has already registered them.

Signed-off-by: Jonathan Nieder <jrn@google.com>
Change-Id: Icb80a446e583961a7278b707d572d6fe456c372c
2014-04-16 11:52:02 -07:00
Jonathan Nieder 0a14909bcf Make ArchiveFormats final and implement equals()
This should make it easier to modify ArchiveCommand to allow an
archive format to be registered twice while still noticing if
different callers try to register different implementations for
the same format.

Change-Id: I32261bc8dc1877a853b49e0da0a6e78921791812
Signed-off-by: Jonathan Nieder <jrn@google.com>
2014-04-11 14:01:56 -07:00
Matthias Sohn 47207e98d4 Prepare 3.4.0-SNAPSHOT builds
Change-Id: I907c6f1834c06b8ab4d3e0f76dde475faea7b4a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 02:20:38 +01:00
Matthias Sohn c1fee1d16b Prepare 3.3.1-SNAPSHOT builds
Change-Id: If15560f2731e54dbf9db88d8a308b4c25ce27e8e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 00:34:15 +01:00
Matthias Sohn 3d855dbfc6 JGit v3.3.0.201403021825-r
Change-Id: Iaf3da455f7d6f691617299e881154ff8185a9d46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-03 00:26:54 +01:00
Matthias Sohn 3cebf9c466 Prepare post 3.3.0RC1 builds
Change-Id: I0d808f8733a490b75bbcaacedb4b095e05fab32e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-20 01:04:07 +01:00
Matthias Sohn 8bf45c23df JGit v3.3.0.201402191814-rc1
Change-Id: Ida3a0417ae646ce37214153f49a85de2be3dd4fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-20 00:14:45 +01:00
Robin Rosenberg 4ceb25b602 Tag som non-localizable strings with NON-NLS
Change-Id: I6882c98c2785f38241a81ba5b93892aab79690a5
2014-01-10 14:06:50 +01:00
Matthias Sohn 25fe20b2db Add missing package import for org.eclipse.jgit.archive
The archive bundle needs access to the nls package since 2ecc27db.

Change-Id: I76882e1f270296c5ce8e220e1946c4a8ddb6fdf5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-07 09:22:12 +01:00
Jonathan Nieder 2ecc27db92 archive: Include entries for directories
Entries for directories are optional and mostly wasted space in most
archive formats (except as a place to hang ownership and filesystem
permissions), but "git archive" includes them.  Follow suit.

This will make it easier in a later change to include empty
directories as placeholders for missing submodules.

Change-Id: I1810c686bcc9eb4d73498e4d3e763e18787b088a
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-12-27 08:55:39 -08:00
Matthias Sohn b14a939718 Prepare 3.3.0-SNAPSHOT builds
Change-Id: I7c7e7c1beec0c5d15b96c14c73ce93e3f09855c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-05 22:42:47 +01:00
Matthias Sohn b41b5d723e Add uses directives to ensure OSGi wires jgit bundles correctly
See
http://spring.io/blog/2008/10/20/understanding-the-osgi-uses-directive/

Bug: 420903
Change-Id: I3706a2b8f695d4ce0ee2333722ed7b8d31032f1e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 23:11:16 +01:00
Dave Borowitz 17dc02a579 Merge "Revert "Close unfinished archive entries on error"" 2013-11-01 23:12:29 -04:00
Matthias Sohn 7995d87713 Prepare 3.2.0-SNAPSHOT builds
Change-Id: Iac6cf7a5bb6146ee3fe38abe8020fc3fc4217584
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 18:21:31 +02:00
Matthias Sohn da6e87bc37 Prepare post 3.1.0 builds
Change-Id: I306a3d40c6ddb88a16d17f09a60e3d19b0716962
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 17:29:00 +02:00
Matthias Sohn 16ca725b35 JGit v3.1.0.201310021548-r
Change-Id: I2170b13047d5eab7565f47f9feb1680e03b1ba09
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-02 22:09:19 +02:00
Matthias Sohn 5a2a2222ef Prepare post 3.1.0 RC1 builds
Change-Id: I060f2082ccd0c91905b6b29a49cc633a0b51a1f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 15:54:40 +02:00
Matthias Sohn 6f0681eb9f JGit v3.1.0.201309270735-rc1
Change-Id: I48202dd461110da25f9bc159c938311fff0669e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 13:34:51 +02:00
Jonathan Nieder 3467e865ac Revert "Close unfinished archive entries on error"
This reverts commit 75d9b31f14.
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>
2013-09-23 17:35:15 -07:00
Dave Borowitz 6bbc32a8be TarFormat: use tabs for indent
Change-Id: I2f4c285d2b2f4bdb7a5d1a1026c131417066410d
2013-07-17 12:57:35 -07:00
Jonathan Nieder 75d9b31f14 Close unfinished archive entries on error
Otherwise the underlying error is hidden by an "IOException: This
archives contains unclosed entries." when jgit tries to close the
archive.

Reported-by: Dave Borowitz <dborowitz@google.com>
Change-Id: I594dcdf366200b802e13e5a645fe06597feb7bb4
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-07-17 12:21:56 -07:00
Robin Stocker 01ebfa6c17 Disable warning about assigning to parameter
See change I08bed4275af9ec52aa4d7054067ac82f6a3c9781, where fixing such
warning lead to complaints.

If fixing is not wanted, disable it instead.

Change-Id: If31d4028fa1c6377a11e83ed5688b45701cec68b
2013-06-15 15:11:54 +02:00
Matthias Sohn 6b9c0d1232 Prepare 3.1.0-SNAPSHOT builds
Change-Id: I7490a7c9558423c03e3c167ad55b9a98be9d99d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-13 16:13:32 +02:00
Jonathan Nieder 56cb2d925c Pick default archive format based on filename suffix
Introduce a setFilename() method for ArchiveCommand so callers can
specify the intended filename of the produced archive.  If the
filename ends with .tar, the format will default to tar; if .zip, zip;
if .tar.gz, gzip-compressed tar; and so on.

This doesn't affect "jgit archive" because it doesn't support the
--output=<file> option yet.  A later patch might do that.

Change-Id: Ic0236a70f7aa7f2271c3ef11083b21ee986b4df5
2013-06-06 18:39:04 -07:00
Jonathan Nieder ebfe85d037 Add long filename, large file, and non-ASCII filename support to TarFormat
Attempts to write entries with too-long filenames currently error out:

  $ jgit.pgm/target/jgit archive HEAD >test.tar
  java.lang.RuntimeException: file name 'org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java' is too long ( > 100 bytes)
          at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:288)
          at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:92)
          at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:62)
          at org.eclipse.jgit.api.ArchiveCommand.writeArchive(ArchiveCommand.java:293)
          at org.eclipse.jgit.api.ArchiveCommand.call(ArchiveCommand.java:322)
          at org.eclipse.jgit.pgm.Archive.run(Archive.java:97)
          at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:174)
          at org.eclipse.jgit.pgm.Main.execute(Main.java:213)
          at org.eclipse.jgit.pgm.Main.run(Main.java:121)
          at org.eclipse.jgit.pgm.Main.main(Main.java:95)

That's because the default longFileMode is LONGFILE_ERROR, which
throws an exception for filenames longer than 100 characters.  Switch
to LONGFILE_POSIX.  While at it, handle large files and filenames with
strange encodings, too.

This requires commons compress 1.4, which introduced support for large
files and POSIX long filenames.

Change-Id: I04d5427eec0968b129f55d7a4c6021039a494828
2013-06-06 12:31:46 -07:00
Jonathan Nieder ed5199f63b Add tbz2 archive format
Change-Id: Idb7ff75877a0cfe23f47e10e3f6f93386f5bb145
2013-06-05 19:12:37 -07:00
Matthias Sohn 60a4b5b27e Fix javadoc of FormatActivator
Change-Id: I64b32f71df2964da4cb2de73b34bf7e455ab5b93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-02 00:40:20 +02:00
Matthias Sohn 3ca663af0e Fix version of dependency to package org.osgi.framework
OSGi 4.01 comes with package org.osgi.framework version 1.3 [1] which
has the BundleActivator interface needed by org.eclipse.jgit.archive.
OSGi 5.0 matches package org.osgi.framework version 1.7 [2].

[1] http://www.osgi.org/javadoc/r4v401/
[2] http://www.osgi.org/javadoc/r5/core/

Change-Id: I10f78e5eb02b5d03395f23d2f0ad039caf565269
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-01 23:55:42 +02:00
Jonathan Nieder 659cadf06d Add missing javadoc for archive code
Document archive formats, the archive format interface, and the
parameters of the GitAPIException constructors.  Noticed by eclipse.

Reported-by: Dani Megert <Daniel_Megert@ch.ibm.com>
Change-Id: I22b5f9d4c0358bbe867c1906feec7c279e214273
2013-05-29 12:36:36 -07:00
Jonathan Nieder dbf8d95daa Drop unnecessary "throws" clauses in archive code
Noticed by eclipse.

Change-Id: I730b290556066038efeaf2436de95415b175f351
2013-05-29 12:35:12 -07:00
Jonathan Nieder 679382fb20 Move FormatActivator.start()/stop() to a separate class
This makes the functionality of registering all formats from the
org.eclipse.jgit.archive package available in contexts where
FormatActivator cannot be built because the OSGi core framework is not
readily available to build against.

Change-Id: If8e3487e933783a7e12f8e1838cbfe0b5862ce80
2013-05-29 12:34:04 -07:00
Jonathan Nieder 7f2f59734c Add tgz and txz archive formats
Change-Id: I347e8a9a112d142ccef91cba1d6e997d645ca70a
2013-05-28 16:51:39 -07:00
Jonathan Nieder 68d92182e6 Maintain list of archive formats in one place
Add a static start() method to FormatActivator to allow outside
classes such as the Archive subcommand of the jgit program to use it
without a BundleContext.  This way, the list of formats only has to be
maintained in one place.

While at it, build a list of registered formats at start() time, so
stop() doesn't have to repeat the same list of formats.

Suggested-by: Shawn Pearce <spearce@spearce.org>
Change-Id: I55cb3095043568740880cc9e4f7cde05f49c363c
2013-05-28 16:51:32 -07:00
Jonathan Nieder 56276d053f Move ArchiveCommand into standard porcelain API
Allow use of ArchiveCommand without depending on the jgit command-line
tools.

To avoid complicating the process of installing and upgrading JGit,
this does not add a dependency by the org.eclipse.jgit bundle on
commons-compress.  Instead, the caller is responsible for registering
any formats they want to use by calling ArchiveCommand.registerFormat.

This patch puts functionality that requires an archiver into a
separate org.eclipse.jgit.archive bundle for people who want it.  One
can use it by calling ArchiveCommand.registerFormat directly to
register its formats or by relying on OSGi class loading to load
org.eclipse.jgit.archive.FormatActivator, which takes care of
registration automatically.

Once the appropriate formats are registered, you can make a tar or zip
from a git tree object as follows:

	ArchiveCommand cmd = git.archive();
	try {
		cmd.setTree(tree).setFormat(fmt).setOutputStream(out).call();
	} finally {
		cmd.release();
	}

Change-Id: I418e7e7d76422dc6f010d0b3b624d7bec3b20c6e
2013-05-24 17:30:18 -07:00