Commit Graph

675 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
Robin Rosenberg e951b407fa Merge "Fix broken TagCommand API" 2012-04-06 05:34:00 -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
Matthias Sohn 6a1a80aa4c Merge "Recurse into cloned submodules" 2012-04-03 18:42:03 -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
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
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
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
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
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
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
Kevin Sawicki 5c18fcb81b 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
2012-03-10 10:02:58 -08:00
Robin Rosenberg 9a9877da4e Merge "EolCanonicalizingInputStream: binary detection should be optional" 2012-03-09 15:52:11 -05:00
Markus Duft edc1fee033 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
2012-03-09 13:56:37 +01:00
Robin Rosenberg dd830f0a8d cleanup: Remove unneeded parameter to private method in RefUpdateTest
Change-Id: I45823b0c1ad5d249d539d7c8e1180ad7432abb3e
2012-03-09 13:30:19 +01:00
Tomasz Zarna 90d002c15f 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>
2012-03-06 22:43:25 +01:00
Kevin Sawicki fb2113d766 Reuse Git object created in setUp
Removes unneeded calls to Git.wrap in test cases where a valid
Git object already exists as an instance variable.

Change-Id: Id0e032d7886dfa6a3288321503a02743413f707d
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 21:06:35 -08:00
Kevin Sawicki 9e4b4fc41c Set person and message on stash ref update
This will be the message and person used for the commit
of stashed working directory changes.

Bug: 372884
Change-Id: I2501b080f6b94e826cf7dba3fd526ae5c1d969d1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 20:59:44 -08:00
Kevin Sawicki 9908c203a5 Support insteadOf and pushInsteadOf URL replacement
Bug: 346873
Change-Id: I4116328f93f411da56a633bc32fd064b2ac083f2
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-05 20:46:26 -08:00
Chris Aniszczyk db29665e64 Merge "Quickfix for AutoCRLF handling" 2012-03-05 23:44:45 -05:00
Tomasz Zarna eedd77a97b RawText#getEOL() does the same thing as RawText#getLineDelimiter()
The duplication has been introduced when merging
I08e1369e142bb19f42a8d7bbb5a7d062cc8533fc and
I18adc63596f4657516ccc6d704a561924c79d445. The former should have been
manually rebased. It also missed a copyright update in ApplyCommandTest.

Change-Id: I18fe6108220f964524fb16b719604222aa7abee6
2012-03-05 12:59:10 +01:00
Tomasz Zarna 92f90eb229 Add ApplyCommand to JGit API
Bug: 361548
CQ: 6243
Change-Id: I08e1369e142bb19f42a8d7bbb5a7d062cc8533fc
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-03-04 21:29:01 -08:00
Robin Rosenberg 88fe2836ed Quickfix for AutoCRLF handling
CRLF only works for small files, where small is the size of the
buffer, i.e. about 8K. This QD fix reallocates the buffer to be
large enough.

Bug: 369780
Change-Id: Ifc34ad204fbf5986b257a5c616e4a8c601e8261a
2012-03-03 08:22:48 +01:00
Tomasz Zarna 9c7371a8c4 Allow to get end-of-line characters for a RawText
Bug: 370320
Change-Id: I18adc63596f4657516ccc6d704a561924c79d445
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-03-02 12:06:09 -08:00
Sascha Scholz a1f877e312 Load .gitmodules config before adding values to it
This prevents existing entries from being cleared when the
.gitmodules config is saved after the new submodule configuration
is added.

Change-Id: I66841f5e758a7527e2e6e25cf1318e5fea91a909
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-03-02 09:31:09 -08:00
Dave Borowitz 1f2022e3a7 Modify refs in UploadPack/ReceivePack using a hook interface
This is intended to replace the RefFilter interface (but does not yet,
for backwards compatibility). That interface required lots of extra
scanning and copying in filter cases such as only advertising a subtree
of the refs directory. Instead, provide a hook that can be executed
right before ref advertisement, using the public methods on
UploadPack/ReceivePack to explicitly set the map of advertised refs.

Change-Id: I0067019a191c8148af2cfb71a675f2258c5af0ca
2012-02-29 19:09:23 -08:00
Kevin Sawicki 4de8a84671 Add command support for applying a stashed commit
Applies the changes in a stashed commit to the local working
directory and index

Bug: 309355
Change-Id: I9fd5ede8affc7f0060ffa7c5cec34573b6fa2b1b
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-02-28 13:53:13 -08:00
Kevin Sawicki 03d4dc597e Add support for creating a stashed commit
Adds a new command to stash the index and working directory
changes in a commit stored in refs/stash

Bug: 309355
Change-Id: I2ce85b1601b74b07e286a3f99feb358dfbdfe29c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-02-28 13:46:35 -08:00
Kevin Sawicki 10c0b34b88 Add all paths option to CheckoutCommand
This will perform the equivalent  of running a
'git checkout -- .' at the root of a repository

Change-Id: I3e2dd563700999bc063effdd3640499c8ed08136
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-26 16:10:57 +01:00
Stefan Lay 54f23873d6 Add support for autosetuprebase to the CloneCommand
Bug: 345536
Change-Id: I93c609235dec4e5e3a2ddc275c28b202bf868d40
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-02-23 09:32:02 -08:00
Marc Strapetz 7df17e57d4 EolCanonicalizingInputStream: binary detection should be optional
EolCanonicalizingInputStream may also be used in combination with
.gitattributes. If .gitattributes states that a file is of type text, line
endings have to be canonicalized even if the actual file content seems
to be binary.

Change-Id: Ie4ccdfc5cb91fbd55e06f51146cf5c7c84b8e18b
2012-02-21 15:22:36 +01:00
Matthias Sohn 755dfdb409 Prepare 2.0.0-SNAPSHOT builds
Change-Id: I946e315af04227727ac937ebe9d70ae1ea4e8936
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:49:49 +01:00
Matthias Sohn f70b24a601 Prepare post 1.3.0.201202151440-r build
Change-Id: I4d695273e3151c22f2df9a58725cc7ba21ab6043
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:42:34 +01:00
Matthias Sohn e4ee677dea JGit 1.3.0.201202151440-r
Change-Id: I663208919f297836a9c16bf458e4a43ffaca4c12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-15 20:56:06 +01:00
Christian Halstrick ed7b322186 Generate conflicts and index updates on file mode changes
Handle more cases for file mode changes. Especially make sure that the
following cases are handled correctly.

Case 1)

  An entry in the working tree, HEAD tree, and merge tree have
  different modes and different content.

  Prior Outcome:
    Dirty working tree content is replaced and file mode
    changes are lost.

  New Outcome:
    Conflict is generated.

Case 2)

  An entry in the index and merge tree have the same content
  but different modes but both modes are file type modes.

  Prior Outcome:
    File mode in working tree is not updated and the working
    directory is dirty.

  New Outcome:
    Index is updated and the working directory is clean.

Bug: 363772
Change-Id: I224602d68228eb419813986807f1eeab77e9c302
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Also-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 09:39:05 +01:00
Matthias Sohn 3b358ce514 Prepare post 1.3.0.201202121842-rc4 builds
Change-Id: I50e0e6c2bccab5f3da62cbfe976f065169426906
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 07:30:00 +01:00
Matthias Sohn 53917539f8 JGit 1.3.0.201202121842-rc4
Change-Id: I82c6c0c175ab6fb4e2113101f36c8d2ddf4a13c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 00:57:43 +01:00
Kevin Sawicki 2f79cf9900 Support gitdir references in working tree .git file
A '.git' file in a repository's working tree root is now parsed
as a ref to a folder located elsewhere.  This supports submodules
having their repository location outside of the parent repository's
working directory such as in the parent repository's '.git/modules'
directory.

This adds support to BaseRepositoryBuilder for repositories created
with the '--separate-git-dir' option specified to 'git init'.

Change-Id: I73c538f6d845bdbc0c4e2bce5a77f900cf36e1a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-08 23:10:28 +01:00
Kevin Sawicki 7bde08e1d4 Support committing submodule updates
Use the submodule object id provided by the working
tree iterator

Change-Id: Ibf82f56c04cb9c91b2b309cf0cfa3f638539e23c
2012-01-30 13:37:40 -08:00