Skip to content

Commit 8d78400

Browse files
committed
Make examples/diff.c compile vs threadsafe library
1 parent 58206c9 commit 8d78400

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/diff.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ int main(int argc, char *argv[])
117117
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
118118
git_diff_list *diff;
119119
int i, color = -1, compact = 0, cached = 0;
120-
char *a, *dir = ".", *treeish1 = NULL, *treeish2 = NULL;
120+
char *a, *treeish1 = NULL, *treeish2 = NULL;
121+
const char *dir = ".";
122+
123+
git_threads_init();
121124

122125
/* parse arguments as copied from git-diff */
123126

@@ -162,7 +165,8 @@ int main(int argc, char *argv[])
162165
!check_uint16_param(a, "--inter-hunk-context=",
163166
&opts.interhunk_lines) &&
164167
!check_str_param(a, "--src-prefix=", &opts.old_prefix) &&
165-
!check_str_param(a, "--dst-prefix=", &opts.new_prefix))
168+
!check_str_param(a, "--dst-prefix=", &opts.new_prefix) &&
169+
!check_str_param(a, "--git-dir=", &dir))
166170
usage("Unknown arg", a);
167171
}
168172

@@ -216,6 +220,8 @@ int main(int argc, char *argv[])
216220
git_tree_free(t2);
217221
git_repository_free(repo);
218222

223+
git_threads_shutdown();
224+
219225
return 0;
220226
}
221227

0 commit comments

Comments
 (0)