{"action":"created","comment":{"url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/comments/32843512","id":32843512,"diff_hunk":"@@ -0,0 +1,138 @@\n+use std::marker;\n+use std::mem;\n+use libc::c_uint;\n+\n+use {raw, Object, FileFavor};\n+use util::Binding;\n+use call::Convert;\n+\n+/// annotated commits, the input to merge and rebase\n+pub struct AnnotatedCommit<'repo> {\n+    raw: *mut raw::git_annotated_commit,\n+    _marker: marker::PhantomData<Object<'repo>>,\n+}\n+\n+/// merge options\n+// modeled after DiffFindOptions\n+pub struct MergeOptions {\n+    raw: raw::git_merge_options,\n+}\n+\n+impl MergeOptions {\n+    /// Creates a default set of merge options.\n+    pub fn new() -> MergeOptions {\n+        let mut opts = MergeOptions {\n+            raw: unsafe { mem::zeroed() },\n+        };\n+        assert_eq!(unsafe {\n+            raw::git_merge_init_options(&mut opts.raw, 1)\n+        }, 0);\n+        opts\n+    }\n+\n+    /// Detect file renames\n+    pub fn find_renames(&mut self, find: bool) -> &mut MergeOptions {\n+        if find {\n+            self.raw.tree_flags |= raw::GIT_MERGE_TREE_FIND_RENAMES;\n+        } else {\n+            self.raw.tree_flags &= !raw::GIT_MERGE_TREE_FIND_RENAMES;\n+        }\n+        self\n+    }\n+\n+    /// Similarity to consider a file renamed (default 50)\n+    pub fn rename_threshold(&mut self, thresh: u32) -> &mut MergeOptions {\n+        self.raw.rename_threshold = thresh;\n+        self\n+    }\n+\n+    ///  Maximum similarity sources to examine for renames (default 200).\n+    /// If the number of rename candidates (add / delete pairs) is greater than this value,\n+    /// inexact rename detection is aborted. This setting overrides the `merge.renameLimit`\n+    /// configuration value.\n+    pub fn target_limit(&mut self, limit: u32) -> &mut MergeOptions {\n+        self.raw.target_limit = limit as c_uint;\n+        self\n+    }\n+\n+    /// Specify a side to favor for resolving conflicts\n+    pub fn file_favor(&mut self, favor: FileFavor) -> &mut MergeOptions {\n+        self.raw.file_favor = favor.convert();\n+        self\n+    }\n+\n+    fn flag(&mut self, opt: u32, val: bool) -> &mut MergeOptions {\n+        if val {\n+            self.raw.file_flags |= opt;\n+        } else {\n+            self.raw.file_flags &= !opt;\n+        }\n+        self\n+    }\n+\n+    /// Create standard conflicted merge files\n+    pub fn standard_style(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_STYLE_MERGE, find)\n+    }\n+\n+    /// Create diff3-style file\n+    pub fn diff3_style(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_STYLE_DIFF3, find)\n+    }\n+\n+    /// Condense non-alphanumeric regions for simplified diff file\n+    pub fn simplify_alnum(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_SIMPLIFY_ALNUM, find)\n+    }\n+\n+    /// Ignore all whitespace\n+    pub fn ignore_whitespace(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE, find)\n+    }\n+\n+    /// Ignore changes in amount of whitespace\n+    pub fn ignore_whitespace_change(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE, find)\n+    }\n+\n+    /// Ignore whitespace at end of line\n+    pub fn ignore_whitespace_eol(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL, find)\n+    }\n+\n+    /// Use the \"patience diff\" algorithm\n+    pub fn patience(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_DIFF_PATIENCE, find)\n+    }\n+\n+    /// Take extra time to find minimal diff\n+    pub fn minimal(&mut self, find: bool) -> &mut MergeOptions {\n+        self.flag(raw::GIT_MERGE_FILE_DIFF_MINIMAL, find)\n+    }\n+\n+    /// Acquire a pointer to the underlying raw options.\n+    ///\n+    /// This function is unsafe as the pointer is only valid so long as this\n+    /// structure is not moved, modified, or used elsewhere.\n+    // modeled after DiffOptions.raw()","path":"src/merge.rs","position":117,"original_position":117,"commit_id":"eaa9f695417e0c4bf3e2b330a1dc41d6d4a1d8ca","original_commit_id":"eaa9f695417e0c4bf3e2b330a1dc41d6d4a1d8ca","user":{"login":"tksfz","id":507497,"avatar_url":"https://avatars.githubusercontent.com/u/507497?v=3","gravatar_id":"","url":"https://api.github.com/users/tksfz","html_url":"https://github.com/tksfz","followers_url":"https://api.github.com/users/tksfz/followers","following_url":"https://api.github.com/users/tksfz/following{/other_user}","gists_url":"https://api.github.com/users/tksfz/gists{/gist_id}","starred_url":"https://api.github.com/users/tksfz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tksfz/subscriptions","organizations_url":"https://api.github.com/users/tksfz/orgs","repos_url":"https://api.github.com/users/tksfz/repos","events_url":"https://api.github.com/users/tksfz/events{/privacy}","received_events_url":"https://api.github.com/users/tksfz/received_events","type":"User","site_admin":false},"body":"Ok, I noticed other raw() methods were doing the same thing.  I'll remove all of it except for the first line.","created_at":"2015-06-19T16:09:56Z","updated_at":"2015-06-19T16:09:56Z","html_url":"https://github.com/alexcrichton/git2-rs/pull/74#discussion_r32843512","pull_request_url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/comments/32843512"},"html":{"href":"https://github.com/alexcrichton/git2-rs/pull/74#discussion_r32843512"},"pull_request":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74","id":37718941,"html_url":"https://github.com/alexcrichton/git2-rs/pull/74","diff_url":"https://github.com/alexcrichton/git2-rs/pull/74.diff","patch_url":"https://github.com/alexcrichton/git2-rs/pull/74.patch","issue_url":"https://api.github.com/repos/alexcrichton/git2-rs/issues/74","number":74,"state":"open","locked":false,"title":"Add bindings for git_merge()","user":{"login":"tksfz","id":507497,"avatar_url":"https://avatars.githubusercontent.com/u/507497?v=3","gravatar_id":"","url":"https://api.github.com/users/tksfz","html_url":"https://github.com/tksfz","followers_url":"https://api.github.com/users/tksfz/followers","following_url":"https://api.github.com/users/tksfz/following{/other_user}","gists_url":"https://api.github.com/users/tksfz/gists{/gist_id}","starred_url":"https://api.github.com/users/tksfz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tksfz/subscriptions","organizations_url":"https://api.github.com/users/tksfz/orgs","repos_url":"https://api.github.com/users/tksfz/repos","events_url":"https://api.github.com/users/tksfz/events{/privacy}","received_events_url":"https://api.github.com/users/tksfz/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-15T18:07:26Z","updated_at":"2015-06-19T16:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"662fcccd7ac93646879282371daec7cd5af92396","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74/commits","review_comments_url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74/comments","review_comment_url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexcrichton/git2-rs/issues/74/comments","statuses_url":"https://api.github.com/repos/alexcrichton/git2-rs/statuses/eaa9f695417e0c4bf3e2b330a1dc41d6d4a1d8ca","head":{"label":"tksfz:feature/merge","ref":"feature/merge","sha":"eaa9f695417e0c4bf3e2b330a1dc41d6d4a1d8ca","user":{"login":"tksfz","id":507497,"avatar_url":"https://avatars.githubusercontent.com/u/507497?v=3","gravatar_id":"","url":"https://api.github.com/users/tksfz","html_url":"https://github.com/tksfz","followers_url":"https://api.github.com/users/tksfz/followers","following_url":"https://api.github.com/users/tksfz/following{/other_user}","gists_url":"https://api.github.com/users/tksfz/gists{/gist_id}","starred_url":"https://api.github.com/users/tksfz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tksfz/subscriptions","organizations_url":"https://api.github.com/users/tksfz/orgs","repos_url":"https://api.github.com/users/tksfz/repos","events_url":"https://api.github.com/users/tksfz/events{/privacy}","received_events_url":"https://api.github.com/users/tksfz/received_events","type":"User","site_admin":false},"repo":{"id":37290014,"name":"git2-rs","full_name":"tksfz/git2-rs","owner":{"login":"tksfz","id":507497,"avatar_url":"https://avatars.githubusercontent.com/u/507497?v=3","gravatar_id":"","url":"https://api.github.com/users/tksfz","html_url":"https://github.com/tksfz","followers_url":"https://api.github.com/users/tksfz/followers","following_url":"https://api.github.com/users/tksfz/following{/other_user}","gists_url":"https://api.github.com/users/tksfz/gists{/gist_id}","starred_url":"https://api.github.com/users/tksfz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tksfz/subscriptions","organizations_url":"https://api.github.com/users/tksfz/orgs","repos_url":"https://api.github.com/users/tksfz/repos","events_url":"https://api.github.com/users/tksfz/events{/privacy}","received_events_url":"https://api.github.com/users/tksfz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tksfz/git2-rs","description":"libgit2 bindings for Rust","fork":true,"url":"https://api.github.com/repos/tksfz/git2-rs","forks_url":"https://api.github.com/repos/tksfz/git2-rs/forks","keys_url":"https://api.github.com/repos/tksfz/git2-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tksfz/git2-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tksfz/git2-rs/teams","hooks_url":"https://api.github.com/repos/tksfz/git2-rs/hooks","issue_events_url":"https://api.github.com/repos/tksfz/git2-rs/issues/events{/number}","events_url":"https://api.github.com/repos/tksfz/git2-rs/events","assignees_url":"https://api.github.com/repos/tksfz/git2-rs/assignees{/user}","branches_url":"https://api.github.com/repos/tksfz/git2-rs/branches{/branch}","tags_url":"https://api.github.com/repos/tksfz/git2-rs/tags","blobs_url":"https://api.github.com/repos/tksfz/git2-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tksfz/git2-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tksfz/git2-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tksfz/git2-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tksfz/git2-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/tksfz/git2-rs/languages","stargazers_url":"https://api.github.com/repos/tksfz/git2-rs/stargazers","contributors_url":"https://api.github.com/repos/tksfz/git2-rs/contributors","subscribers_url":"https://api.github.com/repos/tksfz/git2-rs/subscribers","subscription_url":"https://api.github.com/repos/tksfz/git2-rs/subscription","commits_url":"https://api.github.com/repos/tksfz/git2-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tksfz/git2-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tksfz/git2-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tksfz/git2-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tksfz/git2-rs/contents/{+path}","compare_url":"https://api.github.com/repos/tksfz/git2-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tksfz/git2-rs/merges","archive_url":"https://api.github.com/repos/tksfz/git2-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tksfz/git2-rs/downloads","issues_url":"https://api.github.com/repos/tksfz/git2-rs/issues{/number}","pulls_url":"https://api.github.com/repos/tksfz/git2-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/tksfz/git2-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/tksfz/git2-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tksfz/git2-rs/labels{/name}","releases_url":"https://api.github.com/repos/tksfz/git2-rs/releases{/id}","created_at":"2015-06-11T22:42:25Z","updated_at":"2015-06-11T22:42:26Z","pushed_at":"2015-06-15T18:28:26Z","git_url":"git://github.com/tksfz/git2-rs.git","ssh_url":"git@github.com:tksfz/git2-rs.git","clone_url":"https://github.com/tksfz/git2-rs.git","svn_url":"https://github.com/tksfz/git2-rs","homepage":"http://alexcrichton.com/git2-rs","size":3264,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"alexcrichton:master","ref":"master","sha":"9d765464bd708bab94fc48ba8d60c48d546c113f","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"repo":{"id":22531552,"name":"git2-rs","full_name":"alexcrichton/git2-rs","owner":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexcrichton/git2-rs","description":"libgit2 bindings for Rust","fork":false,"url":"https://api.github.com/repos/alexcrichton/git2-rs","forks_url":"https://api.github.com/repos/alexcrichton/git2-rs/forks","keys_url":"https://api.github.com/repos/alexcrichton/git2-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexcrichton/git2-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexcrichton/git2-rs/teams","hooks_url":"https://api.github.com/repos/alexcrichton/git2-rs/hooks","issue_events_url":"https://api.github.com/repos/alexcrichton/git2-rs/issues/events{/number}","events_url":"https://api.github.com/repos/alexcrichton/git2-rs/events","assignees_url":"https://api.github.com/repos/alexcrichton/git2-rs/assignees{/user}","branches_url":"https://api.github.com/repos/alexcrichton/git2-rs/branches{/branch}","tags_url":"https://api.github.com/repos/alexcrichton/git2-rs/tags","blobs_url":"https://api.github.com/repos/alexcrichton/git2-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexcrichton/git2-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexcrichton/git2-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexcrichton/git2-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexcrichton/git2-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/alexcrichton/git2-rs/languages","stargazers_url":"https://api.github.com/repos/alexcrichton/git2-rs/stargazers","contributors_url":"https://api.github.com/repos/alexcrichton/git2-rs/contributors","subscribers_url":"https://api.github.com/repos/alexcrichton/git2-rs/subscribers","subscription_url":"https://api.github.com/repos/alexcrichton/git2-rs/subscription","commits_url":"https://api.github.com/repos/alexcrichton/git2-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexcrichton/git2-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexcrichton/git2-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexcrichton/git2-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexcrichton/git2-rs/contents/{+path}","compare_url":"https://api.github.com/repos/alexcrichton/git2-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexcrichton/git2-rs/merges","archive_url":"https://api.github.com/repos/alexcrichton/git2-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexcrichton/git2-rs/downloads","issues_url":"https://api.github.com/repos/alexcrichton/git2-rs/issues{/number}","pulls_url":"https://api.github.com/repos/alexcrichton/git2-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/alexcrichton/git2-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/alexcrichton/git2-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexcrichton/git2-rs/labels{/name}","releases_url":"https://api.github.com/repos/alexcrichton/git2-rs/releases{/id}","created_at":"2014-08-01T22:30:49Z","updated_at":"2015-06-16T15:29:37Z","pushed_at":"2015-06-19T15:17:15Z","git_url":"git://github.com/alexcrichton/git2-rs.git","ssh_url":"git@github.com:alexcrichton/git2-rs.git","clone_url":"https://github.com/alexcrichton/git2-rs.git","svn_url":"https://github.com/alexcrichton/git2-rs","homepage":"http://alexcrichton.com/git2-rs","size":5535,"stargazers_count":64,"watchers_count":64,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":43,"mirror_url":null,"open_issues_count":3,"forks":43,"open_issues":3,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74"},"html":{"href":"https://github.com/alexcrichton/git2-rs/pull/74"},"issue":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/issues/74"},"comments":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/alexcrichton/git2-rs/statuses/eaa9f695417e0c4bf3e2b330a1dc41d6d4a1d8ca"}}}}