GitHub PullRequestReviewCommentEvent at 2014-08-04 16:30:54
Repository: libgit2
Actor: carlosmn
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/15764980","id":15764980,"diff_hunk":"@@ -0,0 +1,152 @@\n+/*\n+ * Copyright (C) the libgit2 contributors. All rights reserved.\n+ *\n+ * This file is part of libgit2, distributed under the GNU GPL v2 with\n+ * a Linking Exception. For full terms see the included COPYING file.\n+ */\n+#ifndef INCLUDE_git_rebase_h__\n+#define INCLUDE_git_rebase_h__\n+\n+#include \"common.h\"\n+#include \"types.h\"\n+#include \"oid.h\"\n+\n+/**\n+ * @file git2/rebase.h\n+ * @brief Git rebase routines\n+ * @defgroup git_rebase Git merge routines\n+ * @ingroup Git\n+ * @{\n+ */\n+GIT_BEGIN_DECL\n+\n+typedef struct {\n+\tunsigned int version;\n+\n+\t/**\n+\t * Provide a quiet rebase experience; unused by libgit2 but provided for\n+\t * interoperability with other clients.\n+\t */\n+\tint quiet;\n+\n+\t/**\n+\t * Canonical name of the notes reference used to rewrite notes for\n+\t * rebased commits when finishing the rebase; if NULL, the contents of\n+\t * the coniguration option `notes.rewriteRef` is examined, unless the\n+\t * configuration option `notes.rewrite.rebase` is set to false.  If\n+\t * `notes.rewriteRef` is NULL, notes will not be rewritten.\n+\t */\n+\tconst char *rewrite_notes_ref;\n+} git_rebase_options;\n+\n+#define GIT_REBASE_OPTIONS_VERSION 1\n+#define GIT_REBASE_OPTIONS_INIT {GIT_REBASE_OPTIONS_VERSION}\n+\n+/**\n+ * Initializes a `git_rebase_options` with default values. Equivalent to\n+ * creating an instance with GIT_REBASE_OPTIONS_INIT.\n+ *\n+ * @param opts the `git_rebase_options` instance to initialize.\n+ * @param version the version of the struct; you should pass\n+ *        `GIT_REBASE_OPTIONS_VERSION` here.\n+ * @return Zero on success; -1 on failure.\n+ */\n+GIT_EXTERN(int) git_rebase_init_options(\n+\tgit_rebase_options *opts,\n+\tunsigned int version);\n+\n+/**\n+ * Sets up a rebase operation to rebase the changes in ours relative to\n+ * upstream onto another branch.\n+ *\n+ * @param repo The repository to perform the rebase\n+ * @param branch The terminal commit to rebase\n+ * @param upstream The commit to begin rebasing from, or NULL to rebase all\n+ *                 reachable commits\n+ * @param onto The branch to rebase onto, or NULL to rebase onto the given\n+ *             upstream\n+ * @param signature The signature of the rebaser\n+ * @param opts Options to specify how rebase is performed\n+ * @return Zero on success; -1 on failure.\n+ */\n+GIT_EXTERN(int) git_rebase(\n+\tgit_repository *repo,\n+\tconst git_merge_head *branch,\n+\tconst git_merge_head *upstream,\n+\tconst git_merge_head *onto,\n+\tconst git_signature *signature,\n+\tconst git_rebase_options *opts);\n+\n+/**\n+ * Applies the next patch, updating the index and working directory with the\n+ * changes.  If there are conflicts, you will need to address those before\n+ * committing the changes.\n+ *\n+ * @param repo The repository with a rebase in progress\n+ * @param checkout_opts Options to specify how the patch should be checked out\n+ * @return Zero on success; -1 on failure.\n+ */\n+GIT_EXTERN(int) git_rebase_next(\n+\tgit_repository *repo,\n+\tgit_checkout_options *checkout_opts);\n+\n+/**\n+ * Commits the current patch.  You must have resolved any conflicts that\n+ * were introduced during the patch application from the `git_rebase_next`\n+ * invocation.\n+ * \n+ * @param id Pointer in which to store the OID of the newly created commit\n+ * @param repo The repository with the in-progress rebase\n+ * @param author The author of the updated commit, or NULL to keep the\n+ *        author from the original commit\n+ * @param committer The committer of the rebase\n+ * @param message_encoding The encoding for the message in the commit,\n+ *        represented with a standard encoding name.  If message is NULL,\n+ *        this should also be NULL, and the encoding from the original\n+ *        commit will be maintained.  If message is specified, this may be\n+ *        NULL to indicate that \"UTF-8\" is to be used.\n+ * @param message The message for this commit, or NULL to keep the message\n+ *        from the original commit\n+ * @return Zero on success, GIT_EUNMERGED if there are unmerged changes in\n+ *        the index, GIT_EAPPLIED if the current commit has already\n+ *        been applied to the upstream and there is nothing to commit,\n+ *        -1 on failure.\n+ */\n+GIT_EXTERN(int) git_rebase_commit(\n+\tgit_oid *id,\n+\tgit_repository *repo,\n+\tconst git_signature *author,\n+\tconst git_signature *committer,\n+\tconst char *message_encoding,\n+\tconst char *message);\n+\n+/**\n+ * Aborts a rebase that is currently in progress, resetting the repository\n+ * and working directory to their state before rebase began.\n+ *\n+ * @param repo The repository with the in-progress rebase\n+ * @param signature The identity that is aborting the rebase\n+ * @return Zero on success; GIT_ENOTFOUND if a rebase is not in progress,\n+ *         -1 on other errors.\n+ */\n+GIT_EXTERN(int) git_rebase_abort(\n+\tgit_repository *repo,\n+\tconst git_signature *signature);\n+\n+/**\n+ * Finishes a rebase that is currently in progress once all patches have\n+ * been applied.\n+ *\n+ * @param repo The repository with the in-progress rebase\n+ * @param signature The identity that is finishing the rebase\n+ * @param opts Options to specify how rebase is finished\n+ * @param Zero on success; -1 on error\n+ */\n+GIT_EXTERN(int) git_rebase_finish(\n+\tgit_repository *repo,\n+\tconst git_signature *signature,\n+\tconst git_rebase_options *opts);","path":"include/git2/rebase.h","position":148,"original_position":148,"commit_id":"bb7155159673aa34ae1bbc0c72b4a943f41fe891","original_commit_id":"bb7155159673aa34ae1bbc0c72b4a943f41fe891","user":{"login":"carlosmn","id":335443,"avatar_url":"https://avatars.githubusercontent.com/u/335443?v=2","gravatar_id":"023e1295851b018af03706f391b76931","url":"https://api.github.com/users/carlosmn","html_url":"https://github.com/carlosmn","followers_url":"https://api.github.com/users/carlosmn/followers","following_url":"https://api.github.com/users/carlosmn/following{/other_user}","gists_url":"https://api.github.com/users/carlosmn/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmn/subscriptions","organizations_url":"https://api.github.com/users/carlosmn/orgs","repos_url":"https://api.github.com/users/carlosmn/repos","events_url":"https://api.github.com/users/carlosmn/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmn/received_events","type":"User","site_admin":false},"body":"Why do we need to pass in the rebase options if we already passed them in the init function? Is it common that one would want different options for init and for finish?","created_at":"2014-08-04T16:30:54Z","updated_at":"2014-08-04T16:30:54Z","html_url":"https://github.com/libgit2/libgit2/pull/2482#discussion_r15764980","pull_request_url":"https://api.github.com/repos/libgit2/libgit2/pulls/2482","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/15764980"},"html":{"href":"https://github.com/libgit2/libgit2/pull/2482#discussion_r15764980"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/2482"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2/pulls/2482","id":18667031,"html_url":"https://github.com/libgit2/libgit2/pull/2482","diff_url":"https://github.com/libgit2/libgit2/pull/2482.diff","patch_url":"https://github.com/libgit2/libgit2/pull/2482.patch","issue_url":"https://api.github.com/repos/libgit2/libgit2/issues/2482","number":2482,"state":"open","title":"Rebase (merge)","user":{"login":"ethomson","id":1130014,"avatar_url":"https://avatars.githubusercontent.com/u/1130014?v=2","gravatar_id":"7fdfaf0aad74fef442e2ffc9999ef9c1","url":"https://api.github.com/users/ethomson","html_url":"https://github.com/ethomson","followers_url":"https://api.github.com/users/ethomson/followers","following_url":"https://api.github.com/users/ethomson/following{/other_user}","gists_url":"https://api.github.com/users/ethomson/gists{/gist_id}","starred_url":"https://api.github.com/users/ethomson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethomson/subscriptions","organizations_url":"https://api.github.com/users/ethomson/orgs","repos_url":"https://api.github.com/users/ethomson/repos","events_url":"https://api.github.com/users/ethomson/events{/privacy}","received_events_url":"https://api.github.com/users/ethomson/received_events","type":"User","site_admin":false},"body":"This PR introduces the beginnings of rebase functionality, making use of `git_merge`, which provides compatibility with rebases that were performed using `git-rebase --merge`.\r\n\r\nThough I'm fairly happy with the API, I will call out a few stylistic questions below.  As an example, though, to perform a rebase, one would:\r\n\r\n    git_rebase(repo, branch_head, master_head, NULL, signature, NULL);\r\n\r\n    while ((error = git_rebase_next(repo, checkout_opts)) == 0)\r\n        git_rebase_commit(&commit_id, repo, NULL, signature, NULL, NULL);\r\n\r\n    if (error != GIT_ITEROVER)\r\n        die();\r\n\r\n    git_rebase_finish(repo, signature, NULL);\r\n\r\nNotes:\r\n- The default type of rebase is based around patch application.  This means that rebases that were started with git.git (without explicitly specifying the `--merge` flag) are not supported.  I have made some progress with patch application in #2280 but I put it on hold to tackle this aspect of rebase.\r\n\r\nI think that this is ready for review!","created_at":"2014-07-21T17:20:09Z","updated_at":"2014-08-04T16:30:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"467cf2e9440ae369315dbeda5eb2e81cc705202c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2/pulls/2482/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2/pulls/2482/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/libgit2/libgit2/issues/2482/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2/statuses/bb7155159673aa34ae1bbc0c72b4a943f41fe891","head":{"label":"libgit2:ed/rebase","ref":"ed/rebase","sha":"bb7155159673aa34ae1bbc0c72b4a943f41fe891","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=2","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":901662,"name":"libgit2","full_name":"libgit2/libgit2","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=2","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2","description":"The Library","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2","forks_url":"https://api.github.com/repos/libgit2/libgit2/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2/issues/comments/{number}","contents_url":"https://api.github.com/repos/libgit2/libgit2/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2/releases{/id}","created_at":"2010-09-10T16:17:48Z","updated_at":"2014-08-04T11:48:59Z","pushed_at":"2014-08-01T13:21:14Z","git_url":"git://github.com/libgit2/libgit2.git","ssh_url":"git@github.com:libgit2/libgit2.git","clone_url":"https://github.com/libgit2/libgit2.git","svn_url":"https://github.com/libgit2/libgit2","homepage":"http://libgit2.github.com","size":83464,"stargazers_count":4590,"watchers_count":4590,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":1012,"mirror_url":null,"open_issues_count":123,"forks":1012,"open_issues":123,"watchers":4590,"default_branch":"master"}},"base":{"label":"libgit2:master","ref":"master","sha":"091165c53b2bcd5d41fb71d43ed5a23a3d96bf5d","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=2","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":901662,"name":"libgit2","full_name":"libgit2/libgit2","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=2","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2","description":"The Library","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2","forks_url":"https://api.github.com/repos/libgit2/libgit2/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2/issues/comments/{number}","contents_url":"https://api.github.com/repos/libgit2/libgit2/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2/releases{/id}","created_at":"2010-09-10T16:17:48Z","updated_at":"2014-08-04T11:48:59Z","pushed_at":"2014-08-01T13:21:14Z","git_url":"git://github.com/libgit2/libgit2.git","ssh_url":"git@github.com:libgit2/libgit2.git","clone_url":"https://github.com/libgit2/libgit2.git","svn_url":"https://github.com/libgit2/libgit2","homepage":"http://libgit2.github.com","size":83464,"stargazers_count":4590,"watchers_count":4590,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":1012,"mirror_url":null,"open_issues_count":123,"forks":1012,"open_issues":123,"watchers":4590,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/2482"},"html":{"href":"https://github.com/libgit2/libgit2/pull/2482"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2/issues/2482"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2/issues/2482/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/2482/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/2482/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2/statuses/bb7155159673aa34ae1bbc0c72b4a943f41fe891"}}}}