Skip to content

Commit 4fff1ef

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a234563 commit 4fff1ef

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void die_if_checked_out(const char *branch, int ignore_current_worktree)
348348
int replace_each_worktree_head_symref(const char *oldref, const char *newref)
349349
{
350350
int ret = 0;
351-
struct worktree **worktrees = get_worktrees();
351+
struct worktree **worktrees = get_worktrees(0);
352352
int i;
353353

354354
for (i = 0; worktrees[i]; i++) {

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
531531

532532
static void reject_rebase_or_bisect_branch(const char *target)
533533
{
534-
struct worktree **worktrees = get_worktrees();
534+
struct worktree **worktrees = get_worktrees(0);
535535
int i;
536536

537537
for (i = 0; worktrees[i]; i++) {

builtin/worktree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static int list(int ac, const char **av, const char *prefix)
447447
if (ac)
448448
usage_with_options(worktree_usage, options);
449449
else {
450-
struct worktree **worktrees = get_worktrees();
450+
struct worktree **worktrees = get_worktrees(0);
451451
int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;
452452

453453
if (!porcelain)
@@ -478,7 +478,7 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
478478
if (ac != 1)
479479
usage_with_options(worktree_usage, options);
480480

481-
worktrees = get_worktrees();
481+
worktrees = get_worktrees(0);
482482
wt = find_worktree(worktrees, prefix, av[0]);
483483
if (!wt)
484484
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)
511511
if (ac != 1)
512512
usage_with_options(worktree_usage, options);
513513

514-
worktrees = get_worktrees();
514+
worktrees = get_worktrees(0);
515515
wt = find_worktree(worktrees, prefix, av[0]);
516516
if (!wt)
517517
die(_("'%s' is not a working tree"), av[0]);

worktree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void mark_current_worktree(struct worktree **worktrees)
160160
free(git_dir);
161161
}
162162

163-
struct worktree **get_worktrees(void)
163+
struct worktree **get_worktrees(unsigned flags)
164164
{
165165
struct worktree **list = NULL;
166166
struct strbuf path = STRBUF_INIT;
@@ -327,7 +327,7 @@ const struct worktree *find_shared_symref(const char *symref,
327327

328328
if (worktrees)
329329
free_worktrees(worktrees);
330-
worktrees = get_worktrees();
330+
worktrees = get_worktrees(0);
331331

332332
for (i = 0; worktrees[i]; i++) {
333333
struct worktree *wt = worktrees[i];

worktree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct worktree {
2323
* The caller is responsible for freeing the memory from the returned
2424
* worktree(s).
2525
*/
26-
extern struct worktree **get_worktrees(void);
26+
extern struct worktree **get_worktrees(unsigned flags);
2727

2828
/*
2929
* Return git dir of the worktree. Note that the path may be relative.

0 commit comments

Comments
 (0)