Commit Graph

44 Commits

Author SHA1 Message Date
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
Matt Diephouse
ec0ea6e0bd This test isn't crashing swift anymore :-/ 2015-01-11 10:27:30 -08:00
Matt Diephouse
4a0b5cd838 Add Remotes 2015-01-03 09:43:42 -05:00
Matt Diephouse
52d1a2e9f7 Look up objects from Pointers 2014-12-23 17:30:16 -10:00
Matt Diephouse
146813826f Look up objects from PointerTos 2014-12-23 15:06:59 -10:00
Matt Diephouse
931b6e6768 Add a Tag struct 2014-12-10 15:21:06 -05:00
Matt Diephouse
d0be6179b9 Add a Blob struct 2014-12-08 23:28:34 -05:00
Matt Diephouse
7ef1b5337c Add a Tree struct 2014-12-06 23:17:08 -05:00
Matt Diephouse
cfe199bc94 Add parens to describe description 2014-12-05 23:36:26 -05:00
Matt Diephouse
b4dac5a6be Look up commits in the repository 2014-12-05 15:27:35 -05:00
Matt Diephouse
b5673e8620 Actually load a repository 2014-11-17 00:31:33 -05:00
Matt Diephouse
26efaf67c3 Use Quick and Nimble 2014-11-07 17:11:47 -05:00