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 <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Jun 19, 2020 at 19:35 UTC
03f2465bb1c1d9222181c493373e668c0ba7eb51
11 files changed
+19
-19
branch.c
+1
-1
@@ -369,7 +369,7 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref,
369
const char *logmsg)
370
{
371
int ret = 0;
372
- struct worktree **worktrees = get_worktrees(0);
372
+ struct worktree **worktrees = get_worktrees();
373
int i;
374
375
for (i = 0; worktrees[i]; i++) {
builtin/branch.c
+1
-1
@@ -468,7 +468,7 @@ static void print_current_branch_name(void)
468
469
static void reject_rebase_or_bisect_branch(const char *target)
470
{
471
- struct worktree **worktrees = get_worktrees(0);
471
+ struct worktree **worktrees = get_worktrees();
472
int i;
473
474
for (i = 0; worktrees[i]; i++) {
builtin/config.c
+1
-1
@@ -672,7 +672,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
672
given_config_source.file = git_pathdup("config");
673
given_config_source.scope = CONFIG_SCOPE_LOCAL;
674
} else if (use_worktree_config) {
675
- struct worktree **worktrees = get_worktrees(0);
675
+ struct worktree **worktrees = get_worktrees();
676
if (repository_format_worktree_config)
677
given_config_source.file = git_pathdup("config.worktree");
678
else if (worktrees[0] && worktrees[1])
builtin/fsck.c
+1
-1
@@ -576,7 +576,7 @@ static void get_default_heads(void)
576
577
for_each_rawref(fsck_handle_ref, NULL);
578
579
- worktrees = get_worktrees(0);
579
+ worktrees = get_worktrees();
580
for (p = worktrees; *p; p++) {
581
struct worktree *wt = *p;
582
struct strbuf ref = STRBUF_INIT;
builtin/reflog.c
+1
-1
@@ -615,7 +615,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
615
int i;
616
617
memset(&collected, 0, sizeof(collected));
618
- worktrees = get_worktrees(0);
618
+ worktrees = get_worktrees();
619
for (p = worktrees; *p; p++) {
620
if (!all_worktrees && !(*p)->is_current)
621
continue;
builtin/worktree.c
+6
-6
@@ -325,7 +325,7 @@ static int add_worktree(const char *path, const char *refname,
325
struct strbuf sb_name = STRBUF_INIT;
326
struct worktree **worktrees;
327
328
- worktrees = get_worktrees(0);
328
+ worktrees = get_worktrees();
329
check_candidate_path(path, opts->force, worktrees, "add");
330
free_worktrees(worktrees);
331
worktrees = NULL;
@@ -724,7 +724,7 @@ static int list(int ac, const char **av, const char *prefix)
724
if (ac)
725
usage_with_options(worktree_usage, options);
726
else {
727
- struct worktree **worktrees = get_worktrees(0);
727
+ struct worktree **worktrees = get_worktrees();
728
int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;
729
730
/* 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)
758
if (ac != 1)
759
usage_with_options(worktree_usage, options);
760
761
- worktrees = get_worktrees(0);
761
+ worktrees = get_worktrees();
762
wt = find_worktree(worktrees, prefix, av[0]);
763
if (!wt)
764
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)
791
if (ac != 1)
792
usage_with_options(worktree_usage, options);
793
794
- worktrees = get_worktrees(0);
794
+ worktrees = get_worktrees();
795
wt = find_worktree(worktrees, prefix, av[0]);
796
if (!wt)
797
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)
865
strbuf_addstr(&dst, path);
866
free(path);
867
868
- worktrees = get_worktrees(0);
868
+ worktrees = get_worktrees();
869
wt = find_worktree(worktrees, prefix, av[0]);
870
if (!wt)
871
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)
991
if (ac != 1)
992
usage_with_options(worktree_usage, options);
993
994
- worktrees = get_worktrees(0);
994
+ worktrees = get_worktrees();
995
wt = find_worktree(worktrees, prefix, av[0]);
996
if (!wt)
997
die(_("'%s' is not a working tree"), av[0]);
ref-filter.c
+1
-1
@@ -1579,7 +1579,7 @@ static void lazy_init_worktree_map(void)
1579
if (ref_to_worktree_map.worktrees)
1580
return;
1581
1582
- ref_to_worktree_map.worktrees = get_worktrees(0);
1582
+ ref_to_worktree_map.worktrees = get_worktrees();
1583
hashmap_init(&(ref_to_worktree_map.map), ref_to_worktree_map_cmpfnc, NULL, 0);
1584
populate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);
1585
}
revision.c
+2
-2
@@ -1452,7 +1452,7 @@ static void add_other_reflogs_to_pending(struct all_refs_cb *cb)
1452
{
1453
struct worktree **worktrees, **p;
1454
1455
- worktrees = get_worktrees(0);
1455
+ worktrees = get_worktrees();
1456
for (p = worktrees; *p; p++) {
1457
struct worktree *wt = *p;
1458
@@ -1540,7 +1540,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
1540
if (revs->single_worktree)
1541
return;
1542
1543
- worktrees = get_worktrees(0);
1543
+ worktrees = get_worktrees();
1544
for (p = worktrees; *p; p++) {
1545
struct worktree *wt = *p;
1546
struct index_state istate = { NULL };
t/helper/test-ref-store.c
+1
-1
@@ -37,7 +37,7 @@ static const char **get_store(const char **argv, struct ref_store **refs)
37
38
*refs = get_submodule_ref_store(gitdir);
39
} else if (skip_prefix(argv[0], "worktree:", &gitdir)) {
40
- struct worktree **p, **worktrees = get_worktrees(0);
40
+ struct worktree **p, **worktrees = get_worktrees();
41
42
for (p = worktrees; *p; p++) {
43
struct worktree *wt = *p;
worktree.c
+3
-3
@@ -123,7 +123,7 @@ static void mark_current_worktree(struct worktree **worktrees)
123
free(git_dir);
124
}
125
126
-struct worktree **get_worktrees(unsigned flags)
126
+struct worktree **get_worktrees(void)
127
{
128
struct worktree **list = NULL;
129
struct strbuf path = STRBUF_INIT;
@@ -398,7 +398,7 @@ const struct worktree *find_shared_symref(const char *symref,
398
399
if (worktrees)
400
free_worktrees(worktrees);
401
- worktrees = get_worktrees(0);
401
+ worktrees = get_worktrees();
402
403
for (i = 0; worktrees[i]; i++) {
404
struct worktree *wt = worktrees[i];
@@ -559,7 +559,7 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
559
struct worktree **worktrees, **p;
560
int ret = 0;
561
562
- worktrees = get_worktrees(0);
562
+ worktrees = get_worktrees();
563
for (p = worktrees; *p; p++) {
564
struct worktree *wt = *p;
565
struct object_id oid;
worktree.h
+1
-1
@@ -25,7 +25,7 @@ struct worktree {
25
* The caller is responsible for freeing the memory from the returned
26
* worktrees by calling free_worktrees().
27
*/
28
-struct worktree **get_worktrees(unsigned flags);
28
+struct worktree **get_worktrees(void);
29
30
/*
31
* Returns 1 if linked worktrees exist, 0 otherwise.