worktree.c: find_worktree() search by path suffix
commit080739ba1db7897dde53427937acc011ea98a006
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 13 Jun 2016 12:18:26 +0000 (13 19:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2016 22:31:04 +0000 (8 15:31 -0700)
treec7f83399881e31826cc3ea6af0c55f4f8badc205
parent6d308627cae4d34c058591de73ce14a52b79cf4e
worktree.c: find_worktree() search by path suffix

This allows the user to do something like "worktree lock foo" or
"worktree lock to/foo" instead of "worktree lock /long/path/to/foo" if
it's unambiguous.

With completion support it could be quite convenient. While this base
name search can be done in the same worktree iteration loop, the code is
split into a separate function for clarity.

Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-worktree.txt
worktree.c