Commit Graph

1294 Commits

Author SHA1 Message Date
Shawn O. Pearce bf1b970de1 Paper bag fix BatchingProgressMonitor alarm queue
The alarm queue threads were started with an empty task body, which
meant the thread started and terminated immediately, leaving the
queue itself with no worker.

Change-Id: I2a9b5fe9c2bdff4a5e0f7ec7ad41a54b41a4ddd6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-03-01 10:07:08 -08:00
Chris Aniszczyk 268ccbebe3 Merge "ProgressMonitor: Refactor to use background alarms" 2011-03-01 12:05:59 -05:00
Chris Aniszczyk da4fe45356 Merge "Show notes in Log CLI command - Part 2" 2011-03-01 11:13:00 -05:00
Sasa Zivkov 3e1a5081d6 Show notes in Log CLI command - Part 2
This change fixes issues identified in the commit
5f3d577e5a.

Change-Id: Idbd935f5f60ad043faa0d4982b3e101ef7c07d60
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2011-03-01 09:29:35 +01:00
Shawn O. Pearce 68ab451d39 ProgressMonitor: Refactor to use background alarms
Instead of polling the system clock on every update(1) method call,
use a scheduled executor to toggle a volatile once per second until
the task is done.  Check the volatile on each update(int), looking
to see if output should occur.

This limits progress output to either once per 1% complete, or once
per second.  To save time during update calls the timer isn't reset
during each 1% of output, which means we may see one unnecessary
output trigger if at least 1% completed during the one second of the
alarm time.

Change-Id: I8fdd7e31c37bef39a5d1b3da7105da0ef879eb84
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-28 19:36:56 -08:00
Matthias Sohn ab949602ce Adapt to Jetty 7.3 API change coming with Indigo
Indigo comes with Jetty 7.3 bringing some API changes. This still
works with Jetty 7.1.6 shipped with Helios.

Change-Id: If4f9d6ef6b45c94f8bb097f8b02c10317b47547b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-03-01 02:04:07 +01:00
Matthias Sohn 2fba1e65e1 Fix NPE on checkout of remote tracking branch
Checkout of remote tracking branch failed when no local branch
existed. Also enhance RepositoryTestCase to enable checking index
state of another test repository.

Bug: 337695
Change-Id: Idf4c05bdf23b5161688818342b2bf9a45b49f479
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-03-01 00:21:14 +01:00
Shawn O. Pearce bda1e8fab9 Merge branch 'stable-0.11'
* stable-0.11:
  JGit 0.11.3
  Fix NullPointer when pulling from a deleted local branch
  smart-http: Fix recognition of gzip encoding
  Fix processing of broken symbolic references in RefDirectory
  CreateBranchCommand: Wrong existence check
  Qualify post 0.11.1 builds

Conflicts:
	org.eclipse.jgit.console/META-INF/MANIFEST.MF
	org.eclipse.jgit.console/pom.xml
	org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
	org.eclipse.jgit.http.server/pom.xml
	org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
	org.eclipse.jgit.http.test/pom.xml
	org.eclipse.jgit.iplog/META-INF/MANIFEST.MF
	org.eclipse.jgit.iplog/pom.xml
	org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
	org.eclipse.jgit.junit.http/pom.xml
	org.eclipse.jgit.junit/META-INF/MANIFEST.MF
	org.eclipse.jgit.junit/pom.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
	org.eclipse.jgit.packaging/org.eclipse.jgit.updatesite/pom.xml
	org.eclipse.jgit.packaging/pom.xml
	org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
	org.eclipse.jgit.pgm/pom.xml
	org.eclipse.jgit.test/META-INF/MANIFEST.MF
	org.eclipse.jgit.test/pom.xml
	org.eclipse.jgit.ui/META-INF/MANIFEST.MF
	org.eclipse.jgit.ui/pom.xml
	org.eclipse.jgit/META-INF/MANIFEST.MF
	org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
	org.eclipse.jgit/pom.xml
	pom.xml

Change-Id: I08067c028666f194687943a574512f5bc5ca9552
2011-02-25 17:24:55 -08:00
Shawn O. Pearce 03f78fc3bc UnpackedObject: Fix readSome() when initial read is short
JDK7 changed behavior slightly on some InputStream types, resulting in
the first read being shorter than the count requested.  That caused us
to overwrite the earlier part of the buffer with later data, as the
offset index wasn't updated in the loop.

Fix the loop to increment offset by the number of bytes read in this
iteration, so the next read appends to the buffer rather than doing an
overwrite.

Bug: 338119
Change-Id: I222fb2f993cd9b637b6b8d93daab5777ef7ec7a6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-25 17:20:14 -08:00
Robin Rosenberg ba77150040 Use generics in RepositoryFilter constructor
Change-Id: I461786baffab15515365ead1d9c350a1880443ea
2011-02-25 23:12:05 +01:00
Chris Aniszczyk 7e1f18c079 Merge "RevWalk: Don't release during inMergeBase()" 2011-02-24 11:23:47 -05:00
Shawn Pearce 2c9a192505 Merge "Fix formatting of pom.xml" 2011-02-24 10:29:47 -05:00
Matthias Sohn e0a8398f1f FetchCommand: do not set a null credentials provider
FetchCommand now does not set a null credentials provider on
Transport because in this case the default provider is replaced with
null and the default mechanism for providing credentials is not
working.

Change-Id: I44096aa856f031545df39d4b09af198caa2c21f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-24 16:05:05 +01:00
Matthias Sohn 8d000bd578 Fix formatting of pom.xml
Change-Id: I508def09cb2d4e5bd27b412f4ad5d43984388749
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-24 16:04:33 +01:00
Shawn O. Pearce e757975fcd RevWalk: Don't release during inMergeBase()
In bc1af8459e ("RevWalk: Don't reset ObjectReader when stopping") we
stopped releasing the reader when the current log traversal is over.
This should have also been applied to the merge base logic that is
buried within MergeGenerator, but got missed.

Change-Id: I8328f43f02cba06fd545e22134872e781b9d4d36
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-24 06:55:25 -08:00
Shawn Pearce 2902c7679b Merge "Respect core.excludesfile to enable global ignore rules " 2011-02-23 18:08:50 -05:00
Matthias Sohn e703b6c640 Respect core.excludesfile to enable global ignore rules
Also use FS.resolve() to properly resolve files from path strings.

Bug: 328428 (partial fix)
Change-Id: I41d94694f220dcb85605c9acadfffb1fa23beaeb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-23 23:44:50 +01:00
Shawn O. Pearce 7505b93546 PackWriter: Add missing timers to Statistics
We did not record the time spent on the object reuse search or the
object size lookup, both of which occur between the counting phase and
the compressing phase.  If there are enough objects involved, these
times can be significant so its worth timing them and recording it.

Change-Id: I89084acfc598bb6533d75d90cb8de459f0ed93be
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-23 11:56:19 -08:00
Sasa Zivkov 5f3d577e5a Show notes in Log CLI command
Support for --no-standard-notes and --show-notes=REF options is added
to the Log command. The --show-notes option can be specified more than
once if more than one notes branch should be used for showing notes.

The notes are displayed from note branches in the order how the note
branches are specified in the command line. However, the standard note,
from the refs/notes/commits, is always displayed as first unless
the --no-standard-notes options is given.

Change-Id: I4e7940804ed9d388b625b8e8a8e25bfcf5ee15a6
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-23 09:32:23 -06:00
Shawn O. Pearce 977446e5da PackWriter: Fix total delta count
The total delta count is supposed to include reused deltas, not
just newly created deltas.

Change-Id: I98cbdcef80d59714a4f62ff322e7b709b08b6d26
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-22 17:00:05 -08:00
Shawn O. Pearce 561549d766 Merge "Create empty GIT_DIR/hooks directory" 2011-02-22 10:46:09 -05:00
Shawn Pearce 5bf3df5e1d Merge "Fix potential NullPointerException in PlotCommit" 2011-02-22 10:45:51 -05:00
Shawn O. Pearce 6444e60d0e Create empty GIT_DIR/hooks directory
Bug: 337801
Change-Id: I5e0c4d838a211509fb4cc7e048dba6efaec15d5c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-22 07:38:51 -08:00
Mathias Kinzler 9953e2a39e Fix potential NullPointerException in PlotCommit
Change-Id: Ib7f661a259561251e74337fa233036e041c42423
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2011-02-22 09:11:42 +01:00
Matthias Sohn 989149736a JGit 0.11.3
Change-Id: I0a3d4d4400e7643c43d64bf60e566d533b5dcee1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:59:47 +01:00
Stefan Lay 68064ed339 Fix NullPointer when pulling from a deleted local branch
A checked Exception is thrown instead.

The reason for throwing an Exception is that the state of the
repository is inconsistent in this case: There is a merge
configuration containing a non-existing local branch. Ideally the
deletion of a local branch should also delete the corresponding
merge configuration.

Bug: 337315
Change-Id: I8ed57d5aaed60aaab685fc11a8695e474e60215f
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:54:02 +01:00
Shawn O. Pearce bd1c1156a0 smart-http: Fix recognition of gzip encoding
Some clients coming through proxies may advertise a different
Accept-Encoding, for example "Accept-Encoding: gzip(proxy)".
Matching by substring causes us to identify this as a false positive;
that the client understands gzip encoding and will inflate the
response before reading it.

In this particular case however it doesn't.  Its the reverse proxy
server in front of JGit letting us know the proxy<->JGit link can
be gzip compressed, while the client<->proxy part of the link is not:

  client <-- no gzip --> proxy <-- gzip --> JGit

Use a more standard method of parsing by splitting the value into
tokens, and only using gzip if one of the tokens is exactly the
string "gzip".  Add a unit test to make sure this isn't broken in
the future.

Change-Id: Ib4c40f9db177322c7a2640808a6c10b3c4a73819
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:51:11 +01:00
Marc Strapetz 57d13c047f Fix processing of broken symbolic references in RefDirectory
Change-Id: Ic1ceb9c99dca2c69e61ea0ef03ec64f13714b80a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:48:48 +01:00
Mathias Kinzler c893b1f75f CreateBranchCommand: Wrong existence check
Bug: 337044
Change-Id: I89224719712c1f1ab80ea34280139dfeb00be3d0
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:44:31 +01:00
Matthias Sohn 5998e474c4 Qualify post 0.11.1 builds
Change-Id: I48cca12fcc6212fbe6c42109e44e4a2dc20ecada
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-21 00:42:57 +01:00
Shawn O. Pearce 8f865bfffe PackWriter: Hoist and cluster reference targets
Many source browsers and network related tools like UploadPack need
to find and parse the target of all branches and annotated tags
within the repository during their startup phase.  Clustering these
together into the same part of the pack file will improve locality,
reducing thrashing when an application starts and needs to load
all of these into memory at once.

To prevent bottlenecking basic log viewing tools that are scannning
backwards from the tip of a current branch (and don't need tags)
we place this cluster of older targets after 4096 newer commits
have already been placed into the pack stream.  4096 was chosen as
a rough guess, but was based on a few factors:

  - log viewers typically show 5-200 commits per page
  - users only view the first page or two

  - DHT can cram 2200-4000 commits per 1 MiB chunk
    thus these will fall into the second commit chunk (roughly)

Unfortunately this placement hurts history tools that are scanning
backwards through the commit graph and completely ignored tags or
branch heads when they started.

An ancient tagged commit is no longer positioned behind its first
child (its now much earlier), resulting in a page fault for the
parser to reload this cluster of objects on demand.  This may be
an acceptable loss.  If a user is walking backwards and has already
scanned through more than 4096 commits of history, waiting for the
region to reload isn't really that bad compared to the amount of
time already spent.

If the repository is so small that there are less than 4096 commits,
this change has no impact on the placement of objects.

Change-Id: If3052e430d305e17878d94145c93754f56b74c61
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 18:15:26 -08:00
Shawn O. Pearce 19037e8cfc PackWriter: Parse tag target objects in a batch
If the underlying storage has a high latency per SHA-1 lookup
(e.g. the DHT support we are working on), parsing each wanted
annotated tag object back to its underlying commit is too slow,
its a sequential lookup for each tag.  With hundreds of tags in
a repository this takes far too long.

Instead queue up a list of the tags whose objects need to be found,
and then locate all of those in one parseAny batch.  This works
for the common case of annotated tag to single tree or commit.
For the less often used tag->tag->commit, it at least gets us
one level parsed in the larger batch before we have to go back to
sequential lookups.

Change-Id: I94beef3f14281406f15c8cf9fa02d83faf102a19
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 18:15:25 -08:00
Shawn O. Pearce 388ba7e005 PackWriter: Correct total delta count when reusing pack
If the CachedPack knows its delta count, we need to increment both
the totalDeltas and reusedDeltas fields of the stats object.

Change-Id: I70113609c22476ce7f1e4d9a92f486e9b0f59e44
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 17:36:45 -08:00
Shawn O. Pearce 3e64b928d5 PackWriter: Short-circuit counting on full cached pack reuse
If one or more cached packs fully covers the request, don't bother
with looking up the objects and trying to walk the graph.  Just use
the cached packs and return immediately.

This helps clones of quiet repositories that have not been modified
since their last repack, its likely the cached packs are accurate
and no graph walking is required.

Change-Id: I9062a5ac2f71b525322590209664a84051fd5f8a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 17:36:45 -08:00
Shawn O. Pearce 4275c4c1cf PackWriter: Fix warning about untyped collection
Change-Id: I44699d8ab9768844ba91f7224a7d4ee685c93ce6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 17:36:45 -08:00
Shawn O. Pearce 5fc0f1043b BundleWriter: Always use OFS_DELTA
CGit just learned to always use OFS_DELTA when writing out bundle
files.  This makes sense because bundle came about well after
OFS_DELTA was established, so any version of CGit that can read a
bundle file can also read OFS_DELTA.  Since OFS_DELTA is smaller,
always use it when writing bundles.

Change-Id: I44f9921494798ea0c99e16eab58b87bebeb9aff5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-18 17:36:45 -08:00
Chris Aniszczyk ae0a1340ff Merge "PackWriter: Sort commits by parse order to improve locality" 2011-02-18 14:30:19 -05:00
Tomasz Zarna dcb7e477ee Wrong constant used when configuring a repository
Bug: 337546
Change-Id: Ib2f31d621caa5f8b24ce74ce82499889d4f30550
2011-02-18 11:41:19 +01:00
Shawn O. Pearce 733780e8a1 PackWriter: Sort commits by parse order to improve locality
RevWalk in JGit and the revision code in C Git both parse commits out
of the pack file in an order that differs from strict timestamp and
topological sorting.  Both implementations pop a commit from the head
of a date queue, and then immediately parse all of its parents in
order to insert those into the date queue at the proper positions as
determined by their committer timestamp field.  This implies that the
parents are parsed when their most recent child is popped from the
queue, and not where they are popped during traversal.

Hoisting a parent commit to be immediately behind its child improves
locality by making sure all parents of a merge are clustered together,
and thus can be paged into the parser by the pack file buffering
system (aka WindowCache in JGit) together.

Change-Id: I80f9e64cafa2e8f082776b43845edf23065386a2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-17 21:32:03 -08:00
Shawn Pearce 681739b1c8 Merge "Changed TreeWalk.forPath(...) to work with recursive paths." 2011-02-18 00:21:59 -05:00
Chris Aniszczyk bd8944d671 Add Reset to the JGit CLI
Change-Id: I85368c849c0964b9a539fa1991920adb2ace94df
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-17 14:06:28 -06:00
Jesse Greenwald c5863e4d3b Changed TreeWalk.forPath(...) to work with recursive paths.
Previously, this method would not (always) work when a recursive path
such as "a/b" was passed into it.

Change-Id: I0752a1f5fc7fef32064d8f921b33187c0bdc7227
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-17 13:48:22 -06:00
Chris Aniszczyk 5f258d91c0 Add git-reset to the Git API
Bug: 334764
Change-Id: Ice404629687d7f2a595d8d4eccf471b12f7e32ec
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-17 10:28:26 -06:00
Shawn Pearce c13bf05754 Merge "Fix NullPointer when pulling from a deleted local branch" 2011-02-16 10:15:31 -05:00
Stefan Lay 68459b646e Fix NullPointer when pulling from a deleted local branch
A checked Exception is thrown instead. 

The reason for throwing an Exception is that the state of the
repository is inconsistent in this case: There is a merge
configuration containing a non-existing local branch. Ideally the
deletion of a local branch should also delete the corresponding
merge configuration.

Bug: 337315
Change-Id: I71e56ffb90e11e6e3c1bbd964ad63972d67990c0
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2011-02-16 15:46:26 +01:00
Shawn O. Pearce bd531eb998 smart-http: Support progress in ReceivePack
As PackParser supports a progress meter for the "Resolving deltas"
phase of its work, we should export this to smart HTTP clients so
they know the server is still working on their (large) upload.

However this isn't as simple as just dropping in a binding for
the SmartOutputStream to flush when its told to.  We want to
avoid spurious flushes triggered by the use of sideband, or the
status report formatting in the send-pack/receive-pack protocol.

Change-Id: Ibd88022a298c5fed0edb23dfaf2e90278807ba8b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-15 16:32:51 -08:00
Shawn O. Pearce 18e822a7fe smart-http: Fix recognition of gzip encoding
Some clients coming through proxies may advertise a different
Accept-Encoding, for example "Accept-Encoding: gzip(proxy)".
Matching by substring causes us to identify this as a false positive;
that the client understands gzip encoding and will inflate the
response before reading it.

In this particular case however it doesn't.  Its the reverse proxy
server in front of JGit letting us know the proxy<->JGit link can
be gzip compressed, while the client<->proxy part of the link is not:

  client <-- no gzip --> proxy <-- gzip --> JGit

Use a more standard method of parsing by splitting the value into
tokens, and only using gzip if one of the tokens is exactly the
string "gzip".  Add a unit test to make sure this isn't broken in
the future.

Change-Id: I30cda8a6d11ad235b56457adf54a2d27095d964e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-15 16:32:51 -08:00
Shawn O. Pearce f194eeb71f http.test: Delete badly named JUnit configurations
We also have org.eclipse.jgit.http--All-Tests, which matches the
style of the org.eclipse.jgit.core--All-Tests name. Drop the others
as these are just redundant duplicates.

Change-Id: I8600a343f6a85d21dc07bda68a8cb834c82946b5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-15 16:32:51 -08:00
Shawn O. Pearce 14f99dc29d PackWriter: Try for accurate delta reuse on cached pack
If a cached pack is used, it might know how many deltas are contained
within it.  Record that count as part of our reusedDeltas field
for the stats line we show clients.

Change-Id: I1c61fb817305a95eeac654cccf132cba20b2339c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-15 16:32:51 -08:00
Shawn O. Pearce 1f7982f642 UploadPack: Expose advertised refs to callers
Like ReceivePack, callers that embed UploadPack within their
service may wish to see the set of references that were sent
to the client. We already have the map on hand, it just needs
to be exposed with a getter.

Change-Id: I123b23e475860d5bb968906bef59068985088b7b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-15 16:32:51 -08:00