mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Only create diff options when necessary
This commit is contained in:
parent
d3ed0fca27
commit
a561d5efab
@ -114,17 +114,6 @@ public:
|
|||||||
return CefV8Value::CreateNull();
|
return CefV8Value::CreateNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *copiedPath = (char *)malloc(sizeof(char) * (strlen(path) + 1));
|
|
||||||
strcpy(copiedPath, path);
|
|
||||||
git_diff_options options;
|
|
||||||
memset(&options, 0, sizeof(options));
|
|
||||||
git_strarray paths;
|
|
||||||
paths.count = 1;
|
|
||||||
paths.strings = &copiedPath;
|
|
||||||
options.pathspec = paths;
|
|
||||||
options.context_lines = 1;
|
|
||||||
options.flags = GIT_DIFF_DISABLE_PATHSPEC_MATCH;
|
|
||||||
|
|
||||||
git_reference *head;
|
git_reference *head;
|
||||||
if (git_repository_head(&head, repo) != GIT_OK) {
|
if (git_repository_head(&head, repo) != GIT_OK) {
|
||||||
return CefV8Value::CreateNull();
|
return CefV8Value::CreateNull();
|
||||||
@ -145,6 +134,17 @@ public:
|
|||||||
return CefV8Value::CreateNull();
|
return CefV8Value::CreateNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *copiedPath = (char *)malloc(sizeof(char) * (strlen(path) + 1));
|
||||||
|
strcpy(copiedPath, path);
|
||||||
|
git_diff_options options;
|
||||||
|
memset(&options, 0, sizeof(options));
|
||||||
|
git_strarray paths;
|
||||||
|
paths.count = 1;
|
||||||
|
paths.strings = &copiedPath;
|
||||||
|
options.pathspec = paths;
|
||||||
|
options.context_lines = 1;
|
||||||
|
options.flags = GIT_DIFF_DISABLE_PATHSPEC_MATCH;
|
||||||
|
|
||||||
git_diff_list *diffs;
|
git_diff_list *diffs;
|
||||||
int diffStatus = git_diff_workdir_to_tree(repo, &options, tree, &diffs);
|
int diffStatus = git_diff_workdir_to_tree(repo, &options, tree, &diffs);
|
||||||
if (diffStatus != GIT_OK) {
|
if (diffStatus != GIT_OK) {
|
||||||
|
Loading…
Reference in New Issue
Block a user