X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;ds=sidebyside;f=worktree.c;fp=worktree.c;h=ff9b7d847ffe35b39558d266443e64647ff05d69;hb=645f63111b9fc456cc48da9b320b86800fe5477c;hp=ee82235f260c21748ec987ada46a4422980d9c8b;hpb=e7e113a1df98f3a97a83c36cf75bcce50a4a0073;p=thirdparty%2Fgit.git 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;