Commit Graph

3313 Commits

Author SHA1 Message Date
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
Shawn Pearce bc90ce7788 PackWriter: Report more stats during partial writes
It can be useful for a server operator to know how long a pack
writer spent writing out objects, even if the request aborts and
never finishes.

Record more of the stats data inside of a finally block, to
ensure these can be included into the server's monitoring.

Change-Id: I00858aa393a948f8e742e64ae4c00953eadaef95
2014-09-04 12:45:18 -07:00
Robin Rosenberg 2475d95374 Update the README with current modules and features
Change-Id: Ic30f55f30ce260dc02c428e1ebf11f01cb790a6e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-04 15:48:00 +02:00
Robin Rosenberg 05896dabfc Drop warnings about unchecked casts in a few stable select places
Change-Id: Ie163a4940f0d13bbdefd8c4643c0944c71800544
2014-09-04 11:35:19 +02:00
Robin Rosenberg 4c6857d1ec Hide warnings about field hiding in the MyersDiff code
Just suppress warning in this stable code rather then fixing names

Change-Id: I07580aa3cbdaa66852a5c919769bbd9020d78703
2014-09-04 11:35:18 +02:00
Robin Rosenberg 409c32b1cf Fix warnings about missing serialVersionUID
Use @SuppressWarnings since these are private classes

Change-Id: Ic8e4c08b70627a3f9b031e2474092e1ce8116f22
2014-09-04 11:35:18 +02:00
Robin Rosenberg 1bb72eb758 Fix warning about missing serialVersionUID
Change-Id: Ia9532d1aaf92df9073c85c44ff2ca94796deefc2
2014-09-04 11:35:17 +02:00
Robin Rosenberg 2f6372337c Rename local variables/parameters to remove warnings about hiding
Change-Id: I73f38492b6a2e7fd6e77005efd0a8a8c65763e74
2014-09-04 11:35:16 +02:00
Robin Rosenberg 547f05d675 Remove non-existing source directories from Java 7 test build
This was a copy-artifact when the bundle was created. This chanhe
removed some warnings in Eclipse.

Change-Id: I32acdf4b60bf5528566e66b1fd82113b1343ed37
2014-09-04 11:28:03 +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 00c4a73fbc Windows: Hide the .git directory if hidedotfiles is set to non-false
Other .git files are not hidden with this patch

Change-Id: Idf63ca08d08f3a77c33f5848d02074f8d6a75758
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-04 11:24:54 +02:00
Robin Rosenberg 348dd52ef1 Add the resources directory to the Eclipse classpath
This removes a warning in Eclipse.

Change-Id: I5961ebf2052aff3e5d853451f69c7d75890ac53a
2014-09-04 11:05:38 +02:00
Konrad Kügler 9ac59efbbd PlotCommitList: Close plot lanes at root commits
Bug: 443006
Change-Id: I40b1eb044fa2d9e6c5d4b956c17e32ca6c1bd39f
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-09-02 07:57:04 -04:00
Matthias Sohn 3885ce2a94 Prevent NPE if no CredentialsProvider is registered
If the git server requires authentication and no CredentialsProvider is
registered TransportHttp.connect() would throw an NPE since it tries to
reset the credentials provider. Instead throw a TransportException
explaining the problem.

Change-Id: Ib274e7d9c43bba301089975423de6a05ca5169f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-01 11:27:17 +02:00
Axel Richard 46f3007b52 Handle -m option for Merge command
Set the commit message to be used for the merge commit (in case one is
created)

Bug: 442886
Change-Id: Ie5ecc13822faa366f00b3daa07f74c8441cae195
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-30 01:17:24 +02:00
Shawn Pearce 7b7d033ee1 UploadPack: Always make PackWriter.Statistics available
If the packer fails, still obtain the stats and make them available
to the logger and the caller. Failures can frequently happen when
a client disconnects in the middle of a pack stream. Server admins
may still want to examine the timing metrics from counting and
compressing phases.

Change-Id: Iceae4f68b5473f4223d85c9edfb57837fc818eed
2014-08-29 12:56:17 -07:00
Marc Strapetz 6be184e15c PackIndexV2 should check for possible corruption
Change-Id: I1803ec6d8141f07dd4085778da6461abe81c30a9
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2014-08-29 10:08:42 +02:00
Yuxuan 'fishy' Wang 9ea357f336 Allow projects without path attribute in manifest.
In such case, we use the name attribute as the default value of path.

Change-Id: I53fa312d6b64c6eb2240f08af7d1d60cea99192a
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-28 21:16:56 -07:00
Shawn Pearce 7b28130758 Merge "PackIndexV2: fix possibly wrong check" 2014-08-28 19:53:36 -04:00
Saša Živkov c4797fe986 Let ObjectWalk.markUninteresting also mark the root tree as
uninteresting

Using the ObjectWalk and marking a commit as uninteresting didn't mark
its root tree as uninteresting. This caused the "missing tree ..."
error in Gerrit under special circumstances. For example, if the
patch-set 2 changes only the commit message then the patch-set 1
and patch-set 2 share the same root-tree:

  ps1 -> o   o <- ps2
          \ /
           o root-tree

The transported pack will contain the ps2 commit but not the root-tree
object.

When using the BaseReceivePack.setCheckReferencedObjectsAreReachable
JGit will check the reachability of all referenced objects not provided
in the transported pack. Since the ps1 was advertised it will properly
be marked as uninteresting. However, the root-tree was reachable because
the ObjectWalk.markUninteresting missed to mark it as uninteresting.
JGit was then rejecting the pack with the "missing tree ..." exception.

Gerrit-issue: https://code.google.com/p/gerrit/issues/detail?id=1582
Change-Id: Iff2de8810f14ca304e6655fc8debeb8f3e20712b
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-28 18:05:59 -04:00
Yuxuan 'fishy' Wang 684a2a058a Handles repo manifest file without default remote.
Change-Id: Ic45919a0b695e8a6f4ed47cc060e0c41f1d7e7ea
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-27 16:29:19 -07:00
Shawn Pearce 49305cde19 Merge "ReceivePack: Accept shallow lines from Git >= 1.9" 2014-08-27 16:56:16 -04:00
Shawn Pearce 199dd4a9a9 ReceivePack: Accept shallow lines from Git >= 1.9
In Git 1.9 (5dbd767601 "support pushing from a shallow clone")
the git-core project intentionally broke the existing send-pack
protocol from shallow clients.

Shallow clients now transmit their shallow information during push,
ahead of the old-new command sequence. JGit must accept these lines
when presented.

To protect the server against clients sending partial history,
require the connectivity check when pushed to by a shallow client.

Change-Id: I46639366b0900052c376091e1688f07def44ab79
2014-08-27 12:45:17 -07:00
Robin Rosenberg 82f74e490a Merge "Strip "<", ">", and "\n" from name/email in UserConfig" 2014-08-22 09:19:49 -04:00
Robin Rosenberg 5797dbe9a7 Merge "Throw URISyntaxException for incorrect percent-encoding" 2014-08-21 17:47:51 -04:00
Robin Stocker ce312d8afb Strip "<", ">", and "\n" from name/email in UserConfig
This matches what C Git does, see "stripped" in `man git-commit-tree`.

It also fixes the bug of the user where an user.email like "<>" would
show up as "<<>>" in EGit.

Bug: 439844
Change-Id: I567a3c620e191ce9d37d318417e63cb5d4483419
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-21 23:21:27 +10:00
Yi EungJun da6e729086 Throw URISyntaxException for incorrect percent-encoding
URIish.unescape() threw an ArrayIndexOutOfBoundsException if the given
url has incorrect percent-encoding (e.g. http://example.com/%gg). But an
URISyntaxException is much better to know the reason of the failure.

Change-Id: I3f40a26d43cd2eb4e32c11aba7dc2594bc1f98e2
Signed-off-by: Yi EungJun <eungjun.yi@navercorp.com>
2014-08-21 00:45:39 +09:00
Robin Stocker 30953bbb67 Merge "Fix minor spelling error in comment" 2014-08-19 10:28:46 -04:00
Robin Rosenberg a0752f71fc Fix minor spelling error in comment
Change-Id: I320b5cd526827844d4fe0cbc0f32551010e98090
2014-08-19 16:21:59 +02:00
Christian Halstrick a086582ef2 Merge "cleanup: Remove no-longer needed API compatibility warning filters" 2014-08-19 09:57:28 -04:00
Yuxuan 'fishy' Wang 66fc834530 Support remote aliases in repo manifest.
Change-Id: Icbe5761b9d8a4ae5305bfe45b2d042f214156fc8
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-18 11:12:08 -07:00
Yuxuan 'fishy' Wang 5a26c538b3 Support non-default remotes in project tag.
Change-Id: I3c730a1ce379d142d3ed81dda4a73f86f1f9c3eb
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-18 10:57:09 -07:00
Robin Stocker 8e19fea1a9 Add tests for checking out tags with CheckoutCommand
Change-Id: Ifec3ac59264c91e154b832fdd907736faf8a8412
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-17 19:12:04 -04:00
Robin Stocker 4bdd0037aa Add toString to Git with repository path
Useful for debugging.

Change-Id: I78b92ccbcc099370fc99a1d2fa2cf60d5f5892e6
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-17 17:48:05 +10:00
Shawn Pearce 9bb891e44d ResolveMerger: Use the ObjectReader to access objects
This is necessary to ensure objects accessed by the TreeWalk come from
the associated ObjectInserter when the merger is a RecursiveMerger
instance and a virtual common base was constructed but not flushed.

Change-Id: Iebe739d30fd868ebc4f61dbfb714673146a2c3ec
2014-08-15 10:27:31 -07:00
Marc Strapetz ce48fba05e PackIndexV2: fix possibly wrong check
According to http://stackoverflow.com/a/8381338, the maximum array
size is not Integer.MAX_VALUE, but Integer.MAX_VALUE - 8

Change-Id: I6ddc7470368acd20abf0885c53c89a982bb0f176
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2014-08-15 14:01:09 +02:00
Shawn Pearce 94c4d7eee8 Cleanup use of java.util.Inflater, fixing rare infinite loops
The native implementation of inflate() can set finished to return
true at the same time as it copies the last bytes into the buffer.

Check for finished on each iteration, terminating as soon as libz
knows the stream was completely inflated.

If not finished, it is likely input is required before the next
native call could do any useful work. Most invocations are passing
in a buffer large enough to store the entire result. A partial return
from inflate() will need more input before it can continue. Checking
right away that needsInput() is true saves a native call to determine
no bytes can be inflated without more input.

This should fix a rare infinite loop condition inside of inflation
when an object ends exactly at the end of a block boundary, and
the next block contains only the 20 byte trailing SHA-1.

When the stream is finished each new attempt to inflate() returns
n == 0, as no additional bytes were output. The needsInput() test
tries to add the length of the footer block to itself, but then loops
back around an reloads the same block as the block is smaller than
a full block size. A zero length input is set to the inflater,
which triggers needsInput() condition again.

Change-Id: I95d02bfeab4bf995a254d49166b4ae62d1f21346
2014-08-14 12:36:43 -07:00
Shawn Pearce 861f5f649f Add missing @since 3.5 tag to RepoCommand.setIncludedFileReader
Change-Id: Ib5d24f8dafacc0d12c36927c2bbc3ebef2fff7b2
2014-08-13 15:28:24 -07:00
Yuxuan 'fishy' Wang 34dd64f6fe Add support to <include> tag in repo manifest xml.
Change-Id: I32d468f92e24701ea680435bf3417e3850857303
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-13 13:04:28 -07:00
Shawn Pearce b1bea54113 Merge "Tweak the handling of remote url in jgit repo." 2014-08-13 16:02:57 -04:00
Shawn Pearce d70419ab00 Revert "Add a method to DfsOutputStream to read as an InputStream"
This reverts commit b646578d89.

openInputStream() is never used in JGit, nor is it used by any
known working DFS implementation. The method was added as a
utility for reading back from a DfsInserter, but the final
implementation of that feature does not requrire this method.

Change-Id: I075ad95e40af49c92b554480f8993ef5658f7684
2014-08-13 10:42:43 -07:00
Dave Borowitz 8ea4319388 Add a Merger.merge method that makes flushing optional
This allows callers performing multiple separate merges to reuse a
single ObjectInserter without flushing the inserter on each iteration
(which can be slow in the DFS case).

Change-Id: Icaff7d2bc2c20c873ce5a7d9af5002da84ae1c2b
2014-08-13 10:40:04 -07:00
Dave Borowitz 0ab3f43c85 Teach mergers to use ObjectInserter.newReader()
This allows the RecursiveMerger to iteratively create new merge bases
without necessarily flushing packs to storage in the DFS case;
flushing only need happen at the end of the whole merge process.

Since Merger's walk now depends on its inserter, we need to construct
an inserter at Merger construction time.  This should not be a
significant increase in overhead since unused inserters don't use any
resources (beyond a reference to the Repository).

We also must release and recreate the walk whenever setObjectInserter
is called, which can break usages where setObjectInserter is called in
the middle of stateful operations on the walk.  No usages of this
method within JGit currently do this; the inserter is only ever set
before any stateful walk operations happen.

Change-Id: I9682a6aa4a2c37dccef8e163f132ddb791d79103
2014-08-13 10:39:57 -07:00
Yuxuan 'fishy' Wang 38a24bc799 Tweak the handling of remote url in jgit repo.
This kind of reverted 31148. URI.resolve actually can handle the absolute URL
well, the problem is only the missing "/".

Change-Id: Iee5866c005cbc1430dc20ee7db321b8b51afed30
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-13 10:36:56 -07:00
Dave Borowitz e1856dbf44 Add a method to ObjectInserter to read back inserted objects
In the DFS implementation, flushing an inserter writes a new pack to
the storage system and is potentially very slow, but was the only way
to ensure previously-inserted objects were available.  For some tasks,
like performing a series of three-way merges, the total size of all
inserted objects may be small enough to avoid flushing the in-memory
buffered data.

DfsOutputStream already provides a read method to read back from the
not-yet-flushed data, so use this to provide an ObjectReader in the
DFS case.

In the file-backed case, objects are written out loosely on the fly,
so the implementation can just return the existing WindowCursor.

Change-Id: I454fdfb88f4d215e31b7da2b2a069853b197b3dd
2014-08-13 10:27:12 -07:00
Shawn Pearce 63eb9042a4 DfsInserter: buffer up to streamFileThreshold from InputStream
Since 2badedcbe0 in-core merges can write up to 10 MiB
into a TemporaryBuffer.Heap strategy, where the data is stored
as a chain of byte[] blocks.

Support the inserter reading up to the streamFileThreshold (default 50
MiB) from the supplied input stream and hash the content to determine
if the merged result blob is already present in the repository.  This
allows the inserter to avoid creating duplicate objects in more cases,
reducing repository pack file churn.

Change-Id: I38967e2a0cff14c0a856cdb46a2c8fedbeb21ed5
2014-08-12 18:55:12 -07:00
Dave Borowitz fa5582f3fe Merger: clarify getBaseCommit javadoc
Change-Id: Ic52475248a545d51d3d8ac31a24f0344a1241e45
2014-08-11 14:46:45 -07:00
Dave Borowitz e06082c171 Reuse Merger's ObjectReader from ResolveMerger
The base Merger class already has a single ObjectReader instance that
it handles releasing as necessary, so creating new readers is not
necessary.

Change-Id: I990ec43af7df448c7825fc1b10e62eadaa3e0c2a
2014-08-11 14:46:31 -07:00
Robin Rosenberg 06ab442b05 Merge "Fix CheckoutCommand not setting up tracking" 2014-08-11 16:23:38 -04:00
Shawn Pearce 73a687fead Merge "Process most in-core merges without local temp files" 2014-08-11 12:42:10 -04:00