Commit Graph

1973 Commits

Author SHA1 Message Date
Tomasz Zarna a2dac2c78d Allow to write tests with CLI syntax
CQ: 6385
Bug: 365444
Change-Id: I2d5164cd92429673fe3c37e9f5f9bc565192cc12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-04-18 18:57:36 +02:00
Robin Rosenberg 95ed300b04 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
2012-04-17 09:51:03 +02:00
Christian Halstrick dd1e66e1d7 Merge "Fix tests for Ant task "git-clone"" 2012-04-17 03:38:12 -04:00
Robin Rosenberg bf33a6eeed Hide two warnings about boxing
Change-Id: I1cb7cdb81481019f4a55221d38d771fcc9451529
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-04-16 23:34:47 +02:00
Robin Rosenberg 0e8f3a6234 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
2012-04-14 12:26:34 +02:00
Robin Rosenberg 32be70d209 Merge "UnsupportedCredentialItem with password authentication" 2012-04-09 10:40:28 -04:00
Robin Rosenberg 2047eaa4c2 UnsupportedCredentialItem with password authentication
If the server prompts for password, it comes as a StringType prompt.

Bug: 360862
Change-Id: Ic758456c21c8d68d1b3d7f56228beb7535b11735
2012-04-09 16:34:40 +02:00
Robin Rosenberg e951b407fa Merge "Fix broken TagCommand API" 2012-04-06 05:34:00 -04:00
Matthias Sohn fcacfdeaf7 Merge "Cleanup possiblyFilteredInputStream() in WorkingTreeIterator" 2012-04-05 20:32:03 -04:00
Robin Rosenberg b7e881e625 Merge "Handle content length in WorkingTreeIterator" 2012-04-05 19:29:08 -04:00
Robin Rosenberg fd53b454f2 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
2012-04-06 00:52:20 +02:00
Robin Rosenberg 8f9c4ee41d Cleanup possiblyFilteredInputStream() in WorkingTreeIterator
Use early return instead of nested if/else

Change-Id: I3b5048f9f5cfdfd01f916af550722532db3f9bb3
2012-04-06 00:26:06 +02:00
Matthias Sohn 6a1a80aa4c Merge "Recurse into cloned submodules" 2012-04-03 18:42:03 -04:00
Jens Baumgart 0a84ad2d2a 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>
2012-04-03 17:25:32 +02:00
Robin Rosenberg 86db05602f Merge "Index config section and subsection names in one pass" 2012-04-02 17:59:34 -04:00
Robin Rosenberg 159533c4cf Merge "Add @Override annotations to enums" 2012-04-02 17:53:07 -04:00
Matthias Sohn 1b73db77ef Merge "Externalize parsing exception message for RebaseCommand#Action" 2012-04-02 16:02:39 -04:00
Shawn O. Pearce c0b1443926 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
2012-04-02 11:44:45 -07:00
Tomasz Zarna 622232b936 Externalize parsing exception message for RebaseCommand#Action
Change-Id: Id0d7801e4de98bf118dbecadf623c9ffd7ab7554
2012-04-02 11:36:29 +02:00
Tomasz Zarna 4e1de30809 Add @Override annotations to enums
Change-Id: I8fa3b89a6349c1231251b346cae12c1c4f095929
2012-04-02 11:24:05 +02:00
Markus Duft 2ba67bedae 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
2012-04-02 07:27:25 +02:00
Kevin Sawicki 543c5238ae 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
2012-04-01 18:36:42 -07:00
Matthias Sohn ee90d6afba 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>
2012-04-02 01:20:31 +02:00
Robin Rosenberg 6189a68d1d Merge changes Ic8907231,I693148a5
* changes:
  Sort Config entries and use O(log N) lookup
  Extract inner classes from Config
2012-03-30 12:25:47 -04:00
Shawn O. Pearce 6c0d300a54 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
2012-03-28 10:36:51 -04:00
Shawn O. Pearce 552682dc6a 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
2012-03-27 14:23:36 -04:00
Shawn O. Pearce 581e6ca2fe 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
2012-03-27 10:43:02 -04:00
Robin Rosenberg 3f4725c179 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
2012-03-27 00:47:17 +02:00
Dave Borowitz 55bf06b43d 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
2012-03-26 10:19:40 -07:00
Dave Borowitz d794a4fde3 Clarify documentation of exceptions in RepositoryResolver
Change-Id: Idf805f76f24bfa1f3552366197e0ed4e45cb2b74
2012-03-26 09:53:32 -07:00
Dave Borowitz e0531ace35 Properly parse first line in ReceivePack with no '\0'
Change-Id: Ic98e17aff4e4b3c3fa0359082bab689e4522e3d7
2012-03-23 14:38:06 -07:00
Matthias Sohn 9dd6e6cd29 Revert "Allow to write tests with CLI syntax"
This reverts commit bf845c126d 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>
2012-03-23 00:30:46 +01:00
Christian Halstrick 473139bbf6 Merge "Allow to write tests with CLI syntax" 2012-03-22 07:39:14 -04:00
Tomasz Zarna bf845c126d Allow to write tests with CLI syntax
Bug: 365444
Change-Id: I86f382913bc47665c5b9a2827b878e7dbedce7b1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-03-22 11:29:18 +01:00
Kevin Sawicki b37b7e69cd 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>
2012-03-21 14:16:14 -07:00
Kevin Sawicki bbfa4c9b2c 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>
2012-03-21 14:07:55 -07:00
Kevin Sawicki 7aeea3b27c 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>
2012-03-21 13:59:39 -07:00
Kevin Sawicki fd0c468b7a 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>
2012-03-21 10:20:54 -07:00
Shawn O. Pearce 04ab2dac37 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>
2012-03-18 08:20:06 -05:00
Tomasz Zarna c75aa1aed2 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>
2012-03-18 08:08:35 -05:00
Dave Borowitz 9bc26efe9d 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
2012-03-15 15:46:39 -07:00
Shawn O. Pearce ff13648ea2 Revert "Quickfix for AutoCRLF handling"
This reverts commit 88fe2836ed.

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
2012-03-15 07:22:24 -07:00
Kevin Sawicki 9be6526e9d 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>
2012-03-13 19:14:15 -05:00
Shawn O. Pearce 6e13dfab4a Merge "Enable smart HTTP transport to place EOF at end of pack" 2012-03-13 14:50:27 -04:00
Shawn O. Pearce dfff04742f 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
2012-03-13 11:41:51 -07:00
Tomasz Zarna 0705e95630 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>
2012-03-13 09:10:10 -07:00
Robin Rosenberg 95d311f888 Move JGitText to an internal package
Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
2012-03-12 07:20:03 -07:00
Shawn Pearce 0a69f05647 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
2012-03-12 10:16:42 -04:00
Shawn Pearce 95ceb24866 Merge "Use object id provided by working tree iterator for submodules" 2012-03-12 10:14:02 -04:00
Markus Duft d1403512f5 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
2012-03-12 14:54:56 +01:00