]> source.dussan.org Git - jgit.git/log
jgit.git
12 years agoBatch reference updates together for storage 54/5254/2
Shawn O. Pearce [Tue, 22 May 2012 23:45:06 +0000 (16:45 -0700)]
Batch reference updates together for storage

clone, fetch and push can all update multiple references in a single
command invocation. Rather than performing sequential iteration
of each reference change inside of the application code, push this
down into the reference database where the implementation can take
advantage of the batch size and optimize itself.

For the local filesystem implementation the obvious optimization
is to write a packed-refs file when the repository is completely
empty. The initial clone, fetch or push into the destination may
have hundreds of new references. Writing all of these as loose
files is not efficient. This optimization is not implemented in
this commit and is left as an exercise for the reader to supply
in a future commit to JGit.

To make the API changes simple, define the BatchRefUpdate type and
implementation using the existing sequential behavior.

Change-Id: I8e1674f091e05e24e3ff56ccbc687a6d18a6a61e

12 years agoExpose ReceiveCommand.updateType to check for UPDATE_NONFASTFORWARD 85/6085/1
Shawn O. Pearce [Tue, 22 May 2012 23:22:41 +0000 (16:22 -0700)]
Expose ReceiveCommand.updateType to check for UPDATE_NONFASTFORWARD

When a command's type is UPDATE, JGit might not yet be sure if it
is a fast-forward or not. Expose a utility method to compute the
exact type by performing the merge base test, allowing the type
to be switched to UPDATE_NONFASTFORWARD if old ObjectId is not
contained in new ObjectId.

BaseReceivePack already does this test when validating the incoming
command list, so provide a package level backdoor to set the type
and avoid needing to redo the merge test later.

Change-Id: If5a6fcc50dc4d6f96e9bb0bb7bba15ebe8b86377

12 years agoReject non-fast-forwards earlier in BaseReceivePack 84/6084/1
Shawn O. Pearce [Tue, 22 May 2012 22:59:53 +0000 (15:59 -0700)]
Reject non-fast-forwards earlier in BaseReceivePack

If BaseReceivePack has setAllowNonFastForwards(false) configured
(such as by receive.denynonfastforwards), automatically reject
any command that attempts a non-fast-forward update before it goes
further in processing.

This matches with other checks in validateCommands(), such as the
early failure of delete attempts when isAllowDeletes() is false.

Change-Id: I3bb28e4dd6d17cb31ede09eb84ceb67cdb17ea5d

12 years agoMove NLS test for HttpServerText to http.test 83/6083/1
Shawn O. Pearce [Tue, 22 May 2012 21:52:32 +0000 (14:52 -0700)]
Move NLS test for HttpServerText to http.test

This never should have been in the core library test suite, as that
test suite never should depend upon the HTTP server module.

Change-Id: Ie0528c4d1c755823303d138e327a3a2f4caccc32

12 years agoFix JGit source bundle packaging 46/6046/2
Matthias Sohn [Mon, 21 May 2012 18:51:10 +0000 (20:51 +0200)]
Fix JGit source bundle packaging

Due to Tycho bug 368596 we didn't package the correct JGit source bundle
anymore. Instead of sources it contained the binary bundle. As a
workaround fall back to use packaging type eclipse-update-site which
doesn't seem to have this problem.

Bug: 368596
Bug: 379402
Change-Id: I3192dbd00b51e6ee6596d2301050b2a6f7028e3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoSmudge index entries on first write (too), as well when reading 13/5413/9
Robin Rosenberg [Mon, 21 May 2012 17:48:40 +0000 (10:48 -0700)]
Smudge index entries on first write (too), as well when reading

That happens when the index and a new file is created within the same
second and becomes a problem if we then modify the newly created file
within the same second after adding it to the index. Without smudging
JGit will, on later reads, think the file is unchanged.

The accompanying test passed with the smuding on read.

Change-Id: I4dfecf5c93993ef690e7f0dddb3f3e6125daae15

12 years agoAdd user friendly output from jgit commit command 34/6034/1
Mikael Karlsson [Fri, 18 May 2012 20:07:50 +0000 (22:07 +0200)]
Add user friendly output from jgit commit command

Instead of printing the stack trace from the JGitInternalException
thrown from CommitMessage.call(), print just the exception
message, using the Die exception.

Change-Id: I9ec3eb02eb001813fa15ac6f90a606223dcdafdc

12 years agoDon't swallow JSchException "Auth fail" exception 88/5988/3
Dariusz Luksza [Wed, 16 May 2012 05:55:03 +0000 (07:55 +0200)]
Don't swallow JSchException "Auth fail" exception

"Auth fail" exception was swallowed during retrying, this leads to
"Session down" exception during clone operation with invalid SSH keys.

Bug: 336795
Change-Id: Id8d9e83b10f4f2a01e0cf89819190bb23a04a2b9
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
12 years agoEnable call chaining on LsRemoteCommand methods 74/5974/1
Dave Borowitz [Tue, 20 Mar 2012 14:45:12 +0000 (07:45 -0700)]
Enable call chaining on LsRemoteCommand methods

Change-Id: I706332386415892d7a964b241442832ad79fa223

12 years agoFactor a base class out of ReceivePack 18/5818/4
Dave Borowitz [Thu, 3 May 2012 23:44:53 +0000 (16:44 -0700)]
Factor a base class out of ReceivePack

We are working on a publish/subscribe based git protocol, and we want to
reuse several parts of the ReceivePack-like code for reading commands
and processing a pack. In this new implementation, the connection
management will be very different, in particular, there may be multiple
packs received on a single open connection. So, hoist out as much as we
can from ReceivePack, mostly just leaving behind the single-connection
version in that class.

Change-Id: I5567aad6ae77951f73f59c1f91996d934ea88334

12 years agoAdd --all switch to org.eclipse.jgit.pgm.Commit 63/5763/2
Tomasz Zarna [Mon, 30 Apr 2012 13:18:07 +0000 (15:18 +0200)]
Add --all switch to org.eclipse.jgit.pgm.Commit

Change-Id: Iab52f995676daf60e0dfa043cc9e022f6e32a758
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoCleanup MergeResult constructors 68/5368/2
Tomasz Zarna [Thu, 15 Mar 2012 17:04:16 +0000 (18:04 +0100)]
Cleanup MergeResult constructors

'mergeStrategy' should be 5th argument, after 'mergeStatus'. Pass
'description' if available.

Change-Id: I97cebfe5d7db6247fe899075d917b82955906f85
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoAdd missing @since tags to mark API added in 2.0 73/5873/2
Matthias Sohn [Mon, 7 May 2012 21:45:24 +0000 (23:45 +0200)]
Add missing @since tags to mark API added in 2.0

Change-Id: I0a86ce0e393dfde9bb27f0b29e036e76c856396e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoUpdate tycho version to 0.14.1 96/5596/2
Matthias Sohn [Mon, 16 Apr 2012 15:40:43 +0000 (17:40 +0200)]
Update tycho version to 0.14.1

Tycho 0.14.1 enforces that artifactId and feature/bundle SymbolicName
must match, hence follow recommended migration practice and change
groupId of feature projects in order not to change the feature names as
this would require a feature migration.

Also migrate the p2 repository build from the deprecated packaging type
eclipse-update-site to packaging type eclipse-repository.

Change-Id: I99fc6c2bbb20efbd6514bdd9940f3535707c21bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoUpdate packaging project to build using Indigo platform 95/5595/2
Matthias Sohn [Mon, 16 Apr 2012 12:47:44 +0000 (14:47 +0200)]
Update packaging project to build using Indigo platform

Change-Id: I4c07112a6723d90d3677761f5476af00ead58282
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoRemove throws IOException declaration on filterClean 03/5903/2
Kevin Sawicki [Wed, 9 May 2012 18:18:02 +0000 (11:18 -0700)]
Remove throws IOException declaration on filterClean

This method only creates an EolCanonicalizingInputStream
which does not throw an IOException and so the throws
declaration on the method is unneeded.

Change-Id: Icae8b80006c5e3ffcf3b69790a1a45c505be0f05
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoAdd Object type to Comparable implements declaration 02/5902/3
Kevin Sawicki [Wed, 9 May 2012 17:41:40 +0000 (10:41 -0700)]
Add Object type to Comparable implements declaration

This removes unchecked warnings when a List of
AnyObjectId objects or any of its subclasses are
passed to Collections.sort such as in PackWriter

Change-Id: I806732cee24349c75c0357a655df55b070f2f213
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoRemove 4 unboxed warnings 01/5901/2
Kevin Sawicki [Wed, 9 May 2012 15:45:08 +0000 (08:45 -0700)]
Remove 4 unboxed warnings

Use Integer.intValue to explicitly convert to an int

Change-Id: I1135ed01af4e274b26d6b07d1a50f48ef0a30d91
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMake output stream optional in DiffCommand 08/5908/2
Kevin Sawicki [Wed, 9 May 2012 22:19:04 +0000 (00:19 +0200)]
Make output stream optional in DiffCommand

Use the NullOutputStream.INSTANCE value when the
configured output stream is null or the command is
configured to only show name and status.

Also only set the context and prefix options if
formatting is actually being performed.

Bug: 377157
Change-Id: I333cfcc82ee746f3c6a8e94c09dcc803ffbb4b3a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoCompare modes before comparing ids in ResolveMerger 09/5909/1
Kevin Sawicki [Wed, 9 May 2012 21:31:59 +0000 (14:31 -0700)]
Compare modes before comparing ids in ResolveMerger

Comparing ids can be more expensive so do the cheap
mode check first and short circuit the id comparison
when modes are non-equal

Change-Id: I671eda51c74a411cc27de9d6077cc76e816ebe2b

12 years agoRemove 86 boxing warnings 93/5893/2
Kevin Sawicki [Wed, 9 May 2012 04:42:53 +0000 (21:42 -0700)]
Remove 86 boxing warnings

Use Integer, Character, and Long valueOf methods when
passing parameters to MessageFormat and other places
that expect objects instead of primitives

Change-Id: I5942fbdbca6a378136c00d951ce61167f2366ca4

12 years agoRemove unnecessary boxing SuppressWarnings annotation 91/5891/1
Kevin Sawicki [Wed, 9 May 2012 03:42:19 +0000 (20:42 -0700)]
Remove unnecessary boxing SuppressWarnings annotation

Change-Id: Id8a6d9f96860742f9094efdb4f31a952be7d3025

12 years agoRemove unneeded catch block and null checks 32/5832/1
Kevin Sawicki [Fri, 4 May 2012 21:37:40 +0000 (14:37 -0700)]
Remove unneeded catch block and null checks

The catched exception was just rethrown and the
null check of the locked dir cache was unneeded if
the assignment was done outside the try block.

Change-Id: If2ee1f3eff3849f8da51eab825057fc56e166a94

12 years agoFix two typos in CLIText.properties 80/5780/1
Tomasz Zarna [Wed, 2 May 2012 09:35:13 +0000 (11:35 +0200)]
Fix two typos in CLIText.properties

Change-Id: Id1429d52c88a9e2b888e6c6906cf8148945bd2ca

12 years agoMerge "Update README regarding CRLF conversion, /etc and $HOME"
Matthias Sohn [Mon, 30 Apr 2012 20:07:38 +0000 (16:07 -0400)]
Merge "Update README regarding CRLF conversion, /etc and $HOME"

12 years agoUpdate README regarding CRLF conversion, /etc and $HOME 59/5759/1
Robin Rosenberg [Sat, 28 Apr 2012 22:37:54 +0000 (00:37 +0200)]
Update README regarding CRLF conversion, /etc and $HOME

Change-Id: I3c41a8ee7f500e2c39df94eaf5d87c234934b741

12 years agoValidate paths during DirCheckout 17/4617/16
Robin Rosenberg [Mon, 23 Apr 2012 20:37:50 +0000 (22:37 +0200)]
Validate paths during DirCheckout

DirCacheCheckout and CanonicalTreeParser cooperate. CanonicalTreeParser
can detect malformed, potentially malicious tree entries and sets a
flag, while DirCacheCheckout refuses to work with such paths.

Malicious tree entries are ".", "..", ".git" (case insensitive), any
name containing '/' and (on Windows '\') and also (on Windows)
any paths ending in a combination of '.' or space or containing a ':'.
We also forbid all special names like "con" etc on Windows.

Some of the test can execute on any platform by enabling partial
platform emulation.

A new runtime exception, InvalidPathException, is introduced. For
backwards compatibility it extends InvalidArgumentException.

Change-Id: I86199105814b63d4340e5de0e471d0da6b579ead
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoEnable large file support 89/5589/4
Robin Rosenberg [Mon, 16 Apr 2012 22:18:10 +0000 (00:18 +0200)]
Enable large file support

Allow adding files with size over 2 GB. The drawback is that the tests
for huge file support adds roughly 10 minutes of execution time.
For that reason we @Ignore the test in the standard test execution.

Change-Id: I5788e8009899203b346f353297166825b3744575

12 years agoAllow to write tests with CLI syntax 08/5408/2
Tomasz Zarna [Fri, 23 Mar 2012 08:10:41 +0000 (09:10 +0100)]
Allow to write tests with CLI syntax

CQ: 6385
Bug: 365444
Change-Id: I2d5164cd92429673fe3c37e9f5f9bc565192cc12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoEnable DirCacheEntry's copyMetaData to not copy stage info 93/5493/5
Robin Rosenberg [Fri, 13 Apr 2012 22:40:06 +0000 (00:40 +0200)]
Enable DirCacheEntry's copyMetaData to not copy stage info

When there is a conflict sometimes we did not set the stage of
the conflict entries properly for the STAGE_1 entry.

Change-Id: I1c28ff6251fdbc95f7c40fc3e401f1b41157a9f6

12 years agoMerge "Fix tests for Ant task "git-clone""
Christian Halstrick [Tue, 17 Apr 2012 07:38:12 +0000 (03:38 -0400)]
Merge "Fix tests for Ant task "git-clone""

12 years agoHide two warnings about boxing 94/5494/4
Robin Rosenberg [Mon, 16 Apr 2012 21:34:47 +0000 (23:34 +0200)]
Hide two warnings about boxing

Change-Id: I1cb7cdb81481019f4a55221d38d771fcc9451529
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoFix constructor for SafeBufferedOutputStream 83/5583/2
Robin Rosenberg [Fri, 13 Apr 2012 15:41:06 +0000 (17:41 +0200)]
Fix constructor for SafeBufferedOutputStream

The size shoould be passed to BufferedOutputStream's constructor.
All callers seem to use the default, but that could change.

Change-Id: I874afee6a9114698805e36813781547e6aa328a5

12 years agoMerge "UnsupportedCredentialItem with password authentication"
Robin Rosenberg [Mon, 9 Apr 2012 14:40:28 +0000 (10:40 -0400)]
Merge "UnsupportedCredentialItem with password authentication"

12 years agoUnsupportedCredentialItem with password authentication 29/5529/2
Robin Rosenberg [Thu, 5 Apr 2012 06:04:45 +0000 (08:04 +0200)]
UnsupportedCredentialItem with password authentication

If the server prompts for password, it comes as a StringType prompt.

Bug: 360862
Change-Id: Ic758456c21c8d68d1b3d7f56228beb7535b11735

12 years agoMerge "Fix broken TagCommand API"
Robin Rosenberg [Fri, 6 Apr 2012 09:34:00 +0000 (05:34 -0400)]
Merge "Fix broken TagCommand API"

12 years agoMerge "Cleanup possiblyFilteredInputStream() in WorkingTreeIterator"
Matthias Sohn [Fri, 6 Apr 2012 00:32:03 +0000 (20:32 -0400)]
Merge "Cleanup possiblyFilteredInputStream() in WorkingTreeIterator"

12 years agoMerge "Handle content length in WorkingTreeIterator"
Robin Rosenberg [Thu, 5 Apr 2012 23:29:08 +0000 (19:29 -0400)]
Merge "Handle content length in WorkingTreeIterator"

12 years agoFix broken TagCommand API 02/5302/2
Robin Rosenberg [Fri, 9 Mar 2012 11:03:20 +0000 (12:03 +0100)]
Fix broken TagCommand API

Tags can be un-annotated whereby there is no RevTag object, only
a ref pointing to the tagged object.

Bug: 360650
Change-Id: I06309c45c0a896fe2a0a874700febf78c9fb87e8

12 years agoCleanup possiblyFilteredInputStream() in WorkingTreeIterator 39/5539/1
Robin Rosenberg [Thu, 5 Apr 2012 22:26:06 +0000 (00:26 +0200)]
Cleanup possiblyFilteredInputStream() in WorkingTreeIterator

Use early return instead of nested if/else

Change-Id: I3b5048f9f5cfdfd01f916af550722532db3f9bb3

12 years agoMerge "Recurse into cloned submodules"
Matthias Sohn [Tue, 3 Apr 2012 22:42:03 +0000 (18:42 -0400)]
Merge "Recurse into cloned submodules"

12 years agoUnlock DirCache in case of occurring exception 69/4869/2
Jens Baumgart [Tue, 3 Apr 2012 15:25:32 +0000 (17:25 +0200)]
Unlock DirCache in case of occurring exception

A DirCache was not unlocked if an exception occurred in the
DirCacheCheckout constructor.

Bug: 365449
Change-Id: I231d902d52e3e5e9a7748eedaa63a2bb889ebb13
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
12 years agoMerge "Index config section and subsection names in one pass"
Robin Rosenberg [Mon, 2 Apr 2012 21:59:34 +0000 (17:59 -0400)]
Merge "Index config section and subsection names in one pass"

12 years agoMerge "Add @Override annotations to enums"
Robin Rosenberg [Mon, 2 Apr 2012 21:53:07 +0000 (17:53 -0400)]
Merge "Add @Override annotations to enums"

12 years agoMerge "Externalize parsing exception message for RebaseCommand#Action"
Matthias Sohn [Mon, 2 Apr 2012 20:02:39 +0000 (16:02 -0400)]
Merge "Externalize parsing exception message for RebaseCommand#Action"

12 years agoIndex config section and subsection names in one pass 87/5487/2
Shawn O. Pearce [Tue, 27 Mar 2012 19:32:16 +0000 (15:32 -0400)]
Index config section and subsection names in one pass

Instead of indexing the subsection names on each request for a given
section name, index both the section and subsection names in a single
scan through the entry list. This should improve lookup time for
reading the section names out of the configuration, especially for the
url.*.insteadof type of processing performed in RemoteConfig.

Change-Id: I7b3269565b1308f69d20dc3f3fe917aea00f8a73

12 years agoExternalize parsing exception message for RebaseCommand#Action 15/5515/1
Tomasz Zarna [Mon, 2 Apr 2012 09:36:29 +0000 (11:36 +0200)]
Externalize parsing exception message for RebaseCommand#Action

Change-Id: Id0d7801e4de98bf118dbecadf623c9ffd7ab7554

12 years agoAdd @Override annotations to enums 14/5514/1
Tomasz Zarna [Mon, 2 Apr 2012 09:24:05 +0000 (11:24 +0200)]
Add @Override annotations to enums

Change-Id: I8fa3b89a6349c1231251b346cae12c1c4f095929

12 years agoDon't use java.nio channel for file size determination 76/5276/11
Markus Duft [Mon, 2 Apr 2012 05:27:19 +0000 (07:27 +0200)]
Don't use java.nio channel for file size determination

Java NIO has some problems (like files closing unexpectedly because the
thread was interrupted). To avoid those problems, don't use a NIO
channel to determine the size of a file, but rather ask the File itself.

We have to be prepared to handle wrong/outdated information in this case
too, as the inode of the File may change between opening and determining
file size.

Change-Id: Ic7aa6c3337480879efcce4a3058b548cd0e2cef0

12 years agoRecurse into cloned submodules 98/5498/1
Kevin Sawicki [Mon, 2 Apr 2012 01:36:42 +0000 (18:36 -0700)]
Recurse into cloned submodules

Iterate over all successfully cloned submodules recursively
and continue initializing and updating until no more are found.

Bug: 375426
Change-Id: Ifb99e41e2deb0c369442bca3c0f5f072dd006816

12 years agoFix tests for Ant task "git-clone" 97/5497/1
Matthias Sohn [Sun, 1 Apr 2012 23:20:31 +0000 (01:20 +0200)]
Fix tests for Ant task "git-clone"

If project.init() isn't called GitCloneTaskTest fails when started from
Eclipse, according to [1] calling init() is necessary to properly
initialize the Ant project programmatically.

Always set the destination folder in order to ensure that all test
resources are created under the project's target folder and do not
pollute the project's source tree with test data.

[1]
http://ant.1045680.n5.nabble.com/project-createTask-not-working-with-ant-1-8-2-td3385716.html

Change-Id: Icbeb62680b018a92673faa58828b5e850564c7a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge changes Ic8907231,I693148a5
Robin Rosenberg [Fri, 30 Mar 2012 16:25:47 +0000 (12:25 -0400)]
Merge changes Ic8907231,I693148a5

* changes:
  Sort Config entries and use O(log N) lookup
  Extract inner classes from Config

12 years agoFix loading packed objects >2G 90/5490/2
Shawn O. Pearce [Wed, 28 Mar 2012 14:12:20 +0000 (10:12 -0400)]
Fix loading packed objects >2G

Parsing the size from a packed object header was incorrectly computing
the total inflated length when the length exceeded the range of a Java
int. The next 7 bits of size information was shifted left as an int
using a shift of 25 bits, placing the higher bits of the size into the
sign position. When this size was extended to a long to be added to
the current size accumulator the size went negative, resulting in
NegativeArraySizeException being thrown.

Fix all places where this particular pattern of code is used to read a
pack size field, or a binary delta header, as they both use the same
variable length encoding scheme.

Change-Id: I04008728ed828f18202652c3d5401cf95a441d0a

12 years agoSort Config entries and use O(log N) lookup 86/5486/1
Shawn O. Pearce [Tue, 27 Mar 2012 15:49:13 +0000 (11:49 -0400)]
Sort Config entries and use O(log N) lookup

Decrease running time for getStringList (and all other get methods) by
looking for configuration entries using binary search rather than
linear search through the configuration file.

Configuration lines are sorted by section, subsection, name in a
sorted list whenever the snapshot is rebuilt. Binary search is used to
locate an index in the middle of the values, then walk backwards to
find the first value in the range.

Given a configuration of file of 5000 distinct section/subsection/name
triplets (e.g. a Gerrit Code Review project.config configuration file
with 5000 unique access control rules), this new code is faster to
lookup each rule individually using getStringList():

  old setStringList() 194 usec avg
      getStringList() 196 usec avg

  new setStringList() 188 usec avg
      getStringList()  24 usec avg

Change-Id: Ic8907231868c18eb946b72f341a6b58666b70324

12 years agoExtract inner classes from Config 85/5485/1
Shawn O. Pearce [Tue, 27 Mar 2012 14:43:02 +0000 (10:43 -0400)]
Extract inner classes from Config

The Config class is getting very large. Extract two of its inner
classes into new top level types to reduce the size of Config.
Rename them slightly in the process.

Change-Id: I693148a5ae2977378789bf455c880a6fd856c0f0

12 years agoHandle content length in WorkingTreeIterator 12/5412/2
Robin Rosenberg [Sun, 25 Mar 2012 12:42:54 +0000 (14:42 +0200)]
Handle content length in WorkingTreeIterator

Content length is computed and cached (short term) in the working
tree iterator when core.autocrlf is set.

Hopefully this is a cleaner fix than my previous attempt to make
autocrlf work.

Change-Id: I1b6bbb643101a00db94e5514b5e2b069f338907a

12 years agoAllow RepositoryResolver to throw ServiceMayNotContinueException 77/5477/1
Dave Borowitz [Mon, 26 Mar 2012 17:19:40 +0000 (10:19 -0700)]
Allow RepositoryResolver to throw ServiceMayNotContinueException

Implementations may want to send an error message to the user, which
doesn't really fit with any of the existing exception types.
ServiceMayNotContinueException, on the other hand, is documented as
always containing a user-visible error string, so use that.

Modify the git and HTTP transport mechanisms to properly relay this
message to the end user.

Change-Id: I362e67ea46102a145bf2c6284d38788537c9735f

12 years agoClarify documentation of exceptions in RepositoryResolver 76/5476/1
Dave Borowitz [Mon, 26 Mar 2012 16:53:32 +0000 (09:53 -0700)]
Clarify documentation of exceptions in RepositoryResolver

Change-Id: Idf805f76f24bfa1f3552366197e0ed4e45cb2b74

12 years agoProperly parse first line in ReceivePack with no '\0' 11/5411/1
Dave Borowitz [Fri, 23 Mar 2012 21:38:06 +0000 (14:38 -0700)]
Properly parse first line in ReceivePack with no '\0'

Change-Id: Ic98e17aff4e4b3c3fa0359082bab689e4522e3d7

12 years agoRevert "Allow to write tests with CLI syntax" 07/5407/1
Matthias Sohn [Thu, 22 Mar 2012 23:30:46 +0000 (00:30 +0100)]
Revert "Allow to write tests with CLI syntax"

This reverts commit bf845c126d53f07de103e03b68ddb7f24014cee5 since this
change needs to go through a formal IP review and Chris missed to file a
CQ for that.

Change-Id: I303515d78116f0591a2911dbfb9f857738f086a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge "Allow to write tests with CLI syntax"
Christian Halstrick [Thu, 22 Mar 2012 11:39:14 +0000 (07:39 -0400)]
Merge "Allow to write tests with CLI syntax"

12 years agoAllow to write tests with CLI syntax 20/4720/8
Tomasz Zarna [Thu, 22 Mar 2012 10:29:18 +0000 (11:29 +0100)]
Allow to write tests with CLI syntax

Bug: 365444
Change-Id: I86f382913bc47665c5b9a2827b878e7dbedce7b1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoAdd command support for dropping a stashed commit 93/5393/8
Kevin Sawicki [Wed, 21 Mar 2012 17:50:16 +0000 (10:50 -0700)]
Add command support for dropping a stashed commit

This extracts the logic for writing to the reflog from
RefDirectory into a new ReflogWriter class.  This class
creates a public API for writing reflog entries similar
to ReflogReader for reading reflog entries.

The new command supports rewriting the stash's log to remove
a configured entry followed by updating the stash ref to
the value at the bottom of the newly written log.

Change-Id: Icfcbc70e838666769a742a94196eb8dc9c7efcc7
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoIgnore trailing comments in transport SPI parsing 88/5388/5
Kevin Sawicki [Tue, 20 Mar 2012 05:00:49 +0000 (22:00 -0700)]
Ignore trailing comments in transport SPI parsing

Check for a '#' character in each line read and
parse the leading characters as the class name of
a TransportProtocol being registered via SPI.

Bug: 373439
Change-Id: If36cb62c07ecea78ba0f326a87edf1d80b7b42b6
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoCompare repository format version as parsed long 17/5217/5
Kevin Sawicki [Mon, 12 Mar 2012 17:00:52 +0000 (10:00 -0700)]
Compare repository format version as parsed long

This allows repositoryies with a missing repositoryformatversion
config value to be successfully opened but still throws exceptions
when the value is a non-long or greater than zero.

git-core attempts to parse this config value as a long as well
and defaults to 0 if the value is missing.

Bug: 368697
Change-Id: I4a93117afca37e591e8e0ab4d2f2eef4273f0cc9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoCopy all branch configuration values when renaming 87/5387/3
Kevin Sawicki [Tue, 20 Mar 2012 01:03:20 +0000 (18:03 -0700)]
Copy all branch configuration values when renaming

Previously only certain values were copied over which caused
divergence in behavior between the JGit command and corresponding
CGit command.

Bug: 372051
Change-Id: I72a83215a679a713138da31f5ab838f14388d4bd
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoClarify the purpose of ObjectInserter.buffer() 67/5367/2
Shawn O. Pearce [Thu, 15 Mar 2012 14:57:56 +0000 (07:57 -0700)]
Clarify the purpose of ObjectInserter.buffer()

Recently Robin tried to increase the size of the buffer used by
ObjectInserter to fix a bug in the InputStream that handles AutoCRLF.
The purpose of this buffer is NOT to make a random InputStream work
correctly by passing it a larger buffer during read(byte[],int,int).

Clarify the Javadoc on the buffer() method to reduce the risk
someone tries to abuse it again.

While we are here, modify the method to load the field into a local
variable before returning. This should cut down 1 field load during
the common case of the buffer being already allocated.

Change-Id: Ic6898530d10fcd7e59f90397117a4a0d97e1f031
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoLogCommand#setMaxCount affects all commits 28/5028/4
Tomasz Zarna [Sun, 18 Mar 2012 00:13:01 +0000 (01:13 +0100)]
LogCommand#setMaxCount affects all commits

Bug: 370132
Change-Id: I9f5ff3640a4f69c0b48c97609728d7672e63e6ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoPass a DfsRepositoryDescription to InMemoryRepository 70/5370/1
Dave Borowitz [Thu, 15 Mar 2012 22:46:39 +0000 (15:46 -0700)]
Pass a DfsRepositoryDescription to InMemoryRepository

This was likely intended originally, but this class had never been
used, so the mistake went unnoticed.

Change-Id: I5e0e9f22ebf707c11d0581511c7a56b182188f77

12 years agoRevert "Quickfix for AutoCRLF handling" 66/5366/1
Shawn O. Pearce [Thu, 15 Mar 2012 14:21:14 +0000 (07:21 -0700)]
Revert "Quickfix for AutoCRLF handling"

This reverts commit 88fe2836edab8d8ce82d28acd9d07b061988ff3a.

Auto CRLF isn't special enough to be screwing around with the buffers
used for raw byte processing of the ObjectInserter API. If it needs a
buffer to process a file that is bigger than the buffer allocated by
an ObjectInserter, it needs to do its own buffer management.

Change-Id: Ida4aaa80d0f9f78035f3d2a9ebdde904c980f89a

12 years agoOnly unstash files changed when originally stashed 94/5194/8
Kevin Sawicki [Wed, 14 Mar 2012 00:01:42 +0000 (17:01 -0700)]
Only unstash files changed when originally stashed

Previously a DirCacheCheckout was done using a merge tree reflecting
the state of the repository when the stash was originally done.
This was wrong since unstashing after making subsequent commits
would undo changes already committed by checking out entries from
an outdated tree.

The new approach is to scan for conflicts initially using a 6-way
tree walk that contains the trees for the stashed HEAD, stashed
index, stashed working directory, current HEAD, current index, and
current working directory.  Then perform a subsequent scan of the
stashed HEAD, index, and working directory trees and apply all
the stashed differences to the current index and working directory.

Bug: 372882
Change-Id: Ica65f162132c00a16964e838de66fc8b5cd0b0aa
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoMerge "Enable smart HTTP transport to place EOF at end of pack"
Shawn O. Pearce [Tue, 13 Mar 2012 18:50:27 +0000 (14:50 -0400)]
Merge "Enable smart HTTP transport to place EOF at end of pack"

12 years agoEnable smart HTTP transport to place EOF at end of pack 48/5348/2
Shawn O. Pearce [Tue, 13 Mar 2012 18:10:33 +0000 (11:10 -0700)]
Enable smart HTTP transport to place EOF at end of pack

When fetching over smart HTTP the InputStream that gets fed into
a PackParser doesn't really support EOF at the end of the pack. It
instead tries to make a new HTTP request, which fails because there
is no request body currently buffered by the client.

Make EOF work correctly on the end of an HTTP derived InputStream
for the pack by denoting no more requests are expected as the higher
level code is now consuming the pack (or side-band embedded pack).
Smart HTTP support doesn't automatically enqueue execute support onto
the end of the UnionInputStream, which allows the UnionInputStream
to correctly reflect EOF when the HTTP response is consumed.

Change-Id: I975f1ab1c81ab1c1af925716970088bc7b8d6b1a

12 years agoDo not import/export empty org.eclipse.jgit package 39/5339/2
Tomasz Zarna [Tue, 13 Mar 2012 16:10:10 +0000 (09:10 -0700)]
Do not import/export empty org.eclipse.jgit package

The package was removed in I763590a45d75f00a09097ab6f89581a3bbd3c797

Change-Id: Ifa9e75714f85d17609f9bf61581aaed0631a6fa7
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoMove JGitText to an internal package 01/5301/3
Robin Rosenberg [Fri, 9 Mar 2012 09:44:05 +0000 (10:44 +0100)]
Move JGitText to an internal package

Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797

12 years agoMerge changes Ic0ee9c08,Ia3e82682,I8d8ab547,I8f2cd0a0,I45823b0c,Ie22ac47e
Shawn Pearce [Mon, 12 Mar 2012 14:16:42 +0000 (10:16 -0400)]
Merge changes Ic0ee9c08,Ia3e82682,I8d8ab547,I8f2cd0a0,I45823b0c,Ie22ac47e

* changes:
  cleanup: Silence an unused-parameter warning
  cleanup: Get rid of some unused-warnings
  cleanup: Remove unused parameter in ConsoleCredentialsProvider
  cleanup: Drop unused parameter on DhtPackParser
  cleanup: Remove unneeded parameter to private method in RefUpdateTest
  cleanup: Remove unnecessary @SuppressWarnings

12 years agoMerge "Use object id provided by working tree iterator for submodules"
Shawn Pearce [Mon, 12 Mar 2012 14:14:02 +0000 (10:14 -0400)]
Merge "Use object id provided by working tree iterator for submodules"

12 years agoFix compilation error due to missing javadoc. 25/5325/1
Markus Duft [Mon, 12 Mar 2012 13:54:56 +0000 (14:54 +0100)]
Fix compilation error due to missing javadoc.

Another change introduced this problem. With default JGit project
settings there is a compilation problem as javadoc problems are set to
Error in the project preferences.

Change-Id: I81e3ceeb02f7a2119b2a6cfefb7fbd9e83771fc9

12 years agoUse object id provided by working tree iterator for submodules 14/5314/1
Kevin Sawicki [Sat, 10 Mar 2012 18:26:10 +0000 (10:26 -0800)]
Use object id provided by working tree iterator for submodules

The working tree iterator now supports providing an object id
for submodule entries and this value should be used instead
of recomputing it again in AddCommand.

Change-Id: I30082514c23fc65968bb78add5ad69a1ca95cf3a

12 years agoKeep submodules in index that are missing in working directory 13/5313/1
Kevin Sawicki [Sat, 10 Mar 2012 18:02:58 +0000 (10:02 -0800)]
Keep submodules in index that are missing in working directory

Submodules present in the index but missing from the working
directory should not be staged for deletion when AddCommand
is called with the update flag set to true.

This mirrors the behavior of CGit.  Submodules can still be
staged for deletion by running by using the RmCommand.

Change-Id: Iee508a67f9621269d1c28d422f88c6b8dd9f8e6e

12 years agoMerge "Export all packages from org.eclipse.jgit.pgm"
Matthias Sohn [Sat, 10 Mar 2012 00:29:13 +0000 (19:29 -0500)]
Merge "Export all packages from org.eclipse.jgit.pgm"

12 years agoMerge "EolCanonicalizingInputStream: binary detection should be optional"
Robin Rosenberg [Fri, 9 Mar 2012 20:52:11 +0000 (15:52 -0500)]
Merge "EolCanonicalizingInputStream: binary detection should be optional"

12 years agocleanup: Silence an unused-parameter warning 09/5309/2
Robin Rosenberg [Fri, 9 Mar 2012 12:23:12 +0000 (13:23 +0100)]
cleanup: Silence an unused-parameter warning

Change-Id: Ic0ee9c08642d4efc6ef1f2333ebe6614e9c2df87

12 years agoMerge "Fix rebase > continue when nothing left to commit."
Stefan Lay [Fri, 9 Mar 2012 13:04:20 +0000 (08:04 -0500)]
Merge "Fix rebase > continue when nothing left to commit."

12 years agoFix rebase > continue when nothing left to commit. 59/4959/7
Markus Duft [Fri, 9 Mar 2012 12:36:53 +0000 (13:36 +0100)]
Fix rebase > continue when nothing left to commit.

If after resolving all conflicts nothing is left to commit, return
an according result, so that downstreams (EGit, ...) can behave like
cgit, and display a nice message informing the user.

Currently, EGit displays a "HEAD advanced fast forward" message, which
is absolutely not helpful at all.

This is the basic API revamping required to get that state communicated
to the outside world (EGit).

Bug: 336812
Change-Id: If2665005cf54a5b51c0fe80bad019fa42b0205af

12 years agocleanup: Get rid of some unused-warnings 07/5307/1
Robin Rosenberg [Fri, 9 Mar 2012 12:10:58 +0000 (13:10 +0100)]
cleanup: Get rid of some unused-warnings

Change-Id: Ia3e82682781c6b5bc3141b3e27db67b93c3162cd

12 years agocleanup: Remove unused parameter in ConsoleCredentialsProvider 06/5306/1
Robin Rosenberg [Fri, 9 Mar 2012 12:10:14 +0000 (13:10 +0100)]
cleanup: Remove unused parameter in ConsoleCredentialsProvider

Change-Id: I8d8ab54736c6d57e6211928def8632acb1f5b621

12 years agocleanup: Drop unused parameter on DhtPackParser 05/5305/1
Robin Rosenberg [Fri, 9 Mar 2012 12:01:40 +0000 (13:01 +0100)]
cleanup: Drop unused parameter on DhtPackParser

Change-Id: I8f2cd0a04cc95a02c49c16dade1b3509cba02e2d

12 years agocleanup: Remove unneeded parameter to private method in RefUpdateTest 04/5304/1
Robin Rosenberg [Fri, 9 Mar 2012 11:26:19 +0000 (12:26 +0100)]
cleanup: Remove unneeded parameter to private method in RefUpdateTest

Change-Id: I45823b0c1ad5d249d539d7c8e1180ad7432abb3e

12 years agocleanup: Remove unnecessary @SuppressWarnings 03/5303/1
Robin Rosenberg [Fri, 9 Mar 2012 11:14:22 +0000 (12:14 +0100)]
cleanup: Remove unnecessary @SuppressWarnings

Change-Id: Ie22ac47e315bff76f224214bc042fc483eb01550
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoMerge "Revert non-sense logic in IO.readFully"
Robin Rosenberg [Fri, 9 Mar 2012 09:47:45 +0000 (04:47 -0500)]
Merge "Revert non-sense logic in IO.readFully"

12 years agoUse readString() to trim trailing LF from first line 97/5297/1
Shawn O. Pearce [Thu, 8 Mar 2012 03:51:12 +0000 (19:51 -0800)]
Use readString() to trim trailing LF from first line

The fetch-pack/upload-pack stream usually has an LF at the
end of the first "want" line. Trim this when checking to
see if side-band or side-band-64k was used.

Perform the same trim for send-pack/receive-pack, as it is
harmless in this context to ignore an LF just before doing
an error report.

Change-Id: I6ef946bb6124fa72c52bd5320187eaac3ed906e7

12 years agoMerge changes I8277fd45,I7ac4e0ae,Ib475dfc0,Ib26adf95
Shawn Pearce [Thu, 8 Mar 2012 03:22:22 +0000 (22:22 -0500)]
Merge changes I8277fd45,I7ac4e0ae,Ib475dfc0,Ib26adf95

* changes:
  Try to send HTTP error messages over sideband
  Extract the capability parsing logic in {Upload,Receive}Pack
  Make capability strings in BasePack{Fetch,Push}Connection public
  Fix a typo in "capabilities" in ReceivePack

12 years agoTry to send HTTP error messages over sideband 96/5296/2
Dave Borowitz [Wed, 7 Mar 2012 19:56:56 +0000 (11:56 -0800)]
Try to send HTTP error messages over sideband

When a client POSTs to /git-{upload,receive}-pack, the first line
includes their client capabilities. As soon as the C git client sends
side-band(-64k), it goes into a state where it chokes on data not sent
in a valid sideband channel.

GitSmartHttpTools.sendError() is called early in the request, likely
before a {Upload,Receive}Pack handler is assigned or, even so, before it
has read the request. In some cases we must read the first line manually
within sendError() to tell whether sideband is needed.

Change-Id: I8277fd45a4ec3b71fa8f87404b4f5d1a09e0f384

12 years agoExtract the capability parsing logic in {Upload,Receive}Pack 95/5295/1
Dave Borowitz [Wed, 7 Mar 2012 20:53:49 +0000 (12:53 -0800)]
Extract the capability parsing logic in {Upload,Receive}Pack

Change-Id: I7ac4e0ae98872a74b01162b5ca936fb15e2f8cff

12 years agoMake capability strings in BasePack{Fetch,Push}Connection public 94/5294/1
Dave Borowitz [Wed, 7 Mar 2012 20:52:19 +0000 (12:52 -0800)]
Make capability strings in BasePack{Fetch,Push}Connection public

Change-Id: Ib475dfc087705ea40e1db37ec9ef28a67fde6d72

12 years agoFix a typo in "capabilities" in ReceivePack 93/5293/1
Dave Borowitz [Wed, 7 Mar 2012 20:21:50 +0000 (12:21 -0800)]
Fix a typo in "capabilities" in ReceivePack

Change-Id: Ib26adf954dcb90403be9d6ed3b7a425a724c67d0

12 years agoExport all packages from org.eclipse.jgit.pgm 90/5290/1
Tomasz Zarna [Wed, 7 Mar 2012 17:41:45 +0000 (18:41 +0100)]
Export all packages from org.eclipse.jgit.pgm

Change-Id: I90565c8626aa5ab58ed3ff1dafa8bd21c9a79c62

12 years agoRemove ambiguous CheckoutConflictException 78/4178/8
Tomasz Zarna [Tue, 6 Mar 2012 21:43:25 +0000 (22:43 +0100)]
Remove ambiguous CheckoutConflictException

Checkout command should throw o.e.j.api.errors.CheckoutConflictException
which is a GitAPIException not o.e.j.errors.CheckoutConflictException.
PullCommand should rethrow the API exception as a JGitInternalException.

Bug: 356922
Change-Id: I865c4905997d9834c85a97fbe7287604daf99075
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge "Check connection's error stream before reading from it"
Christian Halstrick [Tue, 6 Mar 2012 14:26:38 +0000 (09:26 -0500)]
Merge "Check connection's error stream before reading from it"