]> git.ipfire.org Git - thirdparty/git.git/commitdiff
worktree: drop get_worktrees() unused 'flags' argument
authorEric Sunshine <sunshine@sunshineco.com>
Fri, 19 Jun 2020 23:35:44 +0000 (19:35 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2020 17:31:15 +0000 (10:31 -0700)
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>
branch.c
builtin/branch.c
builtin/config.c
builtin/fsck.c
builtin/reflog.c
builtin/worktree.c
ref-filter.c
revision.c
t/helper/test-ref-store.c
worktree.c
worktree.h

index 579494738a7f804974d2b396a1c795acd4a44789..c5b19415715bcae2302b91ff716a7f3c6f035bff 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -369,7 +369,7 @@ int replace_each_worktree_head_symref(const char *oldref, const char *newref,
                                      const char *logmsg)
 {
        int ret = 0;
-       struct worktree **worktrees = get_worktrees(0);
+       struct worktree **worktrees = get_worktrees();
        int i;
 
        for (i = 0; worktrees[i]; i++) {
index d8297f80ffc730442d9a590650fe4644b2351d04..5a2753018df88f95121d54f525ac38701397c80f 100644 (file)
@@ -468,7 +468,7 @@ static void print_current_branch_name(void)
 
 static void reject_rebase_or_bisect_branch(const char *target)
 {
-       struct worktree **worktrees = get_worktrees(0);
+       struct worktree **worktrees = get_worktrees();
        int i;
 
        for (i = 0; worktrees[i]; i++) {
index ee4aef6a3555765a9ed74263d68c765ba8431f85..5e39f6188542bb28cd859e52b883d13fcbd281fe 100644 (file)
@@ -672,7 +672,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                given_config_source.file = git_pathdup("config");
                given_config_source.scope = CONFIG_SCOPE_LOCAL;
        } else if (use_worktree_config) {
-               struct worktree **worktrees = get_worktrees(0);
+               struct worktree **worktrees = get_worktrees();
                if (repository_format_worktree_config)
                        given_config_source.file = git_pathdup("config.worktree");
                else if (worktrees[0] && worktrees[1])
index 8d13794b1412c82f3a19331548b4b2cb26da349b..5ebf81374a51c34a9cfb1ac35ae25848abb72f20 100644 (file)
@@ -576,7 +576,7 @@ static void get_default_heads(void)
 
        for_each_rawref(fsck_handle_ref, NULL);
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        for (p = worktrees; *p; p++) {
                struct worktree *wt = *p;
                struct strbuf ref = STRBUF_INIT;
index 81dfd563c0d937eb8943f84493d2d48e8af15f1b..0b6853b9f458a15ef94fef4e046e62a88117f368 100644 (file)
@@ -615,7 +615,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                int i;
 
                memset(&collected, 0, sizeof(collected));
-               worktrees = get_worktrees(0);
+               worktrees = get_worktrees();
                for (p = worktrees; *p; p++) {
                        if (!all_worktrees && !(*p)->is_current)
                                continue;
index c20e4ce08925cb82ab6e1767490404a910d7634f..2551c367093aab004e5ecec579fac12e9bf83ded 100644 (file)
@@ -325,7 +325,7 @@ static int add_worktree(const char *path, const char *refname,
        struct strbuf sb_name = STRBUF_INIT;
        struct worktree **worktrees;
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        check_candidate_path(path, opts->force, worktrees, "add");
        free_worktrees(worktrees);
        worktrees = NULL;
@@ -724,7 +724,7 @@ static int list(int ac, const char **av, const char *prefix)
        if (ac)
                usage_with_options(worktree_usage, options);
        else {
-               struct worktree **worktrees = get_worktrees(0);
+               struct worktree **worktrees = get_worktrees();
                int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;
 
                /* 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)
        if (ac != 1)
                usage_with_options(worktree_usage, options);
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        wt = find_worktree(worktrees, prefix, av[0]);
        if (!wt)
                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)
        if (ac != 1)
                usage_with_options(worktree_usage, options);
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        wt = find_worktree(worktrees, prefix, av[0]);
        if (!wt)
                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)
        strbuf_addstr(&dst, path);
        free(path);
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        wt = find_worktree(worktrees, prefix, av[0]);
        if (!wt)
                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)
        if (ac != 1)
                usage_with_options(worktree_usage, options);
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        wt = find_worktree(worktrees, prefix, av[0]);
        if (!wt)
                die(_("'%s' is not a working tree"), av[0]);
index b1812cb69a173c983bf434bcab0522bb96d03dd0..76802e8e96d0de3a7eeb07f54987a4be3a00182e 100644 (file)
@@ -1579,7 +1579,7 @@ static void lazy_init_worktree_map(void)
        if (ref_to_worktree_map.worktrees)
                return;
 
-       ref_to_worktree_map.worktrees = get_worktrees(0);
+       ref_to_worktree_map.worktrees = get_worktrees();
        hashmap_init(&(ref_to_worktree_map.map), ref_to_worktree_map_cmpfnc, NULL, 0);
        populate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);
 }
index 8136929e23626e3bd9a8e9c6108fd2e32b2bd1cb..a42f6d5e42683ff2c7d1b9610750dd70bcadea6b 100644 (file)
@@ -1452,7 +1452,7 @@ static void add_other_reflogs_to_pending(struct all_refs_cb *cb)
 {
        struct worktree **worktrees, **p;
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        for (p = worktrees; *p; p++) {
                struct worktree *wt = *p;
 
@@ -1540,7 +1540,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
        if (revs->single_worktree)
                return;
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        for (p = worktrees; *p; p++) {
                struct worktree *wt = *p;
                struct index_state istate = { NULL };
index 799fc00aa15b1e4cfe9fe8a6d32ebc2063003cb4..759e69dc549ea1d87343d9890b28066515858aea 100644 (file)
@@ -37,7 +37,7 @@ static const char **get_store(const char **argv, struct ref_store **refs)
 
                *refs = get_submodule_ref_store(gitdir);
        } else if (skip_prefix(argv[0], "worktree:", &gitdir)) {
-               struct worktree **p, **worktrees = get_worktrees(0);
+               struct worktree **p, **worktrees = get_worktrees();
 
                for (p = worktrees; *p; p++) {
                        struct worktree *wt = *p;
index 42cabc5403281fe8e4bee87b77799612fbebb674..f4701477ce9ae85e4fc618860a08b7daa575b90b 100644 (file)
@@ -123,7 +123,7 @@ static void mark_current_worktree(struct worktree **worktrees)
        free(git_dir);
 }
 
-struct worktree **get_worktrees(unsigned flags)
+struct worktree **get_worktrees(void)
 {
        struct worktree **list = NULL;
        struct strbuf path = STRBUF_INIT;
@@ -398,7 +398,7 @@ const struct worktree *find_shared_symref(const char *symref,
 
        if (worktrees)
                free_worktrees(worktrees);
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
 
        for (i = 0; worktrees[i]; i++) {
                struct worktree *wt = worktrees[i];
@@ -559,7 +559,7 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
        struct worktree **worktrees, **p;
        int ret = 0;
 
-       worktrees = get_worktrees(0);
+       worktrees = get_worktrees();
        for (p = worktrees; *p; p++) {
                struct worktree *wt = *p;
                struct object_id oid;
index bd2235abe06ef501001e508f116042a546710786..516744c433f1e627abe85a347d72e6516f98c171 100644 (file)
@@ -25,7 +25,7 @@ struct worktree {
  * The caller is responsible for freeing the memory from the returned
  * worktrees by calling free_worktrees().
  */
-struct worktree **get_worktrees(unsigned flags);
+struct worktree **get_worktrees(void);
 
 /*
  * Returns 1 if linked worktrees exist, 0 otherwise.