Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-07-07 08:09:15 +0300
committerJunio C Hamano <gitster@pobox.com>2020-07-07 08:09:15 +0300
commit645f63111b9fc456cc48da9b320b86800fe5477c (patch)
tree21e97612acaf1250b8327b87d94d9ffebeb544d8 /worktree.c
parente7e113a1df98f3a97a83c36cf75bcce50a4a0073 (diff)
parent03f2465bb1c1d9222181c493373e668c0ba7eb51 (diff)
Merge branch 'es/get-worktrees-unsort'
API cleanup for get_worktrees() * es/get-worktrees-unsort: worktree: drop get_worktrees() unused 'flags' argument worktree: drop get_worktrees() special-purpose sorting option
Diffstat (limited to 'worktree.c')
-rw-r--r--worktree.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/worktree.c b/worktree.c
index ee82235f26..ff9b7d847f 100644
--- a/worktree.c
+++ b/worktree.c
@@ -123,14 +123,7 @@ static void mark_current_worktree(struct worktree **worktrees)
free(git_dir);
}
-static int compare_worktree(const void *a_, const void *b_)
-{
- const struct worktree *const *a = a_;
- const struct worktree *const *b = b_;
- return fspathcmp((*a)->path, (*b)->path);
-}
-
-struct worktree **get_worktrees(unsigned flags)
+struct worktree **get_worktrees(void)
{
struct worktree **list = NULL;
struct strbuf path = STRBUF_INIT;
@@ -161,13 +154,6 @@ struct worktree **get_worktrees(unsigned flags)
ALLOC_GROW(list, counter + 1, alloc);
list[counter] = NULL;
- if (flags & GWT_SORT_LINKED)
- /*
- * don't sort the first item (main worktree), which will
- * always be the first
- */
- QSORT(list + 1, counter - 1, compare_worktree);
-
mark_current_worktree(list);
return list;
}
@@ -418,7 +404,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];
@@ -577,7 +563,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;