Commit Graph

1224 Commits

Author SHA1 Message Date
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 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
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
Shawn O. Pearce a06be83045 RepositoryBuilder: Allow callers to require repository exists
The setMustExist() method allows callers to require the repository
exists in order for build() to succeed. This is useful within a
RepositoryResolver where existence is required.

Change-Id: I6a1154551435cf0da6c2b4a7f4dce266abea5dff
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-15 18:17:46 -06:00
Shawn O. Pearce 6490090f14 pgm: Make --git-dir a string
DHT based repository types don't use a java.io.File to name the
repository.  Moving the type to a string starts to open up more types
of repository names, making the standard pgm package easier to reuse
on other storage systems.

Change-Id: I262ccc8c01cd6db88f832ef317b0e1e5db2d016a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-15 13:36:22 -06:00
Chris Aniszczyk 22abbd338d Merge "daemon: Use HTTP's resolver and factory pattern" 2011-02-15 12:09:39 -05:00
Shawn Pearce 3a00ffa528 Merge "Fix processing of broken symbolic references in RefDirectory" 2011-02-15 09:33:31 -05:00
Marc Strapetz b297cf67a9 Fix processing of broken symbolic references in RefDirectory
Change-Id: I1f85890fe718f38ef4b62ebe711f0668267873a2
2011-02-15 09:33:39 +01:00
Shawn O. Pearce 1b7a5a2960 daemon: Use HTTP's resolver and factory pattern
Using a resolver and factory pattern for the anonymous git:// Daemon
class makes transport.Daemon more useful on non-file storage systems,
or in embedded applications where the caller wants more precise
control over the work tasks constructed within the daemon.

Rather than defining new interfaces, move the existing HTTP ones
into transport.resolver and make them generic on the connection
handle type.  For HTTP, continue to use HttpServletRequest, and
for transport.Daemon use DaemonClient.

To remain compatible with transport.Daemon, FileResolver needs to
learn how to use multiple base directories, and how to export any
Repository instance at a fixed name.

Change-Id: I1efa6b2bd7c6567e983fbbf346947238ea2e847e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-14 18:28:21 -08:00
Chris Aniszczyk 8235b88a4b Merge "UploadPack: Expose PackWriter activity to a logger" 2011-02-14 18:15:34 -05:00
Chris Aniszczyk cb2a22a9a5 Merge "RevWalk: Avoid unnecessary re-parsing of commit bodies" 2011-02-14 18:14:59 -05:00
Chris Aniszczyk e22cbd1847 Merge "RevWalk: Don't reset ObjectReader when stopping" 2011-02-14 18:13:39 -05:00
Chris Aniszczyk 100299f59b Merge "UploadPack: Donate parsed commits to PackWriter" 2011-02-14 18:13:00 -05:00
Mathias Kinzler 9c84574e8f CreateBranchCommand: Wrong existence check
Bug: 337044
Change-Id: I3bc42fea1f552f10d4729999cab6fb4241b70325
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
2011-02-14 15:48:43 +01:00
Shawn O. Pearce c8c4524b6b UploadPack: Expose PackWriter activity to a logger
The UploadPackLogger interface allows applications that embed
GitServlet or otherwise use UploadPack to service clients to
track and log how PackWriter was used, and what it sent.  This
provides more granularity into the request activity than might
be available from the HTTP server logs, helping administrators
to better understand utilization and Git server performance.

Change-Id: I1d36b060eb3385339d5f986e68192789ef70fc4e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 13:43:11 -08:00
Shawn O. Pearce 24c1c530db RevWalk: Avoid unnecessary re-parsing of commit bodies
If the RevFilter doesn't actually require the commit body,
we shouldn't reparse it if the body was disposed.  This happens
often inside of UploadPack during common ancestor negotation, the
RevWalk is reset and re-run over roughly the same commit space,
but the bodies are discarded because the commit message is not
relevant to the process.

Change-Id: I87b6b6a5fb269669867047698abf718d366bd002
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 13:43:11 -08:00
Shawn O. Pearce bc1af8459e RevWalk: Don't reset ObjectReader when stopping
Applications like UploadPack reset() and reuse the same RevWalk
multiple times in very rapid succession.  Releasing the ObjectReader's
internal state on each use, only to allocate it again on the next
cycle kills performance if the ObjectReader has internal caches, or
even if the Inflater gets returned and pulled from the InflaterCache
too frequently.

Making releasing the ObjectReader the application's responsibility
when it is done with the RevWalk, which most already do by wrapping
their loop in a try/finally block.

Change-Id: I3ad188a719e8d7f6bf27d1a7ca16d465534713f4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 13:43:11 -08:00
Shawn O. Pearce 5664fb3bfb UploadPack: Donate parsed commits to PackWriter
When UploadPack has computed the merge base between the client's have
set and the want set, its already loaded and parsed all of the
interesting commits that PackWriter needs to transmit to the client.
Switching the RevWalk and its object pool over to be an ObjectWalk
saves PackWriter from needing to re-parse these same commits from the
ObjectDatabase, reducing the startup latency for the enumeration
phase of packing.

UploadPack doesn't want to use an ObjectWalk for the okToGiveUp()
tests because its slower, during each commit popped it needs to cache
the tree into the pendingObjects list, and during each reset() it
discards a bunch of ObjectWalk specific state and reallocates some
internal collections.  ObjectWalk was never meant to be rapidly
reset() like UploadPack does, so its perhaps somewhat cleaner to allow
"upgrading" a RevWalk to an ObjectWalk.

Bug: 301639
Change-Id: I97ef52a0b79d78229c272880aedb7f74d0f7532f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 13:43:11 -08:00
Chris Aniszczyk 3dcbf375a8 Setup the default remote and merge config in CloneCommand
Bug: 336621
Change-Id: I8c889d7b42f6f121d096acad1fada8e3752d74f9
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-13 15:33:45 -06:00
Shawn O. Pearce 3271bcee2b UploadPack: Rely on peeled ref data for include-tag
The peeled reference information for tags is more efficient to
work with than parsing the tag objects, as usually its coming from
the packed-refs file, which stores the peeled information for us.
Rely on the peeled information to decide if the tag should be
included or not, instead of using our RevWalk to parse the object.

Change-Id: I6714a8560a1c04b5578e9c5b469ea3c77188dff3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 15:32:23 -06:00
Shawn O. Pearce f9c9fe5226 UploadPack: Assume okToGiveUp is initially false
When negotiate() starts there is at least one want, but no haves, and
thus no common base exists.  Its not ok to give up yet, the client
should try to find a common base with the server.  Avoid scanning our
history along the want chains until we have found at least one commit
in common with the client, this will trigger okToGiveUp to be set to
null, enabling okToGiveUp() to perform the scan.

Bug: 301639
Change-Id: I98a82a5424fd4c9995924375c7910f76ca4f03af
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-13 15:30:25 -06:00
Shawn O. Pearce d6b7139cd8 UploadPack: Avoid walking the entire project history
If the client presents a common commit on a side branch, and there is
a want for a disconnected branch UploadPack was walking back on the
entire history of the disconnected branch because it never would find
the common commit.

Limit our search back along any given want to be no earlier than the
oldest common commit received via a "have" line from our client.  This
prevents us from looking at all of the project history.

Bug: 301639
Change-Id: Iffaaa2250907150d6efa1cf2f2fcf59851d5267d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-13 15:26:26 -06:00
Chris Aniszczyk 8949ea4789 Merge "UploadPack: Tag non-commits SATISIFIED earlier" 2011-02-13 16:23:35 -05:00