Commit Graph

3747 Commits

Author SHA1 Message Date
Dave Borowitz c1d40caa32 TestRepository: Optionally insert Change-Id in commit message
Copied the implementation from CommitCommand.

Change-Id: Iade0e2d70bde70cfa830fe23bcc41959b011a14a
2015-03-12 10:47:12 -07:00
Shawn Pearce c3b8615ce8 Merge topic 'testrepo'
* changes:
  TestRepository: Allow custom author/committer per-commit
  TestRepository: Use try-with-resources where appropriate
2015-03-12 13:11:21 -04: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
Dave Borowitz 3d5e70bc5a TestRepository: Allow custom author/committer per-commit
Change-Id: I078fe00470ebe60f93f4a718c163dd1412fdc776
2015-03-11 11:41:02 -07:00
Dave Borowitz 6599111d92 TestRepository: Use try-with-resources where appropriate
Change-Id: I06f9534ab84278df37a140700fc2bed5ab667299
2015-03-11 11:41:00 -07:00
Shawn Pearce d1bda470d4 Merge "ArchiveCommand: Allow to pass options to underlying stream" 2015-03-11 13:27:18 -04:00
Shawn Pearce 0f51246b0e Merge changes I627681be,I334034a2
* changes:
  TreeWalk: Do not close reader passed explicitly to constructor
  TreeWalk: Stop using deprecated ObjectReader#release()
2015-03-10 19:55:20 -04:00
Dave Borowitz 6f4281b11a TreeWalk: Do not close reader passed explicitly to constructor
The TreeWalk(ObjectReader) constructor is explicitly to handle the case
where the caller is responsible for opening and closing the reader.
The reader should only be closed when it was created in the
TreeWalk(Repository) constructor.

Change-Id: I627681be80d69ea549f953255a64c7b3b68bcec9
2015-03-10 16:27:22 -07:00
Dave Borowitz 421e69a4a0 TreeWalk: Stop using deprecated ObjectReader#release()
Change-Id: I334034a2991a07664302bc8d1f3dead85c2caffe
2015-03-10 16:27:22 -07:00
Matthew Spurrier 1383bdd5bc Make s3 domain dynamic to support different s3 regions
Change-Id: If8f9e85368c56d88bb6ae9efe1b3a29cc18cc1d5
Signed-off-by: Matthew Spurrier <matthew@spurrier.com.au>
2015-03-10 16:11:48 -07:00
Dave Borowitz 1e694f3847 RevWalk: Do not close reader passed explicitly to constructor
The RevWalk(ObjectReader) constructor is explicitly to handle the case
where the caller is responsible for opening and closing the reader.
The reader should only be closed when it was created in the
RevWalk(Repository) constructor.

Change-Id: Ic0d595dc8d10de79e87549546c6c5ea2dc617e9b
2015-03-10 15:27:53 -07:00
Dave Borowitz a91f87d9e1 RevWalk: Stop using deprecated ObjectReader#release()
Change-Id: If4d34f18352bd17467aeded6fd3478f29244657b
2015-03-10 15:24:53 -07:00
Dave Borowitz 019a21db27 Update all standard maven plugins to latest versions
The latest versions of the javadoc and source plugins in particular
avoid some pathological slowness I'd been seeing on Linux with Java
7 or later.

Change-Id: I9fddd7e6ef513debec5f014ed2efc4fea6917d1f
2015-03-10 14:41:04 -07:00
Christian Halstrick af3faa764f Merge "Add "--long" option to JGit describe" 2015-03-10 15:17:58 -04:00
Shawn Pearce 7ab6ffdf50 Remove AutoCloseable from internal PackFile and friends
PackFile is held by the block cache and cannot be auto closed in a
try-with-resources statement.  Remove the interface as JGit does
explicit management of the instances.

ObjectDatabase and RefDatabase are internal details of Repository
and are managed with the Repository. Marking them AutoCloseable
provides no value to the library or an application using the API.

Change-Id: Ibee19eadd66233e6666b601583daa1834a7778f1
2015-03-09 20:59:09 -04:00
Shawn Pearce ce3997344e PushCertificateParser: Fix check for blank line after header
Reference equality (!= or ==) cannot be used to check for
String equality. String objects are not necessarily interned
to the same instance.

Use .isEmpty() since the function only cares about an empty
string and does not need to test a specific string value.

Change-Id: If530cb59666a8196d57d2348c893706a517ea541
2015-03-09 17:30:08 -07:00
Shawn Pearce 8cf14cfdad Cleanup some push certificate related javadoc
Change-Id: I319ee4e99462598bf6a934b1efc7939bc4b057a5
2015-03-09 17:28:16 -07:00
David Pletcher fe7c556f34 Fix an invalid format string
The %x format specifier is not valid for a byte array.
This patch fixes a bug that would cause an IllegalFormatConversionException.

Change-Id: I025975eca7b2f10bbafa39f5519f8668e6536541
Signed-off-by: David Pletcher <dpletcher@google.com>
2015-03-09 15:47:01 -07:00
Christian Halstrick 0e3ddea1b0 Add "--long" option to JGit describe
Native git supports "git describe --long". This will enforce returning a
long description of a commit even if a tag is directly pointing to the
commit (in contrast to just returning the tag name as it is now). This
commit teaches JGits DescribeCommand and the describe command in the pgm
package to support "--long".

Bug: 460991
Change-Id: I65e179b79e89049c6deced3c71cb3ebb08ed0a8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-09 13:48:04 -07:00
Matthias Sohn a8fb77853a Merge "Support for the commit-msg hook." 2015-03-02 18:17:57 -05:00
Shawn Pearce a75bd35fa4 Merge "Allow public access to PackIndex" 2015-03-02 16:28:35 -05:00
David Pletcher cc8c270c9b Allow public access to PackIndex
The index provides access to a list of objects in a pack.
This will be helpful for repository integrity checking.

Change-Id: I435eeeb3fe1b1f5632d40528936416e97491d412
Signed-off-by: David Pletcher <dpletcher@google.com>
2015-03-02 15:52:27 -05:00
Laurent Delaigue efeb02bf2b Support for the commit-msg hook.
This hook uses the file .git/COMMIT_EDITMSG to receive and potentially
modify the commit message.

Change-Id: Ibe2faadfb5d3932a5a3da2252d8156c4c04856c7
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-02 17:45:15 +01:00
Laurent Delaigue 26fd56f167 Refactored pre-commit hook to make it less invasive.
Hooks are now obtained via a convenient API like git commands, and
callers don't have to check for their existence.
The pre-commit hook has been updated accordingly.

Change-Id: I3383ffb10e2f3b588d7367b9139b606ec7f62758
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-02 15:33:30 +01:00
Dave Borowitz 12a55c3475 Add an in-process pack transport for use in tests
This allows for testing arbitrary sets of push/fetch hooks (e.g.
PreReceiveHook) without depending on either an external protocol (e.g.
HTTP) or the local filesystem.

Change-Id: I4ba2fff9c8a484f990dea05e14b0772deddb7411
2015-02-27 16:26:39 -08:00
Dave Borowitz 900d7da8ab Extract classes for transport within a JGit process
TransportLocal knows how to spin up a thread to allow two repositories
in the same process to communicate using the wire protocol. However,
it is still tied to local on-disk filesystems, and needs to be able to
fork processes if not using the default git-{upload,receive}-pack
implementation.

Extract out the connection classes so they can be used by other
transport implementations.

Change-Id: I5db59086740735508c2e70a597c2d1a89014b072
2015-02-27 15:22:15 -08:00
Matthias Sohn 360071d75d Add missing since tags for new API
Change-Id: I90d4d7566b2e220b8ea8ea1c644fe4b7fa81c0a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 02:33:05 +01:00
Matthias Sohn 1350f7ea1d Merge branch 'stable-3.7'
* stable-3.7:
  Prepare 3.7.1-SNAPSHOT builds
  JGit v3.7.0.201502260915-r
  Read user.name and email from environment first
  Provide more details in exceptions thrown when packfile is invalid

Change-Id: I427f861c6bc94da5e3e05dbbebbf0ad15719a323
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 01:54:12 +01:00
Matthias Sohn 9b486e3906 Prepare 3.7.1-SNAPSHOT builds
Change-Id: I2e97610ea9e552e5800e7ca895fd193c8bc507aa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 01:41:30 +01:00
Matthias Sohn a312131d79 JGit v3.7.0.201502260915-r
Change-Id: Iec17746cad81cfb1d775e782b30f9d8a13c938b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-26 15:13:01 +01:00
Christian Halstrick 1adac45550 Merge "Read user.name and email from environment first" into stable-3.7 2015-02-25 12:01:43 -05:00
Matthias Sohn 102c50e177 Add/fix since tags for new API for push certificates
This was missed in change I249869cadb2d55aef016371b9311b8583591b9cf

Change-Id: I19c9d4c04b6aa92b9e04c192dee70775d6985b58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-25 14:18:12 +01:00
Matthias Sohn d216ce4143 Merge branch 'stable-3.7'
* stable-3.7:
  Add log4j and slf4j-log4j bridge to jgit feature
  Use slf4j to log instead of printing to System.err
  Use Target Platform Definition DSL to generate target platforms

Change-Id: Ic8779868150c910fa55fd20348e35723e6add0f1
2015-02-24 23:45:19 +01:00
Matthias Sohn a8fd029a93 Read user.name and email from environment first
According to [1] user name and email are taken first from the
environment variables:
GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL

In case (some of) these environment variables are not set, the
information is taken from the git configuration.

JGit doesn not yet support the environment variables GIT_AUTHOR_DATE and
GIT_COMMITTER_DATE.

[1] https://www.kernel.org/pub/software/scm/git/docs/git-commit-tree.html#_commit_information

Bug: 460586
Change-Id: I3ba582b4ae13674cf319652b5b13ebcbb96dd8ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-24 16:39:19 +01:00
Stefan Beller b9725a54fd Port push certificates
Push certificates ("git push --signed") have been part of
git-core since version 2.2.0 (released Nov 26 2014). We also
want to support that feature.

This is not complete and is lacking the actual functionality
to validate the signature for now.

Change-Id: I249869cadb2d55aef016371b9311b8583591b9cf
Signed-off-by: Stefan Beller <sbeller@google.com>
2015-02-23 17:15:43 -08: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 57644f23a1 Provide more details in exceptions thrown when packfile is invalid
Mention packfile path in exceptions thrown when we detect that a
packfile is invalid and make excplicit that corrupt packs are removed
from the pack list.

Change-Id: I454ada5f8e69307d3f34d1c1b8f3cb87607ddf35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 14:13:22 +01:00
Matthias Sohn a8743df19c Add log4j and slf4j-log4j bridge to jgit feature
CQ: 9207
CQ: 9241
Change-Id: Ic06a06da0a74f8fa494c0753cbe9ed2356c21ab3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 01:06:45 +01:00
Matthias Sohn c18694e0d1 Use slf4j to log instead of printing to System.err
CQ: 9206
Bug: 458445
Change-Id: Ic68fb7dbe0fb46bf30f157db45bf18d8f3a704c0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 01:06:17 +01:00
Matthias Sohn af4bde1ed2 Use Target Platform Definition DSL to generate target platforms
The "Target Platform Definition DSL and Generator" [1] heavily
simplifies maintenance of target platforms. It allows to modularize
target platform definitions which eliminates code duplication. The
.target files understood by P2 and Tycho are generated from .tpd files
which are written in the target platform definition DSL.

In order to edit .tpd files and generate .target files install the
"Target Platform Definition DSL and Generator" 2.0 or later [2]  (Note:
on Kepler you also need to add [3] to get Xtext 2.5 which is not
available by default on Kepler). This tools is needed only if you need
to change the Target Platform definition files (*.targetplatform and
*.tpd) and re-generate the *.target files. In normal development you do
not need this and can simply use the generated *.target themselves.

In addition
- update Orbit repository for 4.5 to Mars M5
- use latest released Orbit p2 repository for platform version Luna
  and earlier

[1] https://github.com/mbarbero/fr.obeo.releng.targetplatform
[2] http://mbarbero.github.io/fr.obeo.releng.targetplatform/p2/latest/
[3] http://download.eclipse.org/modeling/tmf/xtext/updates/releases/

Change-Id: Ia701972785c3e88aba66a7f15a2b3cf638727eea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 00:12:01 +01:00
Matthias Sohn 6c1f739388 Move console classes to pgm bundle
Since we updated minimum Java version to Java 7 the console bundle
doesn't need to be a separate bundle anymore. Move the contained classes
to the pgm bundle which is using these classes.

Change-Id: If8e6f2d7405fdfe6f4b178673b4ccf99c67d4b64
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-10 09:14:48 +01:00
Matthias Sohn 77030a5e94 Implement AutoClosable interface on classes that used release()
Implement AutoClosable and deprecate the old release() method to give
JGit consumers some time to adapt.

Bug: 428039
Change-Id: Id664a91dc5a8cf2ac401e7d87ce2e3b89e221458
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +01:00
Matthias Sohn 27ae8bc655 Implement AutoClosable interface to support try-with-resources block
Bug: 428039
Change-Id: I41880862db5303b5bea4b2184ba7844d69c997b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +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 21f667edba Merge branch 'stable-3.7'
* stable-3.7:
  Add option --orphan for checkout
  Prepare post 3.7.0.201502031740-rc1 builds
  JGit v3.7.0.201502031740-rc1
  Support for the pre-commit hook
  Fix FileUtils.testRelativize_mixedCase which failed on Mac OS X
  Add a hook test
  Introduce hook support into the FS implementations
  If a pack isn't found on disk remove it from pack list

Conflicts:
	org.eclipse.jgit.java7.test/META-INF/MANIFEST.MF

Change-Id: I936acd24d47b911fa30ab29856094e1b2c6ac3db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-04 14:21:52 +01:00
Rüdiger Herrmann fc801dd79f Add option --orphan for checkout
Change-Id: I546a93f3e147d8d6fc70094b22679c0d11cd8921
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2015-02-04 13:35:32 +01:00
Matthias Sohn 3c2b4086b6 Prepare post 3.7.0.201502031740-rc1 builds
Change-Id: Id3728e771a4441757de016cc9d68055f668126b0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-04 02:04:47 +01:00
Matthias Sohn 8fe6e51be2 JGit v3.7.0.201502031740-rc1
Change-Id: Ia2ea65945b7e1d4120da3d6e6c9f6d5fdb642ae6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-03 23:36:31 +01:00
Laurent Goubet 494e893c54 Support for the pre-commit hook
Introduce support for the pre-commit hook into JGit, along with the
--no-verify commit command option to bypass it when rebasing /
cherry-picking.

Change-Id: If86df98577fa56c5c03d783579c895a38bee9d18
Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-02 21:23:32 +01:00
Matthias Sohn d2e0bfa568 Fix FileUtils.testRelativize_mixedCase which failed on Mac OS X
HFS is case insensitive hence expecting it to return the result for case
sensitive filesystem doesn't work.

Change-Id: I292eab78e50711529a0412f9a54e174a3ac16109
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-02 21:23:31 +01:00