worktree.c: get_worktrees() takes a new flag argument

This is another no-op patch, in preparation for get_worktrees() to do optional things, like sorting. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 28, 2016 at 16:36 UTC 4fff1ef7ffe0e370459242cf08c51177eeb4181f
5 files changed +8 -8
branch.c
+1 -1
@@ -348,7 +348,7 @@ void die_if_checked_out(const char *branch, int ignore_current_worktree)
348 int replace_each_worktree_head_symref(const char *oldref, const char *newref)
349 {
350 int ret = 0;
351 - struct worktree **worktrees = get_worktrees();
351 + struct worktree **worktrees = get_worktrees(0);
352 int i;
353
354 for (i = 0; worktrees[i]; i++) {
builtin/branch.c
+1 -1
@@ -531,7 +531,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
531
532 static void reject_rebase_or_bisect_branch(const char *target)
533 {
534 - struct worktree **worktrees = get_worktrees();
534 + struct worktree **worktrees = get_worktrees(0);
535 int i;
536
537 for (i = 0; worktrees[i]; i++) {
builtin/worktree.c
+3 -3
@@ -447,7 +447,7 @@ static int list(int ac, const char **av, const char *prefix)
447 if (ac)
448 usage_with_options(worktree_usage, options);
449 else {
450 - struct worktree **worktrees = get_worktrees();
450 + struct worktree **worktrees = get_worktrees(0);
451 int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;
452
453 if (!porcelain)
@@ -478,7 +478,7 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
478 if (ac != 1)
479 usage_with_options(worktree_usage, options);
480
481 - worktrees = get_worktrees();
481 + worktrees = get_worktrees(0);
482 wt = find_worktree(worktrees, prefix, av[0]);
483 if (!wt)
484 die(_("'%s' is not a working tree"), av[0]);
@@ -511,7 +511,7 @@ static int unlock_worktree(int ac, const char **av, const char *prefix)
511 if (ac != 1)
512 usage_with_options(worktree_usage, options);
513
514 - worktrees = get_worktrees();
514 + worktrees = get_worktrees(0);
515 wt = find_worktree(worktrees, prefix, av[0]);
516 if (!wt)
517 die(_("'%s' is not a working tree"), av[0]);
worktree.c
+2 -2
@@ -160,7 +160,7 @@ static void mark_current_worktree(struct worktree **worktrees)
160 free(git_dir);
161 }
162
163 -struct worktree **get_worktrees(void)
163 +struct worktree **get_worktrees(unsigned flags)
164 {
165 struct worktree **list = NULL;
166 struct strbuf path = STRBUF_INIT;
@@ -327,7 +327,7 @@ const struct worktree *find_shared_symref(const char *symref,
327
328 if (worktrees)
329 free_worktrees(worktrees);
330 - worktrees = get_worktrees();
330 + worktrees = get_worktrees(0);
331
332 for (i = 0; worktrees[i]; i++) {
333 struct worktree *wt = worktrees[i];
worktree.h
+1 -1
@@ -23,7 +23,7 @@ struct worktree {
23 * The caller is responsible for freeing the memory from the returned
24 * worktree(s).
25 */
26 -extern struct worktree **get_worktrees(void);
26 +extern struct worktree **get_worktrees(unsigned flags);
27
28 /*
29 * Return git dir of the worktree. Note that the path may be relative.