This version * changes get_worktrees() to take a flag, and adds one flag for sorting. * adds tests for both the 'main worktree always present' and the sorting problems. * reworks 3/5 a bit, keep changes closer, easier to see the cause and consequence. Nguyễn Thái Ngọc Duy (5): worktree.c: zero new 'struct worktree' on allocation worktree: reorder an if statement get_worktrees() must return main worktree as first item even on error worktree.c: get_worktrees() takes a new flag argument worktree list: keep the list sorted branch.c | 2 +- builtin/branch.c | 2 +- builtin/worktree.c | 14 ++++++++------ t/t2027-worktree-list.sh | 40 ++++++++++++++++++++++++++++++++++++++++ worktree.c | 42 +++++++++++++++++++++--------------------- worktree.h | 4 +++- 6 files changed, 74 insertions(+), 30 deletions(-) -- 2.8.2.524.g6ff3d78