diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-04-22 20:01:29 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-22 14:09:38 -0700 |
commit | 2e641d5825673c7dca384bc12fcaf1681d731bb6 (patch) | |
tree | fdb26b0c2374cee718e5f07a5f391b63965679f3 /worktree.h | |
parent | 750e8a60d69274acd820f812704c75927d82728e (diff) | |
download | git-2e641d5825673c7dca384bc12fcaf1681d731bb6.tar.gz |
path.c: refactor and add worktree_git_path()
do_git_path(), which is the common code for all git_path* functions, is
modified to take a worktree struct and can produce paths for any
worktree.
worktree_git_path() is the first function that makes use of this. It can
be used to write code that can examine any worktree. For example,
wt_status_get_state() will be converted using this to take
am/rebase/... state of any worktree.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'worktree.h')
-rw-r--r-- | worktree.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/worktree.h b/worktree.h index ccdf69a876..0da8c1f2bd 100644 --- a/worktree.h +++ b/worktree.h @@ -42,4 +42,12 @@ extern void free_worktrees(struct worktree **); extern const struct worktree *find_shared_symref(const char *symref, const char *target); +/* + * Similar to git_path() but can produce paths for a specified + * worktree instead of current one + */ +extern const char *worktree_git_path(const struct worktree *wt, + const char *fmt, ...) + __attribute__((format (printf, 2, 3))); + #endif |