Commit Graph

61 Commits

Author SHA1 Message Date
Chris Eidhof
225f391171 Fetching remotes 2017-12-16 15:06:54 +01:00
Matt Diephouse
c7bf00201e Remove trailing whitespace 2017-12-15 15:02:34 -05:00
Matt Diephouse
09ac23471b Fix build with Xcode 9.2 2017-12-14 15:08:17 -05:00
Jake Van Alstyne
5d0255b84c Merge branch 'master' into create-new-repository 2017-08-09 14:01:22 -06:00
Jake Van Alstyne 🎩
7ecfb710d3 rename createAt to be in line with modern swift coding style and add a test 2017-08-09 13:58:55 -06:00
Arnon Keereena
8d1aaa672f Changing from using if to evaluates returned enum
to switch case syntax instead
2017-05-04 22:41:32 +02:00
Arnon Keereena
9520fa03a6 Adjust weird indentation 2017-05-04 09:36:02 +02:00
Arnon Keereena
c4b7ce3716 Remove branch iterator caching
Add support for sequencing to allow syntax
for commit in repo.commits(in: branch)
2017-05-04 09:33:14 +02:00
Arnon Keereena
4dd24cad97 CommitIterator now not hold branch as reference.
Make private var instead to prevent unexpected state change
from external influence. Uses enum instead of tuple
of stop and error to indicate state of Git command result.
2017-05-01 17:19:05 +02:00
Arnon Keereena
915b07f4a9 Remove warnings that causes CI to fail 2017-04-29 08:55:56 +02:00
Arnon Keereena
aa9f066e04 Passing pointer through block doesn't work as expected
turns back to normal procedural calls, iterator tested.
2017-04-28 22:19:45 +02:00
Arnon Keereena
de2984c695 Move CommitIterator to its own file, untested 2017-04-28 09:44:10 +02:00
Arnon Keereena
9eb91a8605 Add tests for modified code.
Fix some errors.
2017-04-27 08:26:34 +02:00
Matt Rubin
5b41c977d2 Convert enum case names to lower camel case
https://swift.org/documentation/api-design-guidelines/#follow-case-conventions
2017-04-24 00:19:27 -04:00
Matt Rubin
62619af5e8 Clean up some whitespace around = operators 2016-12-23 18:09:56 -05:00
Matt Rubin
4741790d2c Wrap lines longer than 120 characters 2016-12-23 18:01:28 -05:00
Matt Rubin
baeb5cb3e2 Ignore unused closure parameters 2016-12-23 18:01:28 -05:00
Matt Rubin
a0f0e49ee6 Remove trailing whitespace on newlines 2016-12-23 17:48:54 -05:00
Matt Rubin
c746c720c3 Remove the OID argument label for object getters 2016-12-22 23:36:25 -05:00
Matt Rubin
6da9e7810c Argument labels "withName:" -> "named:" 2016-12-22 18:36:58 -05:00
Matt Rubin
b94b975236 Fix method description strings in RepositorySpec 2016-12-18 23:24:57 -05:00
Matt Rubin
afbd6672cd Rename argument labels to refer to OID parameters as "Identifiers"
https://swift.org/documentation/api-design-guidelines/#name-according-to-roles
2016-12-18 23:24:26 -05:00
Matt Rubin
93ddcd3e9a Apply API guidelines to test helper functions 2016-12-18 18:11:04 -05:00
Matt Rubin
2a90c7b5f3 Update Repository methods to match the API design guidelines 2016-12-18 18:11:04 -05:00
Matt Rubin
59cccf62d0 Replace NSURL with URL wherever possible 2016-12-17 00:35:44 -05:00
Matt Rubin
f97fcfab38 Convert source and tests to build with Swift 3 2016-12-17 00:22:08 -05:00
Tom Booth
60cb395cc6 Add cloneFromURL function
This introduces a new static function on Repository that will allow a
user to clone a local or remote repository.

At the moment only SSH in-memory, username + password and default (no
creds) are implemented.

It provides an enum wrapper around the underlying libgit2 `git_cred_t`
type to abstract it away from the user into something that is a little
more Swift-like. As much of the C callback code and struct creation has
been moved into Swift-land as well, this is now possible as of 2.*
whereas before it was not.

I had to use a wrapper class in Credentials.swift in order to convert
blocks to pointers, as blocks do not implement the AnyObject protocol
that `Unmanaged` requies.

The test requires you passing through a set of environment variables
otherwise it will not run. This is so that secret/private information
isn't leaked into the repository. The required variables are as follows:

   - SG2TestPrivateRepo - the url of the private jrepo to clone;
   - SG2TestUsername - the url of the user that will be connecting;
   - SG2TestPublicKey - the public key data to be used;
   - SG2TestPrivateKey - the private key data;
   - SG2TestPassphrase - passphrase needed to use the private key (blank
     if none).
2016-04-07 14:50:38 +01:00
Tom Booth
281d1aed2b Fix EXC_BAD_ACCESS when progress updates
Previously when a block was passed into checkout() it would be copied
but then the memory would be freed as nothing had retained a reference
to the copy. This meant that when block() was called in
SG2CheckoutProgressCallback() it would crash due to an attempt to
execute a random chunk of memory that previously contained the block.

This code now retains the payload after copying it.
2016-03-03 16:30:26 +00:00
Markos Charatzas
5c8a6000c4 updated to Swift 2.0
updated to Xcode 7.2 recommended settings
integrated with Nimble (v3.0.0), Quick (v0.8.0), Result (1.0.1)
integrated with Guanaco (5031bf67297afbe61ac0f2fbf3e3e8400b3f8888) that supports Swift 2.0
2016-01-16 14:57:32 +00:00
Matt Diephouse
03032d0074 Switch from LlamaKit to antitypical/Result 2015-04-15 21:32:10 -04:00
Matt Diephouse
bfe2d6d053 Add checkout strategies 2015-04-02 21:01:44 -04:00
Matt Diephouse
b2a8bf6f0b Add the basics of checkout 2015-03-14 20:14:35 -04:00
Matt Diephouse
b6822f40e6 Be more Swifty in test descriptions 2015-03-09 17:42:44 -04:00
Brian Gesiak
186b5aadc9 .gitmodules: Xcode 6.3b2 updates
- Update submodules to eliminate new warnings, errors in Xcode 6.3b2.
- COpaquePointer.null() no longer available; instantiate with nil literal
  instead.
- Fix warning when chaining optionals and optional casts.
2015-03-07 12:43:38 -05:00
Matt Diephouse
2d0c0765fc Add Repository.HEAD() 2015-03-07 12:43:37 -05:00
Brian Gesiak
ba9a951b62 Support Swift 1.2
- Update Guanaco, LlamaKit, Nimble, and Quick to versions that support
  Swift 1.2.
- Update Xcode project and scheme files for "latest Xcode version"
  parameters.
- Use Swift 1.2's new fallible casts for casts that may fail at runtime.
2015-02-21 21:28:43 -05:00
Brian Gesiak
f23f98f033 Repository: Return libgit2 errors for failures
- Update Guanaco for improved matching on failures,
  i.e.: `haveFailed(beAnError(domain: match("abc")))`.
- All functions that return Result objects now return sane errors for
  failure cases.
- Unit tests verify libgit2 error is domain is used for most failures.
2015-02-20 01:52:39 -05:00
Brian Gesiak
dd7d49a545 Errors: Use public constant for libgit2 domain 2015-02-19 13:38:05 -05:00
Brian Gesiak
17022d69d8 Repository: Propagate libgit2 errors
Instead of returning the default LlamaKit error, return the underlying
libgit2 error when Repository.atURL fails.
2015-02-19 13:37:38 -05:00
Brian Gesiak
1019a94d53 .gitmodules: Update LlamaKit to v0.5.0
This is the first of a series of commits intended to resolve issue #10,
which calls for proper error handling.

One way to test that libgit2 error messages are being propagated through
Result failures is by asserting that the error's description or code
match the message or code we expect. In order to do so, LlamaKit's
ErrorType is unweildy, and not future-proof--it would be easier and
safer to write assertions based on NSError.

Upgrade LlamaKit to v0.5.0, the latest version that supports Swift 1.1,
in order to define results as type `Result<T, NSError>`.
2015-02-17 22:18:51 -05:00
Matt Diephouse
910b9b35d2 Implement remoteBranches() 2015-02-14 12:50:01 -05:00
Matt Diephouse
935121e0db Implement remoteBranchWithName() 2015-02-14 12:24:22 -05:00
Matt Diephouse
4acd80918f Implement allTags() 2015-02-14 12:13:18 -05:00
Matt Diephouse
4b0823918d Implement localBranches() 2015-02-14 12:04:08 -05:00
Matt Diephouse
411b23cbbe Implement tagWithName() 2015-02-14 11:33:03 -05:00
Matt Diephouse
4a0bcede38 Make referenceWithName return a ReferenceType 2015-02-14 11:30:04 -05:00
Matt Diephouse
a8cc3144c4 Implement localBranchWithName() 2015-02-13 15:36:58 -05:00
Matt Diephouse
dc48554f71 Implement referenceWithName() 2015-01-30 15:55:09 -05:00
Matt Diephouse
6e4f7358de Fix up indentation 2015-01-12 12:35:11 -08:00
Matt Diephouse
8b92b6f9ca Implement objectWithOID 2015-01-11 14:19:04 -08:00