Coder Social home page Coder Social logo

gift's Issues

StatusDeltaOptions should create a git_strarray for the given paths

StatusDeltaOptions takes an array of paths when initialized. This is a list of path or path patterns to files that should be included in the status delta enumeration. However, these paths are not passed to libgit2--thus any paths specified by the user are ignored.

Were Gift to allocate unsafe pointers to those paths, to be used by git_strarray, those pointers would have to be freed after they are no longer needed. Gift doesn't have a good way to ensure those pointers are freed yet.

``rake dependencies build`` fails

rake dependencies build is broken on my Mac. I haven't tried to debug it yet.

Just a git clone and then rake dependencies build.

[ 96%] Building C object CMakeFiles/git2.dir/src/unix/map.c.o
[ 97%] Building C object CMakeFiles/git2.dir/src/unix/realpath.c.o
[ 98%] Building C object CMakeFiles/git2.dir/deps/http-parser/http_parser.c.o
[ 99%] Building C object CMakeFiles/git2.dir/src/hash/hash_generic.c.o
In file included from /Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:10:
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.h:13:8: error: redefinition of 'git_hash_ctx'
struct git_hash_ctx {
       ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_common_crypto.h:15:8: note: previous definition is here
struct git_hash_ctx {
       ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:121:11: error: no member named 'H' in 'struct git_hash_ctx'
        A = ctx->H[0];
            ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:122:11: error: no member named 'H' in 'struct git_hash_ctx'
        B = ctx->H[1];
            ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:123:11: error: no member named 'H' in 'struct git_hash_ctx'
        C = ctx->H[2];
            ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:124:11: error: no member named 'H' in 'struct git_hash_ctx'
        D = ctx->H[3];
            ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:125:11: error: no member named 'H' in 'struct git_hash_ctx'
        E = ctx->H[4];
            ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:217:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[0] += A;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:218:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[1] += B;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:219:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[2] += C;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:220:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[3] += D;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:221:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[4] += E;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:224:5: error: redefinition of 'git_hash_init'
int git_hash_init(git_hash_ctx *ctx)
    ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_common_crypto.h:23:17: note: previous definition is here
GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx)
                ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:226:7: error: no member named 'size' in 'struct git_hash_ctx'
        ctx->size = 0;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:229:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[0] = 0x67452301;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:230:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[1] = 0xefcdab89;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:231:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[2] = 0x98badcfe;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:232:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[3] = 0x10325476;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:233:7: error: no member named 'H' in 'struct git_hash_ctx'
        ctx->H[4] = 0xc3d2e1f0;
        ~~~  ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_generic.c:238:5: error: redefinition of 'git_hash_update'
int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
    ^
/Users/erg/sedit/deps/Gift/External/libgit2/src/hash/hash_common_crypto.h:30:17: note: previous definition is here
GIT_INLINE(int) git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
/*
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/git2.dir/src/hash/hash_generic.c.o] Error 1
make[1]: *** [CMakeFiles/git2.dir/all] Error 2
make: *** [all] Error 2
rake aborted!
RAKE TASK FAILED:         mkdir -p External/libgit2/build && \
        cd External/libgit2/build && \
        cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_CLAR:BOOL=OFF -DTHREADSAFE:BOOL=ON ..
        cmake --build .
/Users/erg/sedit/deps/Gift/Scripts/helpers.rb:3:in `run'
Scripts/build_osx.rake:22:in `block (3 levels) in <top (required)>'
Tasks: TOP => build => build:osx => build:osx:libgit2
(See full trace by running task with --trace)

Linker flags to brew installed libraries

I just installed libssl, and my version is different from the version specified in the project file.

Here's some output from the changes I made to Gift.xcodeproj/project.pbxproj

-                                       /usr/local/Cellar/openssl/1.0.1l/lib/libssl.a,
-                                       /usr/local/Cellar/openssl/1.0.1l/lib/libcrypto.a,
+                                       /usr/local/Cellar/openssl/1.0.1j_1/lib/libssl.a,
+                                       /usr/local/Cellar/openssl/1.0.1j_1/lib/libcrypto.a,

More features!

Gift already includes all of the infrastructure needed to wrap libgit2 in clean Swift functions, as well as all the test infrastructure needed to test those wrappers. Huzzah!

But it could use some more features. Using Gift, I should be able to (in descending order of importance/difficulty):

  • Tag a particular commit
  • List all branches in a repository
  • Commit changes in a repository
  • Merge changes into a branch from another branch
  • Retrieve the name of the author of the last commit in a repository
  • Checkout a particular reference in a repository
  • Add and remove a remote repository, i.e.: git remote add and git remote rm
  • Fetch from a remote repository
  • Reset changes in a repository, i.e.: git reset
  • Run git blame on a particular file in a repository
  • Run git stash save and git stash apply on a working directory

The following features might be worth working on later:

  • List all tags in a repository. git_tag_foreach takes a callback function pointer to a C function--Swift doesn't make it easy to interop with such an API, so this will require writing a C function, getting a pointer to it from Swift, etc. (EDIT: It's possible to use progress callback APIs from Swift, see: dbaeace.)

Note that a "remote" repository doesn't have to be an external resource. We can fetch from remotes that exist on the local filesystem--and we should, in order to keep our tests fast!

We don't have to include all these features in the v0.1.0 release, but the more the better!

Expand CheckoutOptions

Gift allows users to specify some aspects of how a revision is checked out. But libgit2 provides even more options that Gift has yet to support. CheckoutOptions should also allow users to configure the following libgit2 git_checkout_options attributes:

  • int disable_filters, a boolean indicating whether to disable some filters, like CRLF conversion
  • unsigned int dir_mode
  • unsigned int file_mode
  • int file_open_flags
  • unsigned int notify_flags, a set of git_checkout_notify_t flags
  • git_checkout_notify_cb notify_cb, a callback fired when an event matching the flags above occurs
  • git_strarray paths, a set of paths to checkout
  • git_tree *baseline
  • const char *target_directory, an alternative checkout path for the working directory
  • const char *ancestor_label
  • const char *our_label
  • const char *their_label
  • git_checkout_perfdata_cb perfdata_cb

Expand CloneOptions

Gift allows users to specify some aspects of how a repository is cloned. But libgit2 provides even more options that Gift has yet to support. CloneOptions should also allow users to configure the following libgit2 git_clone_options attributes:

  • int bare
  • const char* checkout_branch, the name of the branch to checkout after cloning
  • git_signature *signature, the identity used when updating the reflog
  • git_repository_create_cb repository_cb
  • git_remote_create_cb remote_cb, a callback used to create the git_remote. Dependent upon #18.

Add bootstrapping script

New contributors should be able to setup the repository's dependencies in a single line on the command line--they're currently just explained (poorly) on the README.

We should consider using a Rakefile--I can stomach the script being dependent on Ruby being installed if that makes it clearer and easier to maintain.

Tests for the Rake tasks would be awesome. But is that even possible?

Swift 2 Support

I started playing around with updating Gift for Swift 2, and was wondering if there has been any work towards this elsewhere? I don't see any branches for it.

One question that I have is what the best course of action would be with regards to error handling. It appears that LlamaKit has been subsumed into the Result project, but Swift 2 also has native error handling capabilities now. Is the Result approach with an Either type preferred, or Swift's own native error handling going forward?

I'd be willing to put some work into this, but don't want to head down a path that isn't the preferred approach.

Add continuous integration script

Contributors should be able to ensure all tests pass before submitting a pull request. Once the repository is made public, Travis CI will use this script to test the repository.

For an example, see Quick's test script.

As I mentioned in #4, I think this should be in a Rakefile or something equally easy to maintain.

Expand RepositoryInitializationOptions

Gift allows users to specify how a repository should be initialized. But libgit2 provides even more callbacks that Gift has yet to support. RepositoryInitializationOptions should also allow users to configure the following libgit2 git_repository_init_options attributes:

  • const char *workdir_path
  • const char *description
  • const char *template_path
  • const char *initial_head
  • const char *origin_url

Support git_blame_file

I want to be able to get the blame information for a file in a repository:

let repository = cloneRepository(NSURL(string: "git://git.libssh2.org/libssh2.git")!)
let blame: Result<Blame, NSError> = repository.flatMap { $0.blame("README.md") }

I want to be able to see who was responsible for which lines. That probably involves porting git_blame_hunk to Gift as well. Not sure what the API for that should look like, but suggestions welcome!

Eradicate TODOs

Most of the TODOs in the project right now are for missing documentation. Remove all TODOs, either by resolving them or by creating a GitHub issue to track it.

Support remotes

libgit2 defined a git_remote struct, which is something Gift has no notion of. Port git_remote to Gift in order to support remote operations, like fetching from and pushing to a remote repository.

Support stashing

I want to be able to stash uncommitted changes:

let repository = openRepository(NSURL(fileURLWithPath: "/Users/modocache/Desktop/MyRepo")!)
let index = repository.flatMap { $0.index }
let commit = index.flatMap { $0.stash(message: "Saving some work for another day") }

I'd also like to be able to apply stashed changes somehow. Not sure what that API should look like yet, but suggestions welcome!

Expand RemoteCallbacks

Gift allows users to specify callbacks that should be executed when performing remote operations, such as a clone or push. But libgit2 provides even more callbacks that Gift has yet to support. RemoteCallbacks should also allow users to specify the following libgit2 git_remote_callbacks callbacks:

  • git_cred_acquire_cb credentials, used when the remote requires authentication.
  • git_transport_certificate_check_cb certificate_check, used to determine whether an unauthenticated connection should proceed
  • int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data), fired whenever a local reference is updated by the remote operation
  • git_packbuilder_progress pack_progress, provides progress information on packing
  • git_push_transfer_progress push_transfer_progress, provides progress information on pushing
  • int (*push_update_reference)(const char *refname, const char *status, void *data), called when references are updated due to a push

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.