Skip to content

Commit 03f2465

Browse files
sunshinecogitster
authored andcommitted
worktree: drop get_worktrees() unused 'flags' argument
get_worktrees() accepts a 'flags' argument, however, there are no existing flags (the lone flag GWT_SORT_LINKED was recently retired) and no behavior which can be tweaked. Therefore, drop the 'flags' argument. Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9c54c2 commit 03f2465

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref,
369369
const char *logmsg)
370370
{
371371
int ret = 0;
372-
struct worktree **worktrees = get_worktrees(0);
372+
struct worktree **worktrees = get_worktrees();
373373
int i;
374374

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

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static void print_current_branch_name(void)
468468

469469
static void reject_rebase_or_bisect_branch(const char *target)
470470
{
471-
struct worktree **worktrees = get_worktrees(0);
471+
struct worktree **worktrees = get_worktrees();
472472
int i;
473473

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

builtin/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
672672
given_config_source.file = git_pathdup("config");
673673
given_config_source.scope = CONFIG_SCOPE_LOCAL;
674674
} else if (use_worktree_config) {
675-
struct worktree **worktrees = get_worktrees(0);
675+
struct worktree **worktrees = get_worktrees();
676676
if (repository_format_worktree_config)
677677
given_config_source.file = git_pathdup("config.worktree");
678678
else if (worktrees[0] && worktrees[1])

builtin/fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static void get_default_heads(void)
576576

577577
for_each_rawref(fsck_handle_ref, NULL);
578578

579-
worktrees = get_worktrees(0);
579+
worktrees = get_worktrees();
580580
for (p = worktrees; *p; p++) {
581581
struct worktree *wt = *p;
582582
struct strbuf ref = STRBUF_INIT;

builtin/reflog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
615615
int i;
616616

617617
memset(&collected, 0, sizeof(collected));
618-
worktrees = get_worktrees(0);
618+
worktrees = get_worktrees();
619619
for (p = worktrees; *p; p++) {
620620
if (!all_worktrees && !(*p)->is_current)
621621
continue;

builtin/worktree.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static int add_worktree(const char *path, const char *refname,
325325
struct strbuf sb_name = STRBUF_INIT;
326326
struct worktree **worktrees;
327327

328-
worktrees = get_worktrees(0);
328+
worktrees = get_worktrees();
329329
check_candidate_path(path, opts->force, worktrees, "add");
330330
free_worktrees(worktrees);
331331
worktrees = NULL;
@@ -724,7 +724,7 @@ static int list(int ac, const char **av, const char *prefix)
724724
if (ac)
725725
usage_with_options(worktree_usage, options);
726726
else {
727-
struct worktree **worktrees = get_worktrees(0);
727+
struct worktree **worktrees = get_worktrees();
728728
int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;
729729

730730
/* sort worktrees by path but keep main worktree at top */
@@ -758,7 +758,7 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
758758
if (ac != 1)
759759
usage_with_options(worktree_usage, options);
760760

761-
worktrees = get_worktrees(0);
761+
worktrees = get_worktrees();
762762
wt = find_worktree(worktrees, prefix, av[0]);
763763
if (!wt)
764764
die(_("'%s' is not a working tree"), av[0]);
@@ -791,7 +791,7 @@ static int unlock_worktree(int ac, const char **av, const char *prefix)
791791
if (ac != 1)
792792
usage_with_options(worktree_usage, options);
793793

794-
worktrees = get_worktrees(0);
794+
worktrees = get_worktrees();
795795
wt = find_worktree(worktrees, prefix, av[0]);
796796
if (!wt)
797797
die(_("'%s' is not a working tree"), av[0]);
@@ -865,7 +865,7 @@ static int move_worktree(int ac, const char **av, const char *prefix)
865865
strbuf_addstr(&dst, path);
866866
free(path);
867867

868-
worktrees = get_worktrees(0);
868+
worktrees = get_worktrees();
869869
wt = find_worktree(worktrees, prefix, av[0]);
870870
if (!wt)
871871
die(_("'%s' is not a working tree"), av[0]);
@@ -991,7 +991,7 @@ static int remove_worktree(int ac, const char **av, const char *prefix)
991991
if (ac != 1)
992992
usage_with_options(worktree_usage, options);
993993

994-
worktrees = get_worktrees(0);
994+
worktrees = get_worktrees();
995995
wt = find_worktree(worktrees, prefix, av[0]);
996996
if (!wt)
997997
die(_("'%s' is not a working tree"), av[0]);

ref-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ static void lazy_init_worktree_map(void)
15791579
if (ref_to_worktree_map.worktrees)
15801580
return;
15811581

1582-
ref_to_worktree_map.worktrees = get_worktrees(0);
1582+
ref_to_worktree_map.worktrees = get_worktrees();
15831583
hashmap_init(&(ref_to_worktree_map.map), ref_to_worktree_map_cmpfnc, NULL, 0);
15841584
populate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);
15851585
}

revision.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ static void add_other_reflogs_to_pending(struct all_refs_cb *cb)
14521452
{
14531453
struct worktree **worktrees, **p;
14541454

1455-
worktrees = get_worktrees(0);
1455+
worktrees = get_worktrees();
14561456
for (p = worktrees; *p; p++) {
14571457
struct worktree *wt = *p;
14581458

@@ -1540,7 +1540,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
15401540
if (revs->single_worktree)
15411541
return;
15421542

1543-
worktrees = get_worktrees(0);
1543+
worktrees = get_worktrees();
15441544
for (p = worktrees; *p; p++) {
15451545
struct worktree *wt = *p;
15461546
struct index_state istate = { NULL };

t/helper/test-ref-store.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static const char **get_store(const char **argv, struct ref_store **refs)
3737

3838
*refs = get_submodule_ref_store(gitdir);
3939
} else if (skip_prefix(argv[0], "worktree:", &gitdir)) {
40-
struct worktree **p, **worktrees = get_worktrees(0);
40+
struct worktree **p, **worktrees = get_worktrees();
4141

4242
for (p = worktrees; *p; p++) {
4343
struct worktree *wt = *p;

worktree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void mark_current_worktree(struct worktree **worktrees)
123123
free(git_dir);
124124
}
125125

126-
struct worktree **get_worktrees(unsigned flags)
126+
struct worktree **get_worktrees(void)
127127
{
128128
struct worktree **list = NULL;
129129
struct strbuf path = STRBUF_INIT;
@@ -398,7 +398,7 @@ const struct worktree *find_shared_symref(const char *symref,
398398

399399
if (worktrees)
400400
free_worktrees(worktrees);
401-
worktrees = get_worktrees(0);
401+
worktrees = get_worktrees();
402402

403403
for (i = 0; worktrees[i]; i++) {
404404
struct worktree *wt = worktrees[i];
@@ -559,7 +559,7 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
559559
struct worktree **worktrees, **p;
560560
int ret = 0;
561561

562-
worktrees = get_worktrees(0);
562+
worktrees = get_worktrees();
563563
for (p = worktrees; *p; p++) {
564564
struct worktree *wt = *p;
565565
struct object_id oid;

0 commit comments

Comments
 (0)