Commit Graph

4281 Commits

Author SHA1 Message Date
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
Matthias Sohn 34b4a564ea Merge branch 'stable-4.2'
* stable-4.2:
  BundleWriterTest: Open RevWalk in try-with-resource
  DiffFormatterTest: Remove accidentally added trailing whitespace
  CherryPickCommandTest: Create Git instances in try-with-resource
  DiffFormatterTest: Create auto-closeable instances in try-with-resource
  ConfigTest: Create Git instance in try-with-resource
  CommitAndLogCommandTest: Use assumeFalse to skip test on Windows
  CommitAndLogCommandTest: Create Git instances in try-with-resource
  AddCommandTest: Create Git instances in try-with-resource
  ArchiveCommandTest: Create Git instances in try-with-resource
  TagCommandTest: Instantiate Git and RevWalk objects in try-with-resource
  BlameCommandTest: Instantiate Git objects in try-with-resource
  SideBandOutputStreamTest: Use try-with-resource
  FileTreeIteratorJava7Test: Create Git instances in try-with-resource

Change-Id: Ib572e98e6117b70442aee9cd7e7b8c3cf65562a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 14:04:39 +01:00
Laurent Delaigue 1e1fb9fc59 Add progress monitor to Merger
Monitoring progress of merges can be useful for users for large
repositories or complex merge processes that take some time.

This enables setting a monitor. Existing merge implementations in jgit
do not yet report progress if a monitor is set. This will be added in a
later change.

Change-Id: I17b978b3fc91750dd88649638b90a46820a0877c
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 11:37:26 +01:00
David Pursehouse 7e8e4ec019 BundleWriterTest: Open RevWalk in try-with-resource
Change-Id: Ie25770a73b19d6522bad9fdc0966f48370f96265
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 19:13:23 +09:00
David Pursehouse 2a7b3ff00b DiffFormatterTest: Remove accidentally added trailing whitespace
Change-Id: Ia7a3b05b79c3a5530a4445e6e48ceae445425224
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 19:12:12 +09:00
David Pursehouse 776030f198 CherryPickCommandTest: Create Git instances in try-with-resource
Change-Id: I9d49258bdf12f3221013c37cfb8a21ea27f28860
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 18:07:54 +09:00
David Pursehouse 1257cfc262 DiffFormatterTest: Create auto-closeable instances in try-with-resource
Git, ByteArrayOutputStream, and DiffFormatter are auto-closeable and
should be managed in try-with-resource.

Change-Id: I83395116acb4b4f7cd4300fd69564355bc07e4bb
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 17:01:25 +09:00
David Pursehouse 72c94465bc ConfigTest: Create Git instance in try-with-resource
Change-Id: Ie65c69e0f1aed95bcdf68ebd68d21b3e2590b41c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 15:31:56 +09:00
David Pursehouse ce1a3d7ef8 CommitAndLogCommandTest: Use assumeFalse to skip test on Windows
Use JUnit's assumeFalse method to cause the test to skip when
run on Windows.

Change-Id: I3f59440cfe62c37c127e381052b60471fbe8ec5e
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 15:30:49 +09:00
David Pursehouse b1d188fbb7 CommitAndLogCommandTest: Create Git instances in try-with-resource
Change-Id: Id06417f1d3914cd3addacdbe9b5801a06cc3955f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 15:25:46 +09:00
Shawn Pearce 17e6d8d42b Merge "Fix unused throws CorruptObjectException from addTree" 2016-01-21 01:20:43 -05:00
Shawn Pearce 08aac5904e Merge "Fix TransportException when reading bundle" 2016-01-21 01:15:12 -05:00
Chris Gavin d2bf41e7dd Fix TransportException when reading bundle
When reading a bundle file, commit messages who's oneline format is
longer than 982 characters caused JGit to treat subsequent text in
the commit as a SHA, then throw a TransportException because it's
not a valid SHA.

Now the readLine method will read all the way to the end of the
line, not just the first 1024 characters of it.

Change-Id: If15b491aa9a1e4fd9b8bbed2dd9e6be47a64ccb7
Signed-off-by: Chris Gavin <chris@chrisgavin.me>
2016-01-21 01:14:56 -05:00
Shawn Pearce c6f9c47fda Fix unused throws CorruptObjectException from addTree
2262a794b4 removed throws CorruptObjectException, but was not
compiled under Eclipse and did not see errors generated by Eclipse.
Maven build silently ignored the unnecessary code.

Change-Id: I6e9014adcc604588e10e5963d13d0c6ef0e1c617
2016-01-20 22:08:23 -08:00
Shawn Pearce 8fe9a8baf5 Merge changes from topic 'reftree'
* changes:
  debug-rebuild-ref-tree: Copy HEAD into RefTree
  debug-rebuild-ref-tree: Add --enable flag to turn the database on
  RefTreeDatabase: Allow ORIG_HEAD, etc. on non-bare repositories
  RefTreeDatabase: Expose bootstrap refs in getAdditionalRefs
2016-01-21 00:32:17 -05:00
Shawn Pearce 8d0551dd64 Merge changes from topic 'ketch'
* changes:
  daemon: Add --ketch=LEADER flag
  Ketch: Intercept push and route it through Ketch
  Ketch: Simple map of running leader instances
  Ketch: Basic replication system
2016-01-20 23:15:09 -05:00
David Pursehouse a8d99d9a4f AddCommandTest: Create Git instances in try-with-resource
Change-Id: Idf42f03099eeb9975fef9492ea8a75776afc2a3c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 10:22:52 +09:00
David Pursehouse a833fec219 ArchiveCommandTest: Create Git instances in try-with-resource
Change-Id: Icbfd92395db85818736142fd3fb3432385e89ca9
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 10:22:18 +09:00
Shawn Pearce 7b6122908b Merge "TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)" 2016-01-20 11:03:47 -05:00
Shawn Pearce 2262a794b4 TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)
This form of addTree() does not parse any objects and cannot throw the
declared checked exception.  Callers are being forced to try-catch
CorruptObjectException that cannot occur when the iterator instance
has already been constructed.

Change-Id: Id338035302903bab81569d1576eab063eee0885a
2016-01-20 07:41:08 -08:00
Christian Halstrick 7182cb2a26 Fix ResetCommand to return the resulting ref
ResetCommand was not returning the updated ref as a result of the call()
method. Since the ResetCommand is always updating the same ref (HEAD)
this should always be the HEAD ref.

Bug: 440750
Change-Id: I7974975c3ab05e68c208384e69cf0692ded6e8db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-20 11:27:31 +01:00
Christian Halstrick da43d8d798 Add option to allow empty commits to CommitCommand
CommitCommand should allow to specify whether empty commits (commits
having the same tree as the sole predecessor commit) are allowed or not.
Similar to native git's "--allow-empty" flag.

The defaults differ between JGit and native git even after this change.
When not specifying paths then by default JGit allows to create empty
commits while native git does not. It would be API breaking to change
this now.

Bug: 460301
Change-Id: I88feb0c3ffb2c686b1d0594e669729b065cda4cb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-20 11:14:19 +01:00
David Pursehouse ebbd007639 TagCommandTest: Instantiate Git and RevWalk objects in try-with-resource
Change-Id: I08959650e2970e964bc864dc6d120d7bddfd8232
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-20 18:39:45 +09:00
David Pursehouse 41ace0580c BlameCommandTest: Instantiate Git objects in try-with-resource
Change-Id: Icb9e6bb9ee99589fa2e0388c8b305a8a1f5954db
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-20 18:39:25 +09:00
Shawn Pearce da5ef91ad0 daemon: Add --ketch=LEADER flag
Experimental flag to turn on the KetchLeader within this daemon JVM.
This is a manually elected leader process, set from the command line.
Remote followers for each repository are configured per-repository
using remote sections with ketch-type = FULL. For example:

Manually elected leader's $GIT_DIR/config:

  [ketch]
    name = A

  [remote "A"]
    ketch-type = FULL

  [remote "B"]
    url = git://127.0.0.1:9421/sample.git
    ketch-type = FULL

  [remote "C"]
    url = git://127.0.0.1:9422/sample.git
    ketch-type = FULL

Replica B and C daemons:

  git daemon \
    --export-all \
    --enable=receive-pack \
    --listen=127.0.0.1 --port=9421 \
    --base-path=$HOME/ketch_test/follower_one \
    $HOME/ketch_test/follower_one &

  git daemon \
    --export-all \
    --enable=receive-pack \
    --listen=127.0.0.1 --port=9422 \
    --base-path=$HOME/ketch_test/follower_two \
    $HOME/ketch_test/follower_two &

Change-Id: I165f85970a77e16b5263115290d685d8a00566f5
2016-01-19 23:05:28 -08:00
Shawn Pearce 1f9d205043 Ketch: Intercept push and route it through Ketch
Capture commands and pass to the in-process KetchLeader, allowing
it to replicate to followers.

Change-Id: I25dfeb2a93821af65354337f391480a72bae2210
2016-01-19 23:04:41 -08:00
Shawn Pearce b718e3d304 Ketch: Simple map of running leader instances
Supports use in basic daemons where RepositoryCache is also effective.

Change-Id: Ia736b32c2c710b5a802233badc0d30818de763cd
2016-01-19 23:03:35 -08:00
Shawn Pearce 9b33f4aeeb Ketch: Basic replication system
Git Ketch is a multi-master Git repository management system.  Writes
are successful only if a majority of participant servers agree.  Acked
writes are durable against server failures as a majority of the
participants store all required objects.

Git Ketch is modeled on the Raft Consensus Algorithm[1].  A ketch
sailing vessel is faster and more nimble than a raft.  It can also
carry more source codes.

Git Ketch front-loads replication costs, which vaguely resembles a
ketch sailing vessel's distinguishing feature of the main mast on the
front of the ship.

[1] https://raft.github.io/
Change-Id: Ib378dab068961fc7de624cd96030266660b64fb4
2016-01-19 23:03:32 -08:00
David Pursehouse 0d77b4e5c8 SideBandOutputStreamTest: Use try-with-resource
Factor out the creation of the SideBandOutputStream objects into
a utility method that wraps it in a try-with-resource.

Remove the "unused" suppression that is now unnecessary, and add
declaration that the tests methods can throw Exception.

Change-Id: Iff02e4e3532bd6ab6e423f197e70d44c4f328d0b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-20 11:38:35 +09:00
David Pursehouse 7c21aeb508 FileTreeIteratorJava7Test: Create Git instances in try-with-resource
Change-Id: I493e90e8a0d96db5acc49759c8e138b0a8c7b099
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-20 11:23:50 +09:00
Matthias Sohn a01d6c1e55 Merge "Remove declared IOException which is no longer thrown" 2016-01-19 20:05:35 -05:00
Matthias Sohn 3af05f6080 Remove declared IOException which is no longer thrown
Since 2ccea7f0 ChangeIdUtil.computeChangeId() doesn't throw IOException
anymore.

Change-Id: I0bf43f2346dadbbfe7e6cbcb38b5525456fbf686
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-20 01:55:51 +01:00
David Pursehouse aca07fac46 Merge branch 'stable-4.2'
* stable-4.2:
  CheckoutCommandTest: Create Git instances in try-with-resource
  BranchCommandTest: Create Git instances in try-with-resource
  CheckoutTest: Create Git instances in try-with-resource
  BranchTest: Create Git instances in try-with-resource
  URIishTest: Use @Test annotation's `expected` argument
  Suppress "The allocated object is never used" warning in tests
  Add $NON-NLS to suppress "Non-externalized string literal" warnings
  Don't use deprecated constructors of CmdLineException
  Prepare 4.2.0-SNAPSHOT builds
  Remove org.eclipse.jgit.updatesite project from tools/version.sh
  RevParse: Remove superfluous semicolon
  RefUpdateTest: Use try-with-resource for auto-closable types
  RefUpdateTest: Add null check to prevent potential NPE
  CommitCommand: Remove redundant null check
  JGit v4.2.0.201512141825-rc1

Change-Id: I2179859289b2f2e3d0b7c6d02ef7e7890c467f7b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-20 09:45:48 +09:00
Dave Borowitz 2ccea7f05a ChangeIdUtil: Don't throw IOException
This could have only happened during the getBytes call. Instead, use
Constants.encode, which is a non-throwing implementation.

This change is binary compatible with existing code compiled against
older versions of JGit, although it might break compilation of
previously compiling code due to dead catch blocks.

Change-Id: I191fec5cac718657407230de141440e86d0151fb
2016-01-19 17:59:19 -05:00
Shawn Pearce a693d7b33c Merge "Transport: Implement AutoCloseable" 2016-01-19 17:36:39 -05:00
Shawn Pearce 6b662af76e Transport: Implement AutoCloseable
After creating a Transport instance callers should always call
its close() method. Use AutoCloseable to document this idiom
and allow use of try-with-resources.

Change-Id: I0c6ff3e39ebecdd7a028dbcae1856a818937b186
2016-01-19 14:27:11 -08:00
Shawn Pearce 68a6d0c0ab Merge changes from topic 'deadtree'
* changes:
  Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends being removed
  Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""
2016-01-19 17:08:54 -05:00
Shawn Pearce 9d3b56a905 Merge "ReceiveCommand.abort(): Utility to mark batch of commands as failed" 2016-01-19 15:54:07 -05:00
Shawn Pearce 462017e02b Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends being
removed

Bug: 486105
Change-Id: I04adcdb68bee7d5f608bb7ab959fe36a890f9ecd
2016-01-19 18:49:11 +01:00
Andrey Loskutov 7f31a9c9ad Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and
friends""

This reverts commit 2cc80187d3.

Bug: 486105
Change-Id: Id4f9987c33d66cbed9de6e4d4d6784afdd01a3cf
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-01-19 18:48:48 +01:00
David Pursehouse 4b93de43ba CheckoutCommandTest: Create Git instances in try-with-resource
Also rename a local variable in one of the tests that was hiding
a class variable of the same name.

Change-Id: Ia9398157b87a78df6eef0b64a833c16ca2e57ce3
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:47 +01:00
David Pursehouse 78b3f174f2 BranchCommandTest: Create Git instances in try-with-resource
Also remove a local variable in one of the tests that was
hiding a member variable with the same name.

Change-Id: Ia4d94cdbf2d83d8be2645f0a93d8891d01606c59
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
David Pursehouse 7f84e40f31 CheckoutTest: Create Git instances in try-with-resource
Change-Id: I49a03f7bee0b61c062ce160674f9aa0cd1bcc8ba
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
David Pursehouse 9d721de69b BranchTest: Create Git instances in try-with-resource
Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
David Pursehouse 3b63a242ef URIishTest: Use @Test annotation's `expected` argument
Specify the expected exception in the annotation, instead of
catching it and calling `fail()` when it wasn't raised.

Change-Id: I8a640c0e42353533e4e73b85b50c224dc060f2d7
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
David Pursehouse 75e096c80a Suppress "The allocated object is never used" warning in tests
Change-Id: Ibb405e0b36ce5a2cb30268a7de31ab2bd079ad80
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:45 +01:00
David Pursehouse 9ddc0ed83d Add $NON-NLS to suppress "Non-externalized string literal" warnings
Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:45 +01:00
David Pursehouse d1e821ec3f Don't use deprecated constructors of CmdLineException
Change-Id: If01fa896537209821d6a7a262ee978572195a397
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:44 +01:00
Matthias Sohn 62718a9cbc Merge "Prepare 4.2.0-SNAPSHOT builds" into stable-4.2 2016-01-19 10:04:06 -05:00
Matthias Sohn cc0afe601b Merge "Remove org.eclipse.jgit.updatesite project from tools/version.sh" into stable-4.2 2016-01-19 09:15:59 -05:00