{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/git2r/issues/381","repository_url":"https://api.github.com/repos/ropensci/git2r","labels_url":"https://api.github.com/repos/ropensci/git2r/issues/381/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/git2r/issues/381/comments","events_url":"https://api.github.com/repos/ropensci/git2r/issues/381/events","html_url":"https://github.com/ropensci/git2r/issues/381","id":415685869,"node_id":"MDU6SXNzdWU0MTU2ODU4Njk=","number":381,"title":"Diff should respect additional parameters passed to the function","user":{"login":"mardibiase","id":5766743,"node_id":"MDQ6VXNlcjU3NjY3NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/5766743?v=4","gravatar_id":"","url":"https://api.github.com/users/mardibiase","html_url":"https://github.com/mardibiase","followers_url":"https://api.github.com/users/mardibiase/followers","following_url":"https://api.github.com/users/mardibiase/following{/other_user}","gists_url":"https://api.github.com/users/mardibiase/gists{/gist_id}","starred_url":"https://api.github.com/users/mardibiase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mardibiase/subscriptions","organizations_url":"https://api.github.com/users/mardibiase/orgs","repos_url":"https://api.github.com/users/mardibiase/repos","events_url":"https://api.github.com/users/mardibiase/events{/privacy}","received_events_url":"https://api.github.com/users/mardibiase/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-02-28T15:39:12Z","updated_at":"2019-03-03T10:26:48Z","closed_at":"2019-03-03T10:23:27Z","author_association":"NONE","body":"When passing additional parameters to diff (i.e. `git_diff_options` in libgit2 API as listed [here](https://libgit2.org/libgit2/#HEAD/type/git_diff_options)) it does not consider them and it discards the options.\r\n\r\nExample:\r\n```{r}\r\nlibrary(git2r)\r\npath_git2r <- \"~/git2r/.git\" # set the appropriate folder\r\nrepo_git2r <- init(path_git2r)\r\ncommit <- lookup(repo_git2r, \"6e0e9b0\")\r\nparent_commit <- parents(commit)[[1]]\r\ntree_commit <- tree(commit)\r\ntree_parent_commit <- tree(parent_commit)\r\ncat(diff(tree_parent_commit, tree_commit, as_char = TRUE, ... = c(\"context_lines\" = 0)))\r\n```\r\n\r\nActual output:\r\n```\r\ndiff --git a/inst/AUTHORS b/inst/AUTHORS\r\nindex 5f97103..8c3c728 100644\r\n--- a/inst/AUTHORS\r\n+++ b/inst/AUTHORS\r\n@@ -50,6 +50,7 @@ Dmitry Kakurin\r\n Dmitry Kovega\r\n Emeric Fermas\r\n Emmanuel Rodriguez\r\n+Eric Myhre\r\n Florian Forster\r\n Holger Weiss\r\n Ingmar Vanhassel\r\n```\r\n\r\nExpected output:\r\n```\r\ndiff --git a/inst/AUTHORS b/inst/AUTHORS\r\nindex 5f971034..8c3c728c 100644\r\n--- a/inst/AUTHORS\r\n+++ b/inst/AUTHORS\r\n@@ -52,0 +53 @@ Emmanuel Rodriguez\r\n+Eric Myhre\r\n```"},"comment":{"url":"https://api.github.com/repos/ropensci/git2r/issues/comments/469009251","html_url":"https://github.com/ropensci/git2r/issues/381#issuecomment-469009251","issue_url":"https://api.github.com/repos/ropensci/git2r/issues/381","id":469009251,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2OTAwOTI1MQ==","user":{"login":"stewid","id":1815965,"node_id":"MDQ6VXNlcjE4MTU5NjU=","avatar_url":"https://avatars2.githubusercontent.com/u/1815965?v=4","gravatar_id":"","url":"https://api.github.com/users/stewid","html_url":"https://github.com/stewid","followers_url":"https://api.github.com/users/stewid/followers","following_url":"https://api.github.com/users/stewid/following{/other_user}","gists_url":"https://api.github.com/users/stewid/gists{/gist_id}","starred_url":"https://api.github.com/users/stewid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stewid/subscriptions","organizations_url":"https://api.github.com/users/stewid/orgs","repos_url":"https://api.github.com/users/stewid/repos","events_url":"https://api.github.com/users/stewid/events{/privacy}","received_events_url":"https://api.github.com/users/stewid/received_events","type":"User","site_admin":false},"created_at":"2019-03-03T10:26:48Z","updated_at":"2019-03-03T10:26:48Z","author_association":"MEMBER","body":"It's now possible to use `context_lines`\r\n\r\n```\r\n> repo_git2r <- repository(\".\")\r\n> commit <- lookup(repo_git2r, \"6e0e9b0\")\r\n> parent_commit <- parents(commit)[[1]]\r\n> tree_commit <- tree(commit)\r\n> tree_parent_commit <- tree(parent_commit)\r\n> cat(diff(tree_parent_commit, tree_commit, as_char = TRUE, context_lines = 0))\r\n```\r\nOutput\r\n```\r\ndiff --git a/inst/AUTHORS b/inst/AUTHORS\r\nindex 5f97103..8c3c728 100644\r\n--- a/inst/AUTHORS\r\n+++ b/inst/AUTHORS\r\n@@ -52,0 +53 @@ Emmanuel Rodriguez\r\n+Eric Myhre\r\n``` \r\n"}}
{"actor":{"display_login":"stewid"}}