]> source.dussan.org Git - jgit.git/log
jgit.git
11 years agoPick default archive format based on filename suffix 09/13609/3
Jonathan Nieder [Fri, 7 Jun 2013 01:39:04 +0000 (18:39 -0700)]
Pick default archive format based on filename suffix

Introduce a setFilename() method for ArchiveCommand so callers can
specify the intended filename of the produced archive.  If the
filename ends with .tar, the format will default to tar; if .zip, zip;
if .tar.gz, gzip-compressed tar; and so on.

This doesn't affect "jgit archive" because it doesn't support the
--output=<file> option yet.  A later patch might do that.

Change-Id: Ic0236a70f7aa7f2271c3ef11083b21ee986b4df5

11 years agoAdd long filename, large file, and non-ASCII filename support to TarFormat 33/13633/1
Jonathan Nieder [Thu, 6 Jun 2013 19:31:46 +0000 (12:31 -0700)]
Add long filename, large file, and non-ASCII filename support to TarFormat

Attempts to write entries with too-long filenames currently error out:

  $ jgit.pgm/target/jgit archive HEAD >test.tar
  java.lang.RuntimeException: file name 'org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java' is too long ( > 100 bytes)
          at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:288)
          at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:92)
          at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:62)
          at org.eclipse.jgit.api.ArchiveCommand.writeArchive(ArchiveCommand.java:293)
          at org.eclipse.jgit.api.ArchiveCommand.call(ArchiveCommand.java:322)
          at org.eclipse.jgit.pgm.Archive.run(Archive.java:97)
          at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:174)
          at org.eclipse.jgit.pgm.Main.execute(Main.java:213)
          at org.eclipse.jgit.pgm.Main.run(Main.java:121)
          at org.eclipse.jgit.pgm.Main.main(Main.java:95)

That's because the default longFileMode is LONGFILE_ERROR, which
throws an exception for filenames longer than 100 characters.  Switch
to LONGFILE_POSIX.  While at it, handle large files and filenames with
strange encodings, too.

This requires commons compress 1.4, which introduced support for large
files and POSIX long filenames.

Change-Id: I04d5427eec0968b129f55d7a4c6021039a494828

11 years agoAdd tbz2 archive format 08/13608/1
Jonathan Nieder [Thu, 6 Jun 2013 02:12:37 +0000 (19:12 -0700)]
Add tbz2 archive format

Change-Id: Idb7ff75877a0cfe23f47e10e3f6f93386f5bb145

11 years agoInclude o.e.j.archive into o.e.jgit feature 67/13467/1
Matthias Sohn [Sat, 1 Jun 2013 23:56:20 +0000 (01:56 +0200)]
Include o.e.j.archive into o.e.jgit feature

Also the pgm feature should depend on the jgit feature to ensure that
all needed bundles are available.

Change-Id: I670e8262cdace4323d3883717efe4b5e5e06f4c7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUpdate build to use Tycho 0.18 66/13466/2
Matthias Sohn [Sat, 1 Jun 2013 22:26:59 +0000 (00:26 +0200)]
Update build to use Tycho 0.18

Change-Id: I66ffb2b6416dbbd5da11ad789dd58060b7ab09f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd jgit target platform to define dependencies more precisely 65/13465/4
Matthias Sohn [Fri, 31 May 2013 22:36:17 +0000 (00:36 +0200)]
Add jgit target platform to define dependencies more precisely

Avoid that the packaging build picks an older jgit version coming with
eclipse platform by using a target platform which allows to define the
dependencies more precisely.

Change-Id: I39bba3baa4517e2b5e5fe0de096e756f2904e3e9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix javadoc of FormatActivator 64/13464/3
Matthias Sohn [Sat, 1 Jun 2013 21:54:24 +0000 (23:54 +0200)]
Fix javadoc of FormatActivator

Change-Id: I64b32f71df2964da4cb2de73b34bf7e455ab5b93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix version of dependency to package org.osgi.framework 63/13463/1
Matthias Sohn [Sat, 1 Jun 2013 21:39:52 +0000 (23:39 +0200)]
Fix version of dependency to package org.osgi.framework

OSGi 4.01 comes with package org.osgi.framework version 1.3 [1] which
has the BundleActivator interface needed by org.eclipse.jgit.archive.
OSGi 5.0 matches package org.osgi.framework version 1.7 [2].

[1] http://www.osgi.org/javadoc/r4v401/
[2] http://www.osgi.org/javadoc/r5/core/

Change-Id: I10f78e5eb02b5d03395f23d2f0ad039caf565269
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd missing javadoc for archive code 54/13354/2
Jonathan Nieder [Wed, 29 May 2013 17:42:35 +0000 (10:42 -0700)]
Add missing javadoc for archive code

Document archive formats, the archive format interface, and the
parameters of the GitAPIException constructors.  Noticed by eclipse.

Reported-by: Dani Megert <Daniel_Megert@ch.ibm.com>
Change-Id: I22b5f9d4c0358bbe867c1906feec7c279e214273

11 years agoRemove unused import in Archive 53/13353/2
Jonathan Nieder [Wed, 29 May 2013 17:47:56 +0000 (10:47 -0700)]
Remove unused import in Archive

Change-Id: I0bc82e74f4acedb059322c29e13352151165ef7f

11 years agoDrop unnecessary "throws" clauses in archive code 52/13352/2
Jonathan Nieder [Wed, 29 May 2013 17:45:41 +0000 (10:45 -0700)]
Drop unnecessary "throws" clauses in archive code

Noticed by eclipse.

Change-Id: I730b290556066038efeaf2436de95415b175f351

11 years agoMove FormatActivator.start()/stop() to a separate class 69/13369/1
Jonathan Nieder [Wed, 29 May 2013 19:33:44 +0000 (12:33 -0700)]
Move FormatActivator.start()/stop() to a separate class

This makes the functionality of registering all formats from the
org.eclipse.jgit.archive package available in contexts where
FormatActivator cannot be built because the OSGi core framework is not
readily available to build against.

Change-Id: If8e3487e933783a7e12f8e1838cbfe0b5862ce80

11 years agoMerge branch 'stable-3.0' 33/13333/1
Matthias Sohn [Wed, 29 May 2013 10:27:50 +0000 (12:27 +0200)]
Merge branch 'stable-3.0'

* stable-3.0:
  Prepare post 3.0.0-rc2 builds
  JGit v3.0.0.201305281830-rc2
  Support refspecs with wildcard in middle (not only at end)
  Fix multiple bugs in RawSubStringPattern used by MessageRevFilter
  Handle short branch/tag name for setBranch in CloneCommand
  Add missing Bundle-Localization header
  Apply tree filter marks when pairing DiffEntry for renames
  Improve feature names to become understandable by end users
  Update kepler orbit version to R20130517111416
  Fix BatchRefUpdate progress-monitoring so it doesn't count twice
  Fix AnyObjectId's generic type declaration of Comparable
  Fix DiffFormatter NPEs for DiffEntry without content change
  Fix CommitCommand not to destroy repo
  Fix the parameters to an exception
  Prepare post 3.0.0 M7 builds
  JGit v3.0.0.201305080800-m7

Change-Id: Ia8441c9796f01497e0d90e672c0aaf60520a0098
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoPrepare post 3.0.0-rc2 builds 20/13320/1
Matthias Sohn [Wed, 29 May 2013 08:36:51 +0000 (10:36 +0200)]
Prepare post 3.0.0-rc2 builds

Change-Id: Ic46832bcde80d0bf74c16cb094abd76b00552d14
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd tgz and txz archive formats 95/13295/5
Jonathan Nieder [Tue, 28 May 2013 23:51:39 +0000 (16:51 -0700)]
Add tgz and txz archive formats

Change-Id: I347e8a9a112d142ccef91cba1d6e997d645ca70a

11 years agoMaintain list of archive formats in one place 07/13307/3
Jonathan Nieder [Tue, 28 May 2013 23:51:32 +0000 (16:51 -0700)]
Maintain list of archive formats in one place

Add a static start() method to FormatActivator to allow outside
classes such as the Archive subcommand of the jgit program to use it
without a BundleContext.  This way, the list of formats only has to be
maintained in one place.

While at it, build a list of registered formats at start() time, so
stop() doesn't have to repeat the same list of formats.

Suggested-by: Shawn Pearce <spearce@spearce.org>
Change-Id: I55cb3095043568740880cc9e4f7cde05f49c363c

11 years agoJGit v3.0.0.201305281830-rc2 04/13304/1 v3.0.0.201305281830-rc2
Matthias Sohn [Tue, 28 May 2013 22:49:12 +0000 (00:49 +0200)]
JGit v3.0.0.201305281830-rc2

Change-Id: I490ad8cc7590f70783d3fbd6dd6f0e0446ae5afe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoSupport refspecs with wildcard in middle (not only at end) 81/12681/4
Robin Stocker [Sat, 4 May 2013 14:43:51 +0000 (16:43 +0200)]
Support refspecs with wildcard in middle (not only at end)

The following refspec, which can be used to fetch GitHub pull requests,
is supported by C Git but was not yet by JGit:

  +refs/pull/*/head:refs/remotes/origin/pr/*

The reason is that the wildcard in the source is in the middle.

This change also includes more validation (e.g. "refs//heads" is not
valid) and test cases.

Bug: 405099
Change-Id: I9bcef7785a0762ed0a98ca95a0bdf8879d5702aa

11 years agoFix multiple bugs in RawSubStringPattern used by MessageRevFilter 42/13242/2
Robin Stocker [Mon, 27 May 2013 18:56:31 +0000 (20:56 +0200)]
Fix multiple bugs in RawSubStringPattern used by MessageRevFilter

* Match at end of input was not handled correctly.
* When more than one character matched but not all, the next character
  was not considered as a match start (e.g. pattern "abab" didn't match
  input "abaabab").

Bug: 409144
Change-Id: Ia44682c618bfbb927f5567c194227421d222a160
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoHandle short branch/tag name for setBranch in CloneCommand 53/13153/2
Robin Stocker [Sat, 25 May 2013 13:56:50 +0000 (15:56 +0200)]
Handle short branch/tag name for setBranch in CloneCommand

Before, it was not clear from the documentation what kind of branch name
was accepted. Users specifying "branch" (instead of "refs/heads/branch")
got no error message and ended up with a repository without HEAD and no
checkout.

With this, CloneCommand now tries "$branch", then "refs/heads/$branch"
and then "refs/tags/$branch". C Git only does the last two, but for
compatibility we should still allow "refs/heads/branch".

Bug: 390994
Change-Id: I4be13144f2a21a6583e0942f0c7c40da32f2247a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd missing Bundle-Localization header 55/13155/1
Matthias Sohn [Sat, 25 May 2013 22:52:57 +0000 (00:52 +0200)]
Add missing Bundle-Localization header

Change-Id: I6831ad417f069127b4705fdd909844ec72065527
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoRelease ArchiveCommand's ObjectReader in call() 48/13148/1
Jonathan Nieder [Sat, 25 May 2013 01:24:53 +0000 (18:24 -0700)]
Release ArchiveCommand's ObjectReader in call()

Make call() release all private resources so instead of using a
pattern like

ArchiveCommand cmd = git.archive();
try {
cmd.setTree(tree)
. ...
.call();
} finally {
cmd.release();
}

callers can just use git.archive().setTree(tree)....call() directly.

This involves pushing more work out of parameter setters and into
call() so the ObjectReader is not allocated and potentially leaked
before then.

Change-Id: I699f703c6302696e1cc276d7ab8ee597d82f2c5d

11 years agoMove ArchiveCommand into standard porcelain API 62/12262/10
Jonathan Nieder [Sat, 25 May 2013 00:30:18 +0000 (17:30 -0700)]
Move ArchiveCommand into standard porcelain API

Allow use of ArchiveCommand without depending on the jgit command-line
tools.

To avoid complicating the process of installing and upgrading JGit,
this does not add a dependency by the org.eclipse.jgit bundle on
commons-compress.  Instead, the caller is responsible for registering
any formats they want to use by calling ArchiveCommand.registerFormat.

This patch puts functionality that requires an archiver into a
separate org.eclipse.jgit.archive bundle for people who want it.  One
can use it by calling ArchiveCommand.registerFormat directly to
register its formats or by relying on OSGi class loading to load
org.eclipse.jgit.archive.FormatActivator, which takes care of
registration automatically.

Once the appropriate formats are registered, you can make a tar or zip
from a git tree object as follows:

ArchiveCommand cmd = git.archive();
try {
cmd.setTree(tree).setFormat(fmt).setOutputStream(out).call();
} finally {
cmd.release();
}

Change-Id: I418e7e7d76422dc6f010d0b3b624d7bec3b20c6e

11 years agoRemove dependency by ArchiveCommand on archive formats 63/12563/4
Jonathan Nieder [Fri, 24 May 2013 23:57:10 +0000 (16:57 -0700)]
Remove dependency by ArchiveCommand on archive formats

Provide static registerFormat and unregisterFormat methods to allow
formats to register themselves without the ArchiveCommand code being
aware of them.

Register the basic "zip" and "tar" support at bundle activation time
(and deregister them when unloading the bundle).  For anyone using
this code as an OSGi plugin it should continue to just work.

The jgit program does not load org.eclipse.jgit.pgm as an OSGi bundle,
so let the Archive command register the formats it uses explicitly
with registerFormat.

Change-Id: Id39c03ea6923d0aed8316ed7b6bd04d5ced570a7

11 years agoApply tree filter marks when pairing DiffEntry for renames 69/12969/2
Robin Stocker [Sun, 19 May 2013 13:19:35 +0000 (15:19 +0200)]
Apply tree filter marks when pairing DiffEntry for renames

When using a RenameDetector to generate new DiffEntries after using
DiffEntry.scan, the treeFilterMarks of the original entries were lost.
Now it combines the marks from src and dst.

See EGit bug 335082 where this is used.

Change-Id: I72b34b10ca12e3a6bd10ce44f4fa05b193fc52cc

11 years agoDrop dependency by ArchiveCommand.Format interface on commons-compress 62/12562/4
Jonathan Nieder [Thu, 23 May 2013 23:53:57 +0000 (16:53 -0700)]
Drop dependency by ArchiveCommand.Format interface on commons-compress

Otherwise, anyone trying to implement a new format would have to
depend on commons-compress, even if using a different underlying
library to write the archive.

Change-Id: I301a1997e3b48aa7e32d693fd8f4b2d436c9b3a7

11 years agoArchiveCommand.Format: pass output stream as first argument to putEntry 00/13100/2
Jonathan Nieder [Thu, 23 May 2013 23:46:29 +0000 (16:46 -0700)]
ArchiveCommand.Format: pass output stream as first argument to putEntry

This is more consistent with other APIs where the output side is the
first parameter to be analagous to the left-hand side of an
assignment.

Change-Id: Iec46bd50bc973a38b77d8367296adf5474ba515f

11 years agoArchiveCommand: make archive formats non-inner classes 61/12561/7
Jonathan Nieder [Fri, 24 May 2013 01:08:35 +0000 (18:08 -0700)]
ArchiveCommand: make archive formats non-inner classes

First step toward making ArchiveCommand itself format-agnostic.

Change-Id: I3cff5fce28fa7a19e34f8291cfb5b62f16429713

11 years agoRemove unused import in UploadPack 93/13093/1
Shawn Pearce [Thu, 23 May 2013 20:10:03 +0000 (13:10 -0700)]
Remove unused import in UploadPack

Change-Id: I9304cb3a6502ceb0cba21eb841e466f932ab3c01

11 years agoUse NullOutputStream not DisabledOutputStream in UploadPack 91/13091/1
Shawn Pearce [Thu, 23 May 2013 20:07:03 +0000 (13:07 -0700)]
Use NullOutputStream not DisabledOutputStream in UploadPack

The stream should not throw IllegalStateException if it is off.
Flush the stream after the hook runs, in case any messages need
to be sent ahead of the pack.

Change-Id: I21c7a0258ab1308406d226293fa0e7da69b4f57b

11 years agoAllow PreUploadHook.onSendPack to send messages to the client 60/13060/1
Shawn Pearce [Wed, 22 May 2013 19:12:52 +0000 (12:12 -0700)]
Allow PreUploadHook.onSendPack to send messages to the client

Before transmitting to the client a hook may want to send along
a text message ahead of the pack, such as a "message of the day".
Enable this usage by mirroring the message sending API from
ReceivePack on the UploadPack instance, using the side band.

Change-Id: I31cd254a4ddb816641397a3e9c2c20212471c37f

11 years agoImprove feature names to become understandable by end users 17/13017/2
Matthias Sohn [Tue, 21 May 2013 12:54:39 +0000 (14:54 +0200)]
Improve feature names to become understandable by end users

This was requested in [1].

[1] http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg08981.html

Change-Id: I9764961a651c1fa64042098d60da9b496453f703
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUpdate kepler orbit version to R20130517111416 74/12974/1
Matthias Sohn [Sun, 19 May 2013 23:28:16 +0000 (01:28 +0200)]
Update kepler orbit version to R20130517111416

Change-Id: I635aaa28230d571f4b6bf65485edaba1b1561fc2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix BatchRefUpdate progress-monitoring so it doesn't count twice 53/12953/5
Roberto Tyley [Sat, 18 May 2013 21:52:55 +0000 (22:52 +0100)]
Fix BatchRefUpdate progress-monitoring so it doesn't count twice

I was seeing output like this while running The BFG:

Updating references:    200% (374/187)

...issue sneaked in with 5cf53fda I think.

The update call is also moved to the end of the loop, as update() is
only supposed to be called after work has been done ("Denote that some
work units have been completed").

Change-Id: I1620fa75be16dc80df44745d0e123ea512762e31
Signed-off-by: Robin Stocker <robin@nibor.org>
11 years agoMerge "Fix DiffFormatter NPEs for DiffEntry without content change" into stable-3.0
Matthias Sohn [Thu, 16 May 2013 22:41:52 +0000 (18:41 -0400)]
Merge "Fix DiffFormatter NPEs for DiffEntry without content change" into stable-3.0

11 years agoFix AnyObjectId's generic type declaration of Comparable 85/12885/1
Roberto Tyley [Thu, 16 May 2013 14:44:41 +0000 (15:44 +0100)]
Fix AnyObjectId's generic type declaration of Comparable

If you look at any implementation of Comparable in the JDK, you'll see
that the type parameter for Comparable is supposed to be the type of
the implementing class:

http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html

The current type signature of Comparable<Object> is pretty awful, at the
very least because you can not, in fact, successfully compare
AnyObjectId with any random subclass of Object. It also causes problems
with type-inference and the scala.math.Ordering trait in Scala.

In order to compile, this change *does* require removing the
AnyObjectId.ompareTo(Object) method - which actually only ever cast
to AnyObjectId in any case. Nothing in the JGit test suite requires this
method, but it might constitute a breaking API change, so it would be
best if it can be added in time for JGit 3.0.

Change-Id: I3b549a5519ccd6785f98e444da76d2363bcbe41a

11 years agoFix DiffFormatter NPEs for DiffEntry without content change 12/12712/3
Robin Stocker [Fri, 10 May 2013 16:16:36 +0000 (18:16 +0200)]
Fix DiffFormatter NPEs for DiffEntry without content change

DiffEntry.getOldId() returns null for a diff without an index line (e.g.
only mode changed, rename without content change).

Bug: 407743
Change-Id: I42eac87421f2a53c985af260a253338f578492bc

11 years agoRemove unused import in LocalDiskRepositoryTestCase 71/12771/1
Tomasz Zarna [Tue, 14 May 2013 05:16:32 +0000 (22:16 -0700)]
Remove unused import in LocalDiskRepositoryTestCase

Change-Id: Ib8a8e72dd3c808c4fe92c32ed177272dce29ac60

11 years agoFix CommitCommand not to destroy repo 01/12701/5
Christian Halstrick [Thu, 9 May 2013 22:10:27 +0000 (00:10 +0200)]
Fix CommitCommand not to destroy repo

There was a severe bug in CommitCommand which could corrupt
repos. When merging an annotated tag the JGit MergeCommand writes
correctly the ID of the tag (and not the id of the commit the tag was
pointing to) into MERGE_HEAD. Native git does the same. But
CommitCommand was reading this file and trusting blindly that it will
contain only IDs of commits. Then the CommitCommand created a
commit which has as parent a non-commit object (the tag object). That's
so corrupt that even native git gives up when you call "git log" in
such a repo.

To reproduce that with EGit simply right-click on a tag in the
Repository View and select Merge. The result was a corrupt repo!

Bug: 336291
Change-Id: I24cd5de19ce6ca7b68b4052c9e73dcc6d207b57c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix the parameters to an exception 72/12672/2
Robin Rosenberg [Wed, 8 May 2013 21:52:52 +0000 (23:52 +0200)]
Fix the parameters to an exception

A parenthesis was in the wrong place passing arguments to the wrong
format call. Also fix formatting of enclosing switch statement.

Change-Id: I4cb9642f08b58c39033c3a81dab4bd56bebf4fd2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix hardcoded use of target/trash in LocalDiskRepositoryTestCase 68/12668/3
Shawn Pearce [Thu, 9 May 2013 00:34:47 +0000 (17:34 -0700)]
Fix hardcoded use of target/trash in LocalDiskRepositoryTestCase

`pwd`/target is only valid in Maven Reactor builds where Maven
has moved into the project directory and created a target for
the build output. Most other build systems do not use "target"
and may not even perform a directory change between test suites.

Rewrite LocalDiskRepositoryTestCase's temporary directory code
to use the system specified location and create new unique names.
This prevents fixes between concurrently running tests and allows
the caller to specify the root using java.io.tmpdir.

Update the surefire command lines to use target within each project as
the system temporary directory during unit testing, preventing JGit's
own test suite from writing to /tmp or somewhere like C:\tmp.

Change-Id: I9e8431f6ddfc16fee89f677bcce67c99cfb56782

11 years agoPrepare post 3.0.0 M7 builds 54/12654/1
Matthias Sohn [Wed, 8 May 2013 20:26:04 +0000 (22:26 +0200)]
Prepare post 3.0.0 M7 builds

Change-Id: I062c44529c7ae2f960d3c64a0923a45d2dc8a863
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoJGit v3.0.0.201305080800-m7 19/12619/1 v3.0.0.201305080800-m7
Matthias Sohn [Wed, 8 May 2013 11:58:26 +0000 (13:58 +0200)]
JGit v3.0.0.201305080800-m7

Change-Id: I377b174993862918a117f54e6cba4733dfc2307c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd missing @since tags 08/12408/3
Matthias Sohn [Tue, 30 Apr 2013 21:55:36 +0000 (23:55 +0200)]
Add missing @since tags

Change-Id: I9657125765716c874bb6ecf8844c34749cb3b069
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMove org.eclipse.jgit.pgm's resource bundle to internal package 53/12553/2
Matthias Sohn [Mon, 6 May 2013 20:59:57 +0000 (22:59 +0200)]
Move org.eclipse.jgit.pgm's resource bundle to internal package

Translatable texts aren't API and shouldn't require maintenance of
@since tags to prevent API warnings.

Change-Id: I228ff37f17c0e792a6bc188c463a0d19138e88ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "URIish: Allow multiple slashes in paths"
Shawn Pearce [Sun, 5 May 2013 16:51:44 +0000 (12:51 -0400)]
Merge "URIish: Allow multiple slashes in paths"

11 years agoRemove unused repository field from RevWalk 00/12500/3
Dave Borowitz [Fri, 3 May 2013 18:22:25 +0000 (11:22 -0700)]
Remove unused repository field from RevWalk

The comment about legacy Tag and Object types no longer applies,
though prior to Idb273d5a92849b42935ac14eed73b796b80aad50 the field
was still being used by RewriteTreeFilter.

Change-Id: I9ee5da8f8a3b61c9cf543817c03117ee0609dd8f

11 years agoMerge "Require a DiffConfig when creating a FollowFilter"
Shawn Pearce [Sun, 5 May 2013 15:47:53 +0000 (11:47 -0400)]
Merge "Require a DiffConfig when creating a FollowFilter"

11 years agoRequire a DiffConfig when creating a FollowFilter 99/12499/3
Dave Borowitz [Fri, 3 May 2013 18:18:53 +0000 (11:18 -0700)]
Require a DiffConfig when creating a FollowFilter

The various rename detection options are an inherent part of the
filter, similar to the path being followed.

This fixes a potential NPE when a RevWalk with a FollowFilter is
created without a Repository, since the old code path tried to get
the DiffConfig from the RevWalk's possibly-missing repository.

Change-Id: Idb273d5a92849b42935ac14eed73b796b80aad50

11 years agoAdd optional feature to install Java 7 support 38/12438/3
Matthias Sohn [Mon, 11 Mar 2013 23:40:34 +0000 (00:40 +0100)]
Add optional feature to install Java 7 support

Change-Id: I15cfd91857830d69abbe729be3e237fc9cd4fca0
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoExtend the FS class for Java7 78/9378/25
Robin Rosenberg [Mon, 4 Feb 2013 00:10:26 +0000 (01:10 +0100)]
Extend the FS class for Java7

The most important difference is that in Java7 we have symbolic links
and for most operations in the work tree we want to operate on the link
itself rather than the link target, which the old File methods generally
do.

We also add support for the hidden attribute, which only makes sense
on Windows and exists, just since there are claims that Files.exists
is faster the File.exists.

A new bundle is only activated when run with a Java7 execution
environment. It is implemented as a fragment.

Tycho currently has no way to conditionally include optional features
based on the java version used to run the build, this means with this
change the jgit packaging build always needs to be run using java 7.

Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix line endings 88/12488/1
Matthias Sohn [Fri, 3 May 2013 14:19:07 +0000 (16:19 +0200)]
Fix line endings

Change-Id: I61c9c173237a535da8576a9299bfd4bb29e8f56b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoTagCommand should be able to create unannotated tags too 70/12470/2
Robin Rosenberg [Thu, 2 May 2013 21:07:04 +0000 (23:07 +0200)]
TagCommand should be able to create unannotated tags too

Using the low level API's is just too cumbersome.

Change-Id: Id5b9f560ee095d6db0b2ea5b26aef3e53021626e
Signed-off-by: Robin Stocker <robin@nibor.org>
11 years agoAdd test for RefUpdate delete without HEAD 69/12269/2
Robin Stocker [Sat, 27 Apr 2013 11:30:11 +0000 (13:30 +0200)]
Add test for RefUpdate delete without HEAD

Bug: 406722
Change-Id: I555fb366ee64d885de2a71a67cf00833f4c62561

11 years agoMerge "Fix warnings about assigning paramter in util.io"
Robin Rosenberg [Thu, 2 May 2013 21:19:38 +0000 (17:19 -0400)]
Merge "Fix warnings about assigning paramter in util.io"

11 years agoFix warnings about assigning paramter in util.io 14/12414/1
Robin Stocker [Wed, 1 May 2013 14:48:14 +0000 (16:48 +0200)]
Fix warnings about assigning paramter in util.io

Change-Id: I08bed4275af9ec52aa4d7054067ac82f6a3c9781

11 years agoUpdate tags on fetch if --tags or tag refspec specified 80/12280/2
Robin Stocker [Sat, 27 Apr 2013 14:46:29 +0000 (16:46 +0200)]
Update tags on fetch if --tags or tag refspec specified

When either --tags or a tag ref is explicitly specified on fetch, C Git
updates existing local tags if they are different.

Before this change, JGit returned REJECTED in such a case. Now it
updates it and returns FORCED.

Example:

    % mkdir a
    % cd a
    % git init -q
    % touch test.txt
    % git add test.txt
    % git commit -q -m 'Initial'
    % git tag v1
    % cd ..
    % git clone -q a b
    % cd a
    % echo Test > test.txt
    % git commit -q -a -m 'Second'
    % git tag -f v1
    Updated tag 'v1' (was bc85c08)
    % cd ../b
    % git fetch --tags
     - [tag update]      v1         -> v1

Bug: 388095
Change-Id: I5d5494c2ad1a2cdb8e9e614d3de445289734edfe

11 years agoOnly fetch tags that do not exist locally with auto-follow 79/12279/2
Robin Stocker [Sat, 27 Apr 2013 14:14:46 +0000 (16:14 +0200)]
Only fetch tags that do not exist locally with auto-follow

This corresponds to what C Git does, quoting from the fetch man page:

  This is done by first fetching from the remote using the given
  <refspec>s, and if the repository has objects that are pointed by
  remote tags that it does not yet have, then fetch those missing tags.

Before, JGit would also fetch tags that exist locally but point to a
different object, resulting in REJECTED results for these.

Also add some test cases to cover more cases.

Bug: 388095
Change-Id: Ib03d2d82e9c4b60179d626cfd5174be1da6388b2
Also-by: Stefan Lay <stefan.lay@sap.com>
11 years agoArchiveCommand: Add missing @since tag 09/12409/1
Jonathan Nieder [Tue, 30 Apr 2013 22:03:08 +0000 (15:03 -0700)]
ArchiveCommand: Add missing @since tag

Change-Id: I9e48a1f82b747492bebb3ca65fd16f599e425e8b

11 years agoAbort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVE 50/11850/4
Robin Stocker [Fri, 12 Apr 2013 12:21:02 +0000 (14:21 +0200)]
Abort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVE

Depending on the order in which items are traversed for RECURSIVE, an
empty directory may come first before detecting that there is a file and
aborting.

This fixes it by traversing files first.

Bug: 405558
Change-Id: I638b7da58e33ffeb0fee172b96f4c823943d29e9
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "Cleanup imports and javadocs in ArchiveCommand"
Robin Rosenberg [Sat, 27 Apr 2013 20:38:16 +0000 (16:38 -0400)]
Merge "Cleanup imports and javadocs in ArchiveCommand"

11 years agoCleanup imports and javadocs in ArchiveCommand 75/12275/2
Robin Rosenberg [Sat, 27 Apr 2013 13:08:31 +0000 (15:08 +0200)]
Cleanup imports and javadocs in ArchiveCommand

Change-Id: Icb1cd177e791cc646636a88c67fd9399dfc7030c

11 years agoDelete CLIText strings previously used in iplog generator 25/12225/2
Jonathan Nieder [Thu, 25 Apr 2013 22:27:47 +0000 (15:27 -0700)]
Delete CLIText strings previously used in iplog generator

The only callers using these strings were removed in commit
850e5bc24e31 (Delete the iplog generator, 2013-01-09).

Change-Id: Ia4f81b29b8d00782ee559d69de3befc0a6c4d403

11 years agoMerge "Make the Reflog a public API again"
Robin Rosenberg [Sat, 27 Apr 2013 12:56:37 +0000 (08:56 -0400)]
Merge "Make the Reflog a public API again"

11 years agoMerge "Remove unused logger from RecursiveMerger"
Robin Rosenberg [Sat, 27 Apr 2013 12:55:32 +0000 (08:55 -0400)]
Merge "Remove unused logger from RecursiveMerger"

11 years agoURIish: Allow multiple slashes in paths 73/12273/1
Robin Stocker [Sat, 27 Apr 2013 12:35:12 +0000 (14:35 +0200)]
URIish: Allow multiple slashes in paths

It's also allowed by C Git.

Change-Id: Ie0a0d1f57d84e70fd5ef50b7844d22fea43d0e08

11 years agoRefer to getEntryPathLength in docs of getEntryPathBuffer 72/12272/1
Robin Stocker [Sat, 27 Apr 2013 12:18:59 +0000 (14:18 +0200)]
Refer to getEntryPathLength in docs of getEntryPathBuffer

Change-Id: Icca41d80bd0791cd2d4bf03297795d161afbee70

11 years agoAllow deletions to occur when there is no HEAD 68/12268/1
Alex Blewitt [Sat, 27 Apr 2013 10:34:57 +0000 (11:34 +0100)]
Allow deletions to occur when there is no HEAD

If the HEAD is not present in a repository, then there is a
NullPointerException thrown in the delete code. Since this only
exists to verify if the deletion is not the HEAD reference, then
skip this check if the HEAD cannot be found.

Bug: 406722
Change-Id: I882497202d986096513a4d791cd07fa935a3f9e4
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
11 years agoArchiveCommand: Do not warn for unsupported file mode 52/12252/5
Jonathan Nieder [Fri, 26 Apr 2013 20:47:56 +0000 (13:47 -0700)]
ArchiveCommand: Do not warn for unsupported file mode

When ArchiveCommand is invoked directly on the command line, these
warnings to stderr

warning: mode of path/to/some/submodule ignored

are a useful hint, but in the more usual case where an archive is
being served by a server, the intended audience for that message
cannot see stderr.

Later it might be useful to accept a callback to return these warnings
out of band.

Change-Id: I22e79be69859176d85594031d67c6cb3371c4bd2

11 years agoAdd internal porcelain-style API for ArchiveCommand 56/11556/10
Jonathan Nieder [Fri, 26 Apr 2013 20:43:23 +0000 (13:43 -0700)]
Add internal porcelain-style API for ArchiveCommand

One step closer to exposing archive creation functionality in a
org.eclipse.jgit.archive bundle.

Change-Id: If0ebb2417a941d9d3fc0d3f444316d0d1c494ff3

11 years agoMerge "archive: Release resources before returning"
Shawn Pearce [Fri, 26 Apr 2013 20:06:25 +0000 (16:06 -0400)]
Merge "archive: Release resources before returning"

11 years agoarchive: Release resources before returning 23/12223/2
Jonathan Nieder [Thu, 25 Apr 2013 21:20:54 +0000 (14:20 -0700)]
archive: Release resources before returning

The only caller exits immediately after calling execute() so this
shouldn't make a difference, but it's good practice and should make it
easier to expose the functionality in a public API later.

Change-Id: Ia6cd2ce8382f1a62e576409107fc5c9a6b321fb6

11 years agoRemove unused logger from RecursiveMerger 43/12243/1
Jonathan Nieder [Fri, 26 Apr 2013 17:16:09 +0000 (10:16 -0700)]
Remove unused logger from RecursiveMerger

JGit doesn't currently use java.util.logging.Logger.  Remove this
never-used Logger introduced in ab99b78ca08a (Implement recursive
merge strategy, 2013-02-21) to make that easier to see.

Change-Id: I92c578e7f3617085a667de7c992174057be3eb71

11 years agoMake the Reflog a public API again 54/11954/4
Robin Rosenberg [Tue, 16 Apr 2013 22:31:11 +0000 (00:31 +0200)]
Make the Reflog a public API again

Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d

11 years agoMerge "status: Print conflict description for unmerged paths"
Robin Rosenberg [Thu, 25 Apr 2013 21:45:35 +0000 (17:45 -0400)]
Merge "status: Print conflict description for unmerged paths"

11 years agoDocument RevTag#getObject() that returned object is unparsed 01/12101/1
Robin Stocker [Mon, 22 Apr 2013 16:22:18 +0000 (18:22 +0200)]
Document RevTag#getObject() that returned object is unparsed

Change-Id: I238d388e40362721eecf37f64ad7d48a399ff129

11 years agoImprove class documentation of TagCommand 97/12097/1
Robin Stocker [Mon, 22 Apr 2013 13:35:10 +0000 (15:35 +0200)]
Improve class documentation of TagCommand

Change-Id: I9c636b927fa2d7cfbe1eb5535a9e702b2209f51d

11 years agoRevert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY" 76/12076/1
Shawn Pearce [Fri, 19 Apr 2013 19:01:58 +0000 (12:01 -0700)]
Revert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"

This reverts commit 7aa54967a26cb027fe390ad1c624ebb30f9ac6d5.
The unit test dependend upon the specific order of names that
listFiles() returned members in. The order is completely undefined
and may differ even on different versions of Linux based systems.

A proper unit test for this code would have considered both cases,
where the deletion function was able to remove an empty subdirectory,
or fail to remove a subdirectory because a file was still present
within. This is not such a test.

Change-Id: Ib0a706fea01e4b1ed8c8e859247d247a1279b4bc

11 years agostatus: Print conflict description for unmerged paths 72/12072/1
Robin Stocker [Fri, 19 Apr 2013 17:44:24 +0000 (19:44 +0200)]
status: Print conflict description for unmerged paths

Prefix unmerged paths with conflict description (e.g. "both modified:"),
the same way C Git does.

Change-Id: I083cd191ae2ad3e2460aa4052774aed6e36c2699

11 years agoCreate constants in ConfigConstants for the "diff" section 31/11731/2
Robin Rosenberg [Sun, 7 Apr 2013 23:13:41 +0000 (01:13 +0200)]
Create constants in ConfigConstants for the "diff" section

Change-Id: I5cf5fe60374d1e94eb031488e4f92c8e521f41a6
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoFix examples with refs/heads/ in RefSpec Javadoc 06/12006/2
Robin Stocker [Thu, 18 Apr 2013 08:55:23 +0000 (10:55 +0200)]
Fix examples with refs/heads/ in RefSpec Javadoc

Change-Id: I06c1c7242a1b4c8f499c27a598cca714803799b7
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoIndexDiff: Provide stage state for conflicting entries 54/11354/3
Robin Stocker [Thu, 21 Mar 2013 00:39:04 +0000 (01:39 +0100)]
IndexDiff: Provide stage state for conflicting entries

Adds a new method getConflictingStageStates() which returns a
Map<String, StageState> (path to stage state). StageState is an enum for
all possible stage combinations (BOTH_DELETED, ADDED_BY_US, ...).

This can be used to implement the conflict text for unmerged paths in
output of "git status" or in EGit for decorations/hints.

Bug: 403697
Change-Id: Ib461640a43111b7df4a0debe92ff69b82171329c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge "A deleted work tree file is not a conflict when merge wants to delete it"
Robin Rosenberg [Fri, 19 Apr 2013 11:39:39 +0000 (07:39 -0400)]
Merge "A deleted work tree file is not a conflict when merge wants to delete it"

11 years agoMerge "Untracked files should not be included in stash"
Robin Rosenberg [Fri, 19 Apr 2013 11:36:29 +0000 (07:36 -0400)]
Merge "Untracked files should not be included in stash"

11 years agoDo not export package org.eclipse.jgit from jgit tests 39/12039/2
Matthias Sohn [Thu, 18 Apr 2013 20:35:37 +0000 (22:35 +0200)]
Do not export package org.eclipse.jgit from jgit tests

Commit 3344b93c erroneously exported the package org.eclipse.jgit.lib
from the org.eclipse.jgit.test bundle which made this a split package
since the bundle org.eclipse.jgit exports the same package.

Split packages are evil in general and most probably caused the build
cycle errors observed recently when importing the jgit projects in
Eclipse [1].

[1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02012.html

Change-Id: I89919e56b928acdbff0b90e3919808025a8562c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUntracked files should not be included in stash 40/12040/1
Robin Rosenberg [Thu, 18 Apr 2013 21:19:15 +0000 (23:19 +0200)]
Untracked files should not be included in stash

The previous code stashed untracked files and left them
in the work tree.

Bug: 403282
Change-Id: I71727addb2b55fb8e409cae2b6af8138b1ff7ef1

11 years agoRemove some unnecessary dependencies on FileRepostory 25/11925/2
Robin Rosenberg [Mon, 15 Apr 2013 22:05:41 +0000 (00:05 +0200)]
Remove some unnecessary dependencies on FileRepostory

Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge "Remove unused dependencies"
Robin Rosenberg [Thu, 18 Apr 2013 20:29:35 +0000 (16:29 -0400)]
Merge "Remove unused dependencies"

11 years agoImprove test coverage of AutoCRLF(In|Out)putStream 36/12036/2
Robin Stocker [Thu, 18 Apr 2013 19:55:35 +0000 (21:55 +0200)]
Improve test coverage of AutoCRLF(In|Out)putStream

Bug: 405672
Change-Id: I3894e98617fcee16dc2ac9853c203c62eb30c3ab
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge changes Id2848c16,I7621c434
Shawn Pearce [Wed, 17 Apr 2013 18:53:13 +0000 (14:53 -0400)]
Merge changes Id2848c16,I7621c434

* changes:
  Rescale "Compressing objects" progress meter by size
  Split delta search buckets by byte weight

11 years agoRescale "Compressing objects" progress meter by size 53/11953/2
Shawn Pearce [Tue, 16 Apr 2013 16:25:29 +0000 (09:25 -0700)]
Rescale "Compressing objects" progress meter by size

Instead of counting objects processed, count number of bytes added
into the window. This should rescale the progress meter so that 30%
complete means 30% of the total uncompressed content size has been
inflated and fed into the window.

In theory the progress meter should be more accurate about its
percentage complete/remaining fraction than with objects. When
counting objects small objects move the progress meter more rapidly
than large objects, but demand a smaller amount of work than large
objects being compressed.

Change-Id: Id2848c16a2148b5ca51e0ca1e29c5be97eefeb48

11 years agoSplit delta search buckets by byte weight 76/11876/6
Shawn Pearce [Tue, 16 Apr 2013 15:19:13 +0000 (08:19 -0700)]
Split delta search buckets by byte weight

Instead of assuming all objects cost the same amount of time to
delta compress, aggregate the byte size of objects in the list
and partition threads with roughly equal total bytes.

Before splitting the list select the N largest paths and assign
each one to its own thread. This allows threads to get through the
worst cases in parallel before attempting smaller paths that are
more likely to be splittable.

By running the largest path buckets first on each thread the likely
slowest part of compression is done early, while progress is still
reporting a low percentage. This gives users a better impression of
how fast the phase will run. On very complex inputs the slow part
is more likely to happen first, making a user realize its time to
go grab lunch, or even run it overnight.

If the worst sections are earlier, memory overruns may show up
earlier, giving the user a chance to correct the configuration and
try again before wasting large amounts of time. It also makes it
less likely the delta compression phase reaches 92% in 30 minutes
and then crawls for 10 hours through the remaining 8%.

Change-Id: I7621c4349b99e40098825c4966b8411079992e5f

11 years agoMerge "Support excluding objects during DFS compaction"
Shawn Pearce [Wed, 17 Apr 2013 18:19:21 +0000 (14:19 -0400)]
Merge "Support excluding objects during DFS compaction"

11 years agoSupport excluding objects during DFS compaction 62/11962/1
Shawn Pearce [Wed, 17 Apr 2013 00:54:23 +0000 (17:54 -0700)]
Support excluding objects during DFS compaction

By excluding objects the compactor can avoid storing objects that
are already well packed in the base GC packs, or any other pack
not being replaced by the current compaction operation.

For deltas the base object is still included even if the base exists
in another exclusion set.  This favors keeping deltas for recent
history, to support faster fetch operations for clients.

Change-Id: Ie822fe075fe5072fe3171450fda2f0ca507796a1

11 years agoMake recursive merge strategy the default merge strategy 91/11891/2
Matthias Sohn [Mon, 25 Mar 2013 02:39:58 +0000 (03:39 +0100)]
Make recursive merge strategy the default merge strategy

Use recursive merge as the default strategy since it can successfully
merge more cases than the resolve strategy can. This is also the default
in native Git.

Change-Id: I38fd522edb2791f15d83e99038185edb09fed8e1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUpdate PackBitmapIndexRemapper to handle mappings not in the new pack. 10/11910/1
Colby Ranger [Mon, 15 Apr 2013 16:35:07 +0000 (09:35 -0700)]
Update PackBitmapIndexRemapper to handle mappings not in the new pack.

Previously, the code assumed all commits in the old pack would also
be present in the new pack. This assumption caused an
ArrayIndexOutOfBoundsException during remapping of ids. Fix the
iterator to only return entries that may be remapped. Furthermore,
update getBitmap() to return null if commit does not exist in the
new pack.

Change-Id: I065babe8cd39a7654c916bd01c7012135733dddf

11 years agoFix boundary conditions in AutoCRLFOutputStream 87/11887/2
Robin Rosenberg [Sun, 14 Apr 2013 17:15:53 +0000 (19:15 +0200)]
Fix boundary conditions in AutoCRLFOutputStream

This fixes some problems with inputs around the size of the internal
buffer in AutoCRLFOutputStream (8000).

Tests supplied by Robin Stocker.

Bug: 405672
Change-Id: I6147897290392b3bfd4040e8006da39c302a3d49

11 years agoNLS warning cleanup 85/11885/1
Robin Rosenberg [Sat, 13 Apr 2013 22:40:37 +0000 (00:40 +0200)]
NLS warning cleanup

Change-Id: Ia76aa02dd330a1f88096c2b059b363aa38d653e9

11 years agoMerge "Fix a possible NPE"
Robin Rosenberg [Sat, 13 Apr 2013 10:16:11 +0000 (06:16 -0400)]
Merge "Fix a possible NPE"

11 years agoMerge changes I845caede,Ie25c6d3a,I5caec313,Ib11ff99f,I9ccf20c3,Ic7826f29,I1bdd8b58...
Shawn Pearce [Fri, 12 Apr 2013 20:16:09 +0000 (16:16 -0400)]
Merge changes I845caede,Ie25c6d3a,I5caec313,Ib11ff99f,I9ccf20c3,Ic7826f29,I1bdd8b58,Idb84c1d7,I078841f9

* changes:
  Always attempt delta compression when reuseDeltas is false
  Avoid TemporaryBuffer.Heap on very small deltas
  Correct distribution of allowed delta size along chain length
  Split remaining delta work on path boundaries
  Replace DeltaWindow array with circularly linked list
  Micro-optimize copy instructions in DeltaEncoder
  Micro-optimize DeltaWindow primary loop
  Micro-optimize DeltaWindow maxMemory test to be != 0
  Mark DeltaWindowEntry methods final