]> source.dussan.org Git - jgit.git/log
jgit.git
13 years agoIndexPack: Defer the "Resolving deltas" progress meter 32/3932/2
Shawn O. Pearce [Wed, 27 Jul 2011 18:59:31 +0000 (11:59 -0700)]
IndexPack: Defer the "Resolving deltas" progress meter

If delta resolution completes in < 1000 milliseconds, don't bother
showing the progress meter. This is actually very common for a Gerrit
Code Review server, where the client is probably sending 1 commit and
only a few trees/blobs modified... and the base objects are hot in the
process buffer cache.

The 1000 millisecond delay is just a guess at a reasonable time to wait.

Change-Id: I440baa64ab0dfa21be61deae8dcd3ca061bed8ce
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoIndexPack: Fix "Resolving deltas" progress meter 31/3931/2
Shawn O. Pearce [Wed, 27 Jul 2011 18:54:11 +0000 (11:54 -0700)]
IndexPack: Fix "Resolving deltas" progress meter

This progress meter never reached 100% as it did not update while
resolving the external bases in thin packs.

Instead of updating in batches at the top level, update once per delta
that is resolved. The batching progress meter type should smooth out
the frequent updates to an update rate that is more reasonable to send
to the UI, while also ensuring a successful pack parse always reaches
100% deltas resolved.

Change-Id: Ic77dcac542cfa97213a6b0194708f9d3c256d223
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMake PackReverseIndex a public structure 27/3927/2
Shawn O. Pearce [Wed, 29 Jun 2011 16:45:22 +0000 (09:45 -0700)]
Make PackReverseIndex a public structure

Repository inspection tools may find building a reverse index on a
pack useful, as they can then locate an object by offset. As both
C Git and JGit sometimes produce error messages with the offset
rather than the SHA-1, it may be useful to expose this type.

Change-Id: I487bf32e85a8985cf8ab382d4c82fcbe1fc7da6c

13 years agoMake lookup methods on PackIndex public 29/3929/2
Shawn O. Pearce [Wed, 29 Jun 2011 16:54:07 +0000 (09:54 -0700)]
Make lookup methods on PackIndex public

There isn't a good reason to hide all of these as package-private.
Make them public so applications can inspect pack files.

Change-Id: Ia418daf65d63e9e015b8dafdf3d06a1ed91d190b

13 years agoPackIndex: Support reading from any InputStream 26/3926/2
Shawn O. Pearce [Wed, 29 Jun 2011 16:21:00 +0000 (09:21 -0700)]
PackIndex: Support reading from any InputStream

Change-Id: If065a9e33a8f3a03e9758eb7612af2fc460c87e5
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoAdd String form of PackInvalidException constructor 28/3928/2
Shawn O. Pearce [Wed, 29 Jun 2011 16:51:54 +0000 (09:51 -0700)]
Add String form of PackInvalidException constructor

This way the path can be supplied as a string, without first
converting to a java.io.File.

Change-Id: I54d9bb9867556cd98b378c0762054b31497459cb

13 years agoAdd copy constructor to PackConfig 24/3924/1
Shawn O. Pearce [Wed, 27 Jul 2011 13:34:52 +0000 (06:34 -0700)]
Add copy constructor to PackConfig

Some embeddings of UploadPack (e.g. Gerrit Code Review) set their own
PackConfig from a server-wide configuration, overriding any JGit
defaults or settings that may exist at the local repository level.

Make a copy constructor form of PackConfig so this server-wide
configuration object can be copied and then merged with repository
specific configuration data.

Change-Id: I4463c95aeaf7d6536c3ab132dec9c50ee528d9e0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoDon't close ObjectDatabase after parsing pack 23/3923/1
Shawn O. Pearce [Fri, 15 Jul 2011 23:28:26 +0000 (16:28 -0700)]
Don't close ObjectDatabase after parsing pack

The cached object databases should not require a close to release
their cached resources. Most object databases just return their
own reference for newCachedDatabase(), so a close() here kills
the real database's internal caches, and possibly underlying files,
resulting in poor performance for the callers of PackParser like
ReceivePack or FetchProcess trying to then go look up objects that
were just parsed, or that current references point to.

Change-Id: Ia4a239093866e5b9faf82744f729fb73f4373f1a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge doesn't remove empty folders 56/3756/2
Tomasz Zarna [Mon, 20 Jun 2011 16:17:56 +0000 (18:17 +0200)]
Merge doesn't remove empty folders

Bug: 349848
Change-Id: I2aa5a1a7259889428e4845046b900538262f3c84

13 years agoAdd support for reseting on directories 13/3713/4
Dariusz Luksza [Wed, 6 Jul 2011 22:27:14 +0000 (00:27 +0200)]
Add support for reseting on directories

Reset command should works recursively and allows reset all changed
files in given directory.

Bug: 348524
Change-Id: I441db34f226be36548c61cef77958995971498de
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFixed creation of branch from a tag 16/3816/3
Sasa Zivkov [Tue, 5 Jul 2011 12:06:49 +0000 (14:06 +0200)]
Fixed creation of branch from a tag

Creation of a branch X from an annotated tag, as the starting point,
resulted into .git/refs/heads/X containing the ID of the annotated tag
instead of the ID of the tagged commit.

This fix peels the tag ref before using it as the starting point for
the newly created branch.

Bug: 340836
Change-Id: I01c7325770ecb37f5bf8ddb2a22f802466524f24
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Merge in JGit CLI is missing break statement"
Chris Aniszczyk [Tue, 12 Jul 2011 13:53:51 +0000 (09:53 -0400)]
Merge "Merge in JGit CLI is missing break statement"

13 years agoMerge in JGit CLI is missing break statement 65/3865/2
Tomasz Zarna [Tue, 12 Jul 2011 09:51:03 +0000 (11:51 +0200)]
Merge in JGit CLI is missing break statement

Change-Id: I2095601b848e66e54d5dac828ef6ed1a4c5ae66c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoCleanup directories leftover by test. 15/3815/5
Adrian Goerler [Thu, 7 Jul 2011 21:16:40 +0000 (23:16 +0200)]
Cleanup directories leftover by test.

Use the temporary file management from superclass.

Change-Id: I3042951dc21860b4b85dd72a6bf41ee7cfe2aba4
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoCloning should fail when destination directory exists and is not empty 18/3518/8
Adrian Goerler [Wed, 6 Jul 2011 21:10:44 +0000 (23:10 +0200)]
Cloning should fail when destination directory exists and is not empty

When trying to clone into a folder that already contains a cloned
repository native git will fail with a message "fatal: destination path
'folder' already exists and is not an empty directory.". Now JGit will
also fail in this situation throwing a JGitInternalException.

The test case was provided by Tomasz Zarna.

Bug: 347852
Change-Id: If9e9919a5f92d13cf038dc470c21ee5967322dac
Also-by: Tomasz Zarna <Tomasz.Zarna@pl.ibm.com>
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoDo not catch Exception in test cases 30/3830/2
Stefan Lay [Wed, 6 Jul 2011 11:36:57 +0000 (13:36 +0200)]
Do not catch Exception in test cases

Exception handling is already done by JUnit.

Change-Id: Ia25d768c311d384d728f281aced92f598e5e2041
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
13 years agoMerge "Cleanup curly braces"
Christian Halstrick [Wed, 6 Jul 2011 08:44:54 +0000 (04:44 -0400)]
Merge "Cleanup curly braces"

13 years agoCleanup curly braces 24/3824/1
Adrian Goerler [Wed, 6 Jul 2011 08:29:56 +0000 (10:29 +0200)]
Cleanup curly braces

Change-Id: I2de6439a3ad951a99d89e4aee02006c745d16510
Signed-off-by: Adrian Goerler <adrian.goerler@sap.com>
13 years agoMerge "Add lookup to remote config if the refSpec is not explicitly set"
Christian Halstrick [Wed, 6 Jul 2011 08:14:49 +0000 (04:14 -0400)]
Merge "Add lookup to remote config if the refSpec is not explicitly set"

13 years agoAdd lookup to remote config if the refSpec is not explicitly set 08/3808/3
Stefan Lay [Mon, 4 Jul 2011 11:20:51 +0000 (13:20 +0200)]
Add lookup to remote config if the refSpec is not explicitly set

If no refSpec is explicitly set, the PushCommand should first check the
remote config and then as a fallback use the current behavior.

Change-Id: I2bc648abc517b1d01b2de15d383423ace2081e72
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
13 years agoMerge "Enable PlotWalk to show additional refs"
Shawn Pearce [Fri, 1 Jul 2011 15:58:24 +0000 (11:58 -0400)]
Merge "Enable PlotWalk to show additional refs"

13 years agoEnable PlotWalk to show additional refs 01/3801/3
Stefan Lay [Fri, 1 Jul 2011 15:38:01 +0000 (17:38 +0200)]
Enable PlotWalk to show additional refs

Change-Id: Ic85f8859571dc2aef7f146ce56a6c9b8ec142e60
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
13 years agoMerge "Improve performance when writing trees and small blobs"
Shawn O. Pearce [Fri, 1 Jul 2011 15:04:41 +0000 (11:04 -0400)]
Merge "Improve performance when writing trees and small blobs"

13 years agoMerge "TemporaryBuffer: Fix reading from in-memory InputStream"
Shawn O. Pearce [Fri, 1 Jul 2011 14:55:16 +0000 (10:55 -0400)]
Merge "TemporaryBuffer: Fix reading from in-memory InputStream"

13 years agoMerge "Implement Serializable interface in PersonIdent class."
Shawn Pearce [Fri, 1 Jul 2011 14:55:02 +0000 (10:55 -0400)]
Merge "Implement Serializable interface in PersonIdent class."

13 years agoMerge "Fix compilation with Java 1.5"
Matthias Sohn [Fri, 1 Jul 2011 11:20:48 +0000 (07:20 -0400)]
Merge "Fix compilation with Java 1.5"

13 years agoImplement Serializable interface in PersonIdent class. 03/3803/1
Kevin Sawicki [Thu, 30 Jun 2011 16:38:43 +0000 (09:38 -0700)]
Implement Serializable interface in PersonIdent class.

Change-Id: I3229f4ec85e7604cb45642813757975b30f1227e
Signed-off-by: Kevin Sawicki <kevin@github.com>
13 years agoDirCacheCheckout: unlock DirCache in case of failure 99/3799/1
Jens Baumgart [Wed, 29 Jun 2011 12:18:00 +0000 (14:18 +0200)]
DirCacheCheckout: unlock DirCache in case of failure

DirCacheCheckout did not unlock the index if e.g. an IOException occured
during checkout.

Bug: 350677
Change-Id: Ie9fa09f7a404080da7cdccafb9be3a8c845e4869
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
13 years agoFix compilation with Java 1.5 95/3795/3
Carsten Pfeiffer [Wed, 29 Jun 2011 07:45:31 +0000 (09:45 +0200)]
Fix compilation with Java 1.5

Change-Id: I785f59fcf2018cd923d4d1617b923049dbde9809

13 years agoMerge "RFC: Ugly fix for i18n of metaVar CLI arguments"
Shawn Pearce [Fri, 24 Jun 2011 22:47:32 +0000 (18:47 -0400)]
Merge "RFC: Ugly fix for i18n of metaVar CLI arguments"

13 years agoImprove performance when writing trees and small blobs 78/3778/1
Shawn O. Pearce [Fri, 24 Jun 2011 19:55:19 +0000 (12:55 -0700)]
Improve performance when writing trees and small blobs

ObjectDirectoryInserter was always creating a temporary file,
writing the complete compressed contents of a tree, fsync()'ing
that to stable storage, and only then checking to see if there
was already an object with the same SHA-1 in the repository.

For commits this strategy makes some sense, the commit is very
unlikely to exist in the repository, as there are embedded times
and these change with each commit.

However for trees coming out of DirCache, it is more common for the
tree to already exist in the repository. Most subdirectories are
not modified in any given commit.  Doing all of this local file IO
for things that already exist is very slow.

Try to detect cases where the object is "small enough" that it can
be processed entirely in memory, and avoid doing disk IO entirely
if the object already exists.

Also increase the size of the output buffer for the deflation.
This should boost the average write(2) syscall size from 512 bytes
to 8192 bytes, making streaming of large compressed contents to
disk slightly more efficient.

Change-Id: I1d40364e8725468522435814631916d73174c92b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoTemporaryBuffer: Fix reading from in-memory InputStream 77/3777/1
Shawn O. Pearce [Fri, 24 Jun 2011 19:35:19 +0000 (12:35 -0700)]
TemporaryBuffer: Fix reading from in-memory InputStream

I had the conditions wrong here, causing the in-memory InputStream
to always appear to be at EOF.

Change-Id: I6811d6187a34eaf1fd6c5002550d631decdfc391
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoAdd ReflogCommand 36/3636/3
Chris Aniszczyk [Sun, 19 Jun 2011 14:17:21 +0000 (09:17 -0500)]
Add ReflogCommand

Adds a git-reflog command and associated tests.

Bug: 347859
Change-Id: Iba146ac842cc9ca0be43d3381b4082c9e92bf56f
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoRefactor out ReflogEntry 55/3755/1
Chris Aniszczyk [Sun, 19 Jun 2011 13:58:25 +0000 (08:58 -0500)]
Refactor out ReflogEntry

It's useful to have ReflogEntry refactored out so it can be
used by clients via the JGit API.

Change-Id: I03044df9af9f9547777545b7c9b93bdf5f8b7cb5
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoRFC: Ugly fix for i18n of metaVar CLI arguments 58/3758/1
Robin Rosenberg [Sun, 19 Jun 2011 22:55:13 +0000 (00:55 +0200)]
RFC: Ugly fix for i18n of metaVar CLI arguments

This patch possibly ties to a specific version of args4j.

Bug: 318286
Change-Id: I05d4ecf6bd25deec7fb2efbfa61913f4ec4e04e5
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoMerge changes Ie393fb8b,Ib11a077a
Robin Rosenberg [Fri, 17 Jun 2011 15:26:38 +0000 (11:26 -0400)]
Merge changes Ie393fb8b,Ib11a077a

* changes:
  Push errors back over sideband when possible
  Report progress while updating references

13 years agoFix IndexOutOfBoundsException when parsing PersonIdent 31/3731/1
Marc Strapetz [Tue, 14 Jun 2011 14:56:48 +0000 (16:56 +0200)]
Fix IndexOutOfBoundsException when parsing PersonIdent

IndexOutOfBoundsException could occur when parsing
PersonIdent for which no name is present, as part of a
RevCommit (nameB > 0).

13 years agoPush errors back over sideband when possible 58/3558/2
Shawn O. Pearce [Fri, 27 May 2011 20:35:18 +0000 (13:35 -0700)]
Push errors back over sideband when possible

If an internal exception occurs while packing and the request
needs to abort, the HTTP response might already be committed due
to progress message having already been delivered to the client.
This prevents UploadPackServlet from resetting the response and
sending back an HTTP 500 response.

Try to catch all exceptions and report internal errors over the
sideband stream or as an ERR command during the initial ACK/NAK
negotiation phase. This allows JGit to transmit an error message
that the user will receive on their console without needing to
worry about resetting the (already gone) HTTP response.

Change-Id: Ie393fb8bb55d2b79ab1276adf71c781c1807f9fe
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoReport progress while updating references 56/3556/2
Shawn O. Pearce [Fri, 27 May 2011 17:46:02 +0000 (10:46 -0700)]
Report progress while updating references

If a fetch or push needs to apply more than a few references
to the local repository it may take more than 0.25 seconds to
process all of the updates.  This is especially true in the DHT
storage system during an initial push of a project with many tags.
The backend database may need to use a transaction to ensure each
tag reference creation is unique, and there may be large delays
caused by these transactions.

Change-Id: Ib11a077adfbd525253e425d327f2e2c2380804c7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMerge branch 'stable-1.0' 98/3698/1
Matthias Sohn [Thu, 9 Jun 2011 15:41:16 +0000 (17:41 +0200)]
Merge branch 'stable-1.0'

* stable-1.0:
  Prepare post JGit v1.0.0.201106090707-r builds
  JGit v1.0.0.201106090707-r
  Include about.html files in maven build
  Prepare post v1.0.0.201106081625-r builds
  JGit v1.0.0.201106081625-r
  Add missing about.html files to all shipped bundles
  Prepare post v1.0.0.201106071701-r builds
  JGit v1.0.0.201106071701-r

13 years agoPrepare post JGit v1.0.0.201106090707-r builds 96/3696/1 stable-1.0
Matthias Sohn [Thu, 9 Jun 2011 12:11:23 +0000 (14:11 +0200)]
Prepare post JGit v1.0.0.201106090707-r builds

Change-Id: I35292f9f6fb5ebc591308fdd2d069203413e189d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit v1.0.0.201106090707-r v1.0.0.201106090707-r
Matthias Sohn [Thu, 9 Jun 2011 11:11:58 +0000 (13:11 +0200)]
JGit v1.0.0.201106090707-r

Change-Id: Iba44e71b6441a0e39122ca8666b51989e605f25f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoInclude about.html files in maven build 94/3694/1
Matthias Sohn [Wed, 8 Jun 2011 20:42:20 +0000 (22:42 +0200)]
Include about.html files in maven build

Change-Id: Ifa96090eb0fc336ee8080385f48212b5158dd9f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoPrepare post v1.0.0.201106081625-r builds 93/3693/1
Matthias Sohn [Thu, 9 Jun 2011 09:06:05 +0000 (11:06 +0200)]
Prepare post v1.0.0.201106081625-r builds

Change-Id: I5e6994844405f7839ad3b3439f98bcadb59d329b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit v1.0.0.201106081625-r 89/3689/1 v1.0.0.201106081625-r
Matthias Sohn [Wed, 8 Jun 2011 20:42:20 +0000 (22:42 +0200)]
JGit v1.0.0.201106081625-r

Change-Id: I629990189083bab4737938ad712080fba7917582
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoAdd missing about.html files to all shipped bundles 85/3685/2
Matthias Sohn [Wed, 8 Jun 2011 19:51:51 +0000 (21:51 +0200)]
Add missing about.html files to all shipped bundles

Change-Id: I5a4ad9493da3816f21d9fdd0b5b977388d074500
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoPrepare post v1.0.0.201106071701-r builds 84/3684/1
Matthias Sohn [Wed, 8 Jun 2011 14:30:59 +0000 (16:30 +0200)]
Prepare post v1.0.0.201106071701-r builds

Change-Id: I67ee2912ef54462cf860dc4ec0a6334e9c619384
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit v1.0.0.201106071701-r 76/3676/1 v1.0.0.201106071701-r
Matthias Sohn [Tue, 7 Jun 2011 21:04:55 +0000 (23:04 +0200)]
JGit v1.0.0.201106071701-r

Change-Id: Ic8f49336ba96c8dcf4bab2f74c0f1efc1ab55131
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoPrepare 1.1.0 builds 53/3653/1
Matthias Sohn [Sun, 5 Jun 2011 23:24:32 +0000 (01:24 +0200)]
Prepare 1.1.0 builds

Change-Id: I4cf017cd567543846839612ab3ace6d26233e01d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoMerge branch 'stable-1.0' 52/3652/1
Matthias Sohn [Sun, 5 Jun 2011 23:19:52 +0000 (01:19 +0200)]
Merge branch 'stable-1.0'

* stable-1.0:
  Prepare post v1.0.0.201106051725-r builds
  JGit v1.0.0.201106051725-r
  Update to eclipse.org's latest SUA

13 years agoPrepare post v1.0.0.201106051725-r builds 51/3651/1
Matthias Sohn [Sun, 5 Jun 2011 23:17:16 +0000 (01:17 +0200)]
Prepare post v1.0.0.201106051725-r builds

Change-Id: I4839877e1a6fa7782f37423213af8d579727a494
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit v1.0.0.201106051725-r 49/3649/1 v1.0.0.201106051725-r
Matthias Sohn [Sun, 5 Jun 2011 21:26:56 +0000 (23:26 +0200)]
JGit v1.0.0.201106051725-r

Change-Id: I39f4a23cf284505395d511dfedf02b7f5608df95
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoUpdate to eclipse.org's latest SUA 32/3632/2
Matthias Sohn [Thu, 2 Jun 2011 20:53:11 +0000 (22:53 +0200)]
Update to eclipse.org's latest SUA

Change-Id: I0d016ddaed85656c2e680d0bc99829c6ea13b968
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoMerge branch 'stable-1.0' 27/3627/1
Matthias Sohn [Wed, 1 Jun 2011 23:45:50 +0000 (01:45 +0200)]
Merge branch 'stable-1.0'

* stable-1.0:
  Prepare post v1.0.0.201106011211-rc3 builds
  JGit v1.0.0.201106011211-rc3
  Remove incubation marker
  blame: Compute the origin of lines in a result file

13 years agoPrepare post v1.0.0.201106011211-rc3 builds 19/3619/1
Matthias Sohn [Wed, 1 Jun 2011 16:55:11 +0000 (18:55 +0200)]
Prepare post v1.0.0.201106011211-rc3 builds

Change-Id: I4dec8eba7e35858aef65fcc10f91fad3fe5b52b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoJGit v1.0.0.201106011211-rc3 18/3618/1 v1.0.0.201106011211-rc3
Matthias Sohn [Wed, 1 Jun 2011 16:22:44 +0000 (18:22 +0200)]
JGit v1.0.0.201106011211-rc3

Change-Id: I574a05200471c431b3a02ac6ff208dc6aa90f539
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoRemove incubation marker 99/3599/1
Matthias Sohn [Tue, 31 May 2011 20:53:53 +0000 (22:53 +0200)]
Remove incubation marker

Change-Id: I6018ce0cd3b7c8137e137848fe1f04551b257538
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoblame: Compute the origin of lines in a result file 97/3597/1
Shawn O. Pearce [Fri, 27 May 2011 22:27:17 +0000 (15:27 -0700)]
blame: Compute the origin of lines in a result file

BlameGenerator digs through history and discovers the origin of each
line of some result file.  BlameResult consumes the stream of regions
created by the generator and lays them out in a table for applications
to display alongside of source lines.

Applications may optionally push in the working tree copy of a file
using the push(String, byte[]) method, allowing the application to
receive accurate line annotations for the working tree version.  Lines
that are uncommitted (difference between HEAD and working tree) will
show up with the description given by the application as the author,
or "Not Committed Yet" as a default string.

Applications may also run the BlameGenerator in reverse mode using the
reverse(AnyObjectId, AnyObjectId) method instead of push().  When
running in the reverse mode the generator annotates lines by the
commit they are removed in, rather than the commit they were added in.
This allows a user to discover where a line disappeared from when they
are looking at an older revision in the repository.  For example:

  blame --reverse 16e810b2..master -L 1080, org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefDirectoryTest.java
           (                                              1080)   }
  2302a6d3 (Christian Halstrick 2011-05-20 11:18:20 +0200 1081)
  2302a6d3 (Christian Halstrick 2011-05-20 11:18:20 +0200 1082)   /**
  2302a6d3 (Christian Halstrick 2011-05-20 11:18:20 +0200 1083)    * Kick the timestamp of a local file.

Above we learn that line 1080 (a closing curly brace of the prior
method) still exists in branch master, but the Javadoc comment below
it has been removed by Christian Halstrick on May 20th as part of
commit 2302a6d3.  This result differs considerably from that of C
Git's blame --reverse feature.  JGit tells the reader which commit
performed the delete, while C Git tells the reader the last commit
that still contained the line, leaving it an exercise to the reader
to discover the descendant that performed the removal.

This is still only a basic implementation.  Quite notably it is
missing support for the smart block copy/move detection that the C
implementation of `git blame` is well known for.  Despite being
incremental, the BlameGenerator can only be run once.  After the
generator runs it cannot be reused.  A better implementation would
support applications browsing through history efficiently.

In regards to CQ 5110, only a little of the original code survives.

CQ: 5110
Bug: 306161
Change-Id: I84b8ea4838bb7d25f4fcdd540547884704661b8f
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix a complicated multi level nested if block structure to use a single level with... 67/3467/3
Ketan Padegaonkar [Thu, 19 May 2011 07:43:18 +0000 (13:13 +0530)]
Fix a complicated multi level nested if block structure to use a single level with multiple returns.

Change-Id: I3f116f37045e83aba5c80d45b987ab075502dcc6

13 years agoMerge branch 'stable-1.0' 93/3593/2
Shawn O. Pearce [Tue, 31 May 2011 16:14:50 +0000 (09:14 -0700)]
Merge branch 'stable-1.0'

* stable-1.0:
  DHT: Support removing a repository name
  DHT: Fix thread-safety issue in AbstractWriteBuffer
  jgit.sh: Implement pager support
  Change EditList to extend ArrayList
  Ensure the HTTP request is fully consumed
  Make sure test repositories are closed
  Fix CloneCommand not to fetch into remote tracking branches when bare
  Update Eclipse IP log for 1.0

Change-Id: I6340d551482e1dda01f82496296d2038b07fa68b

13 years agoDHT: Support removing a repository name 92/3592/1
Shawn O. Pearce [Fri, 27 May 2011 00:25:59 +0000 (17:25 -0700)]
DHT: Support removing a repository name

The first step to deleting a repository from the DHT storage is to
remove the name binding in the RepositoryIndexTable, making the
repository unavailable for lookup.

Change-Id: I469bf92f4bf2f555a15949569b21937c14cb142b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoDHT: Fix thread-safety issue in AbstractWriteBuffer 91/3591/1
Shawn O. Pearce [Fri, 27 May 2011 00:19:30 +0000 (17:19 -0700)]
DHT: Fix thread-safety issue in AbstractWriteBuffer

There is a data corruption issue with the 'running' list if a
background thread schedules something onto the buffer while the
application thread is also using it.

Change-Id: I5ba78b98b6632965d677a9c8f209f0cf8320cc3d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agojgit.sh: Implement pager support 90/3590/1
Shawn O. Pearce [Sun, 29 May 2011 20:05:03 +0000 (13:05 -0700)]
jgit.sh: Implement pager support

If the command is either `diff` or `log`, there is often a lot of
lines of output. Run these commands through $GIT_PAGER, $PAGER, or
`less` in order to make it easier to browse the output on a terminal.

Change-Id: I18b87ea4acf404b94788f2ac2101812bd13e6a0f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoChange EditList to extend ArrayList 89/3589/1
Shawn O. Pearce [Sun, 29 May 2011 19:24:27 +0000 (12:24 -0700)]
Change EditList to extend ArrayList

There is no reason for this type to contain an ArrayList and try to
hide the implementation. It only slows down execution by adding an
extra layer of method dispatch to each invocation.

Instead subclass from ArrayList.

Change-Id: Ifbb9c7060c2fe3d5a7397c1aa85fbade14088637
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoEnsure the HTTP request is fully consumed 88/3588/1
Shawn O. Pearce [Fri, 27 May 2011 19:04:19 +0000 (12:04 -0700)]
Ensure the HTTP request is fully consumed

Some servlet containers require the servlet to read the EOF marker
from the input stream before a response can be output if the stream
is using "Transfer-Encoding: chunked"... which is typical for any
sort of large push to a repository over smart HTTP.

Ensure the EOF is always read by the PackParser when it is handling
the stream, and fail fast if there is more data present than expected
since this does indicate a protocol error.

Also ensure the EOF is read by UploadPack before it starts to output
a partial response using packing progress meters.

Change-Id: I131db9dea20b2324cb7c3272a814f21296bc64bd
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
13 years agoMake sure test repositories are closed 87/3587/1
Christian Halstrick [Tue, 24 May 2011 07:36:45 +0000 (09:36 +0200)]
Make sure test repositories are closed

Some repositories created during tests are not added to the 'toClose'
list in LocalDiskRepositoryTestCase. Therefore when the tests end
we may have open FileHandles and on Windows this may cause the
tests to fail because we can't delete those files.

This is fixed by adding the possibility to explicitly add
repositories to the list of repos which are closed automatically.

Change-Id: I1261baeef4c7d9aaedd7c34b546393bfa005bbcc
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoFix CloneCommand not to fetch into remote tracking branches when bare 86/3586/1
Christian Halstrick [Mon, 23 May 2011 22:45:21 +0000 (00:45 +0200)]
Fix CloneCommand not to fetch into remote tracking branches when bare

When cloning into a bare repository we should not create remote
tracking branches (e.g refs/remotes/origin/testX). Branches of the
remote repository should but fetched into into branches of the same
name (e.g refs/heads/testX). Also add the noCheckout option which
would prevent checkout after fetch.

Change-Id: I5d4cc0389f3f30c53aa0065f38119af2a1430909
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoMerge 'Fix usage of FileSnapshot in RefDirectory' into stable-1.0 84/3584/1
Shawn O. Pearce [Tue, 31 May 2011 15:33:57 +0000 (08:33 -0700)]
Merge 'Fix usage of FileSnapshot in RefDirectory' into stable-1.0

* commit '475461d05266fe13b05bc2c6645b9ef928521b4c':
  Fix usage of FileSnapshot in RefDirectory

Change-Id: Ie65bd8b36f4c6a91602a94e9b54a04a4fb335897

13 years agoCleanCommand: add the ability to do a dry run 53/3553/4
Abhishek Bhatnagar [Fri, 27 May 2011 20:30:27 +0000 (16:30 -0400)]
CleanCommand: add the ability to do a dry run

Change-Id: I7b81a7e34a771951e2e7b789b080b2bfb8656e5c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Fix GitConstructionTest teardown"
Shawn Pearce [Tue, 31 May 2011 14:01:56 +0000 (10:01 -0400)]
Merge "Fix GitConstructionTest teardown"

13 years agoFix usage of FileSnapshot in RefDirectory 81/3581/1
Christian Halstrick [Mon, 30 May 2011 22:22:40 +0000 (00:22 +0200)]
Fix usage of FileSnapshot in RefDirectory

RefDirectory was not using FileSnapshot correctly in all places. This
is fixed with this commit. Additionally the constructors for the
different types of refs have been changed to take a FileSnapshot
instead of a modification time.

Change-Id: Ifb6a59e87e8b058a398c38cdfb9d648f0bad4bf8
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
13 years agoFix GitConstructionTest teardown 78/3578/1
Robin Rosenberg [Mon, 30 May 2011 20:39:04 +0000 (22:39 +0200)]
Fix GitConstructionTest teardown

The teardown faile on Windows because the repos were not closed.

Change-Id: I16cf5645558680029682f898386b061796948237
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoUpdate Eclipse IP log for 1.0 33/3533/1
Matthias Sohn [Wed, 25 May 2011 18:12:21 +0000 (20:12 +0200)]
Update Eclipse IP log for 1.0

CQ "4876" is jgit's CQ for usage of protobuf, CQ "5135"
is the corresponding Orbit CQ.

Change-Id: I300cf2b5758c7da9c18494325f2f38bb3744e459
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoMerge "Use the stored password instead of prompting for it all the time"
Matthias Sohn [Wed, 25 May 2011 16:08:17 +0000 (12:08 -0400)]
Merge "Use the stored password instead of prompting for it all the time"

13 years agoDHT: Add sequence RefData 21/3521/3
Shawn O. Pearce [Fri, 13 May 2011 16:16:58 +0000 (09:16 -0700)]
DHT: Add sequence RefData

RefData now uses a sequence number as part of the field, ensuring
that updates always increase the sequence number by one whenever
a reference is modified.

Attaching a sequence number to RefData will help with storing
reference log entries during updates. As the sequence number should
be unique within the reference name space, log entries can be keyed
by the sequence number and remain unique.  Making this work over
reference delete-create cycles will require an additional RefTable
API to return the oldest sequence number previously used in the
reference log to seed the recreated reference.

Change-Id: I11cfff2a96ef962e57f29925a3eef41bdbf9f9bb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoDHT: Replace TinyProtobuf with Google Protocol Buffers 45/3345/7
Shawn O. Pearce [Fri, 13 May 2011 14:44:42 +0000 (07:44 -0700)]
DHT: Replace TinyProtobuf with Google Protocol Buffers

The standard Google distribution of Protocol Buffers in Java is better
maintained than TinyProtobuf, and should be faster for most uses.  It
does use slightly more memory due to many of our key types being
stored as strings in protobuf messages, but this is probably worth the
small hit to memory in exchange for better maintained code that is
easier to reuse in other applications.

Exposing all of our data members to the underlying implementation
makes it easier to develop reporting and data mining tools, or to
expand out a nested structure like RefData into a flat format in a SQL
database table.

Since the C++ `protoc` tool is necessary to convert the protobuf
script into Java code, the generated files are committed as part of
the source repository to make it easier for developers who do not have
this tool installed to still build the overall JGit package and make
use of it.  Reviewers will need to be careful to ensure that any edits
made to a *.proto file come in a commit that also updates the
generated code to match.

CQ: 5135
Change-Id: I53e11e82c186b9cf0d7b368e0276519e6a0b2893
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoDHT: Remove per-process ChunkCache 41/3341/4
Shawn O. Pearce [Thu, 5 May 2011 18:18:54 +0000 (11:18 -0700)]
DHT: Remove per-process ChunkCache

Performance testing has indicated the per-process ChunkCache isn't
very effective for the DHT storage implementation.  If a server is
using the DHT storage backend, it is most likely part of a larger
cluster where requests are distributed in a round-robin fashion
between the member servers.

In such a scenario there is insufficient data locality between
requests to get a good hit ratio on the per-process ChunkCache.  A low
hit ratio means the cache is actually hurting performance by eating up
memory that could otherwise be used for transient request data, and
increasing pressure on the GC when it needs to find free space.

Remove all of the ChunkCache code.  Installations that want to cache
(to reduce database usage) should wrap their Database with a
CacheDatabase and use a network based CacheServer.

I left the ChunkCache in the original DHT storage commit because I
wanted to document in the history of the project that its probably
worth *not* having, but leave open a door for someone to revert this
change if they find otherwise at a later date.

Change-Id: I364d0725c46c5a19f7443642a40c89ba4d3fdd29
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Let RefDirectory use FileSnapShot to handle fast updates"
Chris Aniszczyk [Wed, 25 May 2011 13:46:49 +0000 (09:46 -0400)]
Merge "Let RefDirectory use FileSnapShot to handle fast updates"

13 years agoAdd a DiffFormatter which calculates a patch-id 86/3486/4
Stefan Lay [Tue, 24 May 2011 08:38:59 +0000 (01:38 -0700)]
Add a DiffFormatter which calculates a patch-id

Adds a class which can be used to calculates a SHA1 of the diff
associated with a patch, similar to git patch-id.

In this version whitespace is not ignored.

Change-Id: I421d15ea905e23df543082786786841cbe3ef10d
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd CleanCommandTest and fix CleanCommand 17/3517/5
Abhishek Bhatnagar [Tue, 24 May 2011 18:45:05 +0000 (14:45 -0400)]
Add CleanCommandTest and fix CleanCommand

Bug: 334767
Change-Id: I0a836451ceb668f943b1f353dc65420157810b23
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd CleanCommand to JGit API 84/3484/6
Abhishek Bhatnagar [Fri, 20 May 2011 16:01:37 +0000 (12:01 -0400)]
Add CleanCommand to JGit API

Bug: 334767
Change-Id: I2650c77bc4af2d8f401bbcce5384b44ff2a64ba2
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoUse the stored password instead of prompting for it all the time 22/2722/4
Carsten Pfeiffer [Mon, 23 May 2011 22:17:01 +0000 (00:17 +0200)]
Use the stored password instead of prompting for it all the time

EGit change Iba3b87293c22e5fe7d989fc312184aa7463c4387 is also required
to make this work for EGit.

Change-Id: Iedc80e133e66d72e78ff0980b6e12634f75eca36
Signed-off-by: Carsten Pfeiffer <carsten.pfeiffer@gebit.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
13 years agoLet RefDirectory use FileSnapShot to handle fast updates 81/3481/3
Christian Halstrick [Fri, 20 May 2011 09:18:20 +0000 (11:18 +0200)]
Let RefDirectory use FileSnapShot to handle fast updates

Since this change may affect performance and memory consumption on every
access to a loose ref I explicitly made it a RFC to collect opinions.

Previously RefDirectory.scanRef() was not detecting an update of a
loose ref when the update didn't changed the modification time of
the backing file. RefDirectory cached loose refs and the way to detect
outdated cache entries was to compare lastmodification timestamp on the
file representing the ref. If two updates to the same ref happen faster
than the filesystem-timer granularity (for linux this is 2 seconds)
there is the possiblity that we don't detect the update.

Because of this bug EGit's PushOperationTest only works with 2 second
sleeps inside.

This change let RefDirectory use FileSnapshot to detect such situations.
FileSnapshot helps to remember when a file was last read from disk and
therefore enables to decide when to load a file from disk although
modification time has not changed.

Change-Id: I03b9a137af097ec69c4c5e2eaa512d2bdd7fe080
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd shortening of note ref names to NoteMap 04/3504/3
Kevin Sawicki [Mon, 23 May 2011 18:39:33 +0000 (11:39 -0700)]
Add shortening of note ref names to NoteMap

Change-Id: I224190bbb41c7cbea38388d0148ecc6dc68f3a14
Signed-off-by: Kevin Sawicki <kevin@github.com>
13 years agoMerge "Remove rebase temporary files on checkout failure"
Shawn Pearce [Mon, 23 May 2011 15:33:49 +0000 (11:33 -0400)]
Merge "Remove rebase temporary files on checkout failure"

13 years agoAdd GitAddTask 79/3479/2
Ketan Padegaonkar [Fri, 20 May 2011 09:15:00 +0000 (14:45 +0530)]
Add GitAddTask

Change-Id: Ia9a3c9f4728e13d1e62f530b1d843d09afb4eb42
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoRemove rebase temporary files on checkout failure 99/3499/2
Bernard Leach [Sun, 22 May 2011 14:20:32 +0000 (00:20 +1000)]
Remove rebase temporary files on checkout failure

A checkout conflict during rebase setup should leave the repository
in SAFE state which means ensuring that the rebase temporary files
need to be removed.

Bug: 346813
Change-Id: If8b758fde73ed5a452a99a195a844825a03bae1a
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd LsRemoteCommandTest 74/3474/3
Chris Aniszczyk [Thu, 19 May 2011 19:39:19 +0000 (14:39 -0500)]
Add LsRemoteCommandTest

Bug: 343801
Change-Id: I4a91d93428bbf7f74033fcea5823266fa52d7a0c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd LsRemoteCommand to JGit API 46/3346/4
Christoph Brill [Thu, 19 May 2011 19:38:39 +0000 (14:38 -0500)]
Add LsRemoteCommand to JGit API

Bug: 343801
Change-Id: Ic651e8e09143e15ed459461b50b2222e13da56c4
Also-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd org.eclipse.jgit.ant.test to parent pom.xml 71/3471/3
Chris Aniszczyk [Thu, 19 May 2011 16:20:19 +0000 (11:20 -0500)]
Add org.eclipse.jgit.ant.test to parent pom.xml

Change-Id: I3fd0b509e03cbd5f2bf3bd6377287dab14e8728e
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd GitCloneTaskTest 68/3468/2
Ketan Padegaonkar [Thu, 19 May 2011 08:32:02 +0000 (14:02 +0530)]
Add GitCloneTaskTest

Change-Id: Iec8cd032d8d659a896d909f9094f76b7d35147e6
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoCreate a MergeResult for deleted/modified files 09/3409/3
Bernard Leach [Fri, 13 May 2011 05:59:57 +0000 (15:59 +1000)]
Create a MergeResult for deleted/modified files

Change Ia2ab4f8dc95020f2914ff01c2bf3b1bc62a9d45d added merge
support for when OURS or THEIRS was simultaneously deleted
and modified.  That changeset however did not add create an
entry in the conflicts table so clients would see a CONFLICTING
result but getConflicts() would return null.

This change creates a MergeResult for the conflicting file.

Bug: 345684
Change-Id: I52acb81c1729b49c9fb3e7a477c6448d8e55c317
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd reset with paths support to ResetCommand 53/3453/3
Bernard Leach [Thu, 19 May 2011 11:04:20 +0000 (21:04 +1000)]
Add reset with paths support to ResetCommand

Bug: 338701
Change-Id: Id7cbce47131b459e632ddc2c9a94628c7d0b75cd
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix NPE in URIish when parsing an empty URI 66/3466/2
Ketan Padegaonkar [Thu, 19 May 2011 07:38:26 +0000 (13:08 +0530)]
Fix NPE in URIish when parsing an empty URI

Change-Id: Id1c42dc9843f62c581b9904b02150de53cf7777c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd org.eclipse.jgit.ant.test 65/3465/2
Ketan Padegaonkar [Thu, 19 May 2011 06:28:28 +0000 (11:58 +0530)]
Add org.eclipse.jgit.ant.test

Change-Id: I9bfb1298864294b8ce29b91660f1cf8316e5f620
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoAdd tests for change If203ce5 56/3456/2
Bernard Leach [Wed, 18 May 2011 16:41:18 +0000 (11:41 -0500)]
Add tests for change If203ce5

Bug: 344779
Change-Id: I1628984479d93665bf4987d6a4ff8e67ad73eb36
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoImplement rebase ff for upstream branches with merge commits 36/3336/8
Chris Aniszczyk [Wed, 18 May 2011 16:39:33 +0000 (11:39 -0500)]
Implement rebase ff for upstream branches with merge commits

Change Ib9898fe0f982fa08e41f1dca9452c43de715fdb6 added support for
the 'cherry-pick' fast forward case where the upstream commit history
does not include any merge commits.  This change adds support for the
case where merge commits exist and the local branch has no changes.

Bug: 344779
Change-Id: If203ce5aa1b4e5d4d7982deb621b710e71f4ee10
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoFix path filtering in LogCommand 55/3455/3
Piotr Janik [Wed, 18 May 2011 14:22:08 +0000 (16:22 +0200)]
Fix path filtering in LogCommand

Bug: 346257
Change-Id: Ib897e1b4962162da9670164479a844aeea7dfcd1
Signed-off-by: Piotr Janik <janikpiotrek@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
13 years agoMerge "Optimize MergeAlgorithm if ours or theirs is empty"
Robin Rosenberg [Tue, 17 May 2011 12:54:18 +0000 (08:54 -0400)]
Merge "Optimize MergeAlgorithm if ours or theirs is empty"

13 years agoOptimize MergeAlgorithm if ours or theirs is empty 10/3410/3
Christian Halstrick [Tue, 17 May 2011 08:59:17 +0000 (10:59 +0200)]
Optimize MergeAlgorithm if ours or theirs is empty

Previously when merging two contents with a non-empty base and one of
the contents was empty (size == 0) and the other was modified there
was a potentially expensive calculation until we finally always come
to the same result -> the complete non-deleted content should collide
with the empty content.

This proposal adds an optimization to detect empty input content and
to produce the appropriate result immediatly.

Change-Id: Ie6a837260c19d808f0e99173f570ff96dd22acd3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>