about summary refs log tree commit diff
path: root/third_party/git/worktree.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/worktree.h')
-rw-r--r--third_party/git/worktree.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/third_party/git/worktree.h b/third_party/git/worktree.h
index caecc7a281cc..d242a6e71c03 100644
--- a/third_party/git/worktree.h
+++ b/third_party/git/worktree.h
@@ -44,14 +44,30 @@ int submodule_uses_worktrees(const char *path);
 const char *get_worktree_git_dir(const struct worktree *wt);
 
 /*
- * Search a worktree that can be unambiguously identified by
- * "arg". "prefix" must not be NULL.
+ * Search for the worktree identified unambiguously by `arg` -- typically
+ * supplied by the user via the command-line -- which may be a pathname or some
+ * shorthand uniquely identifying a worktree, thus making it convenient for the
+ * user to specify a worktree with minimal typing. For instance, if the last
+ * component (say, "foo") of a worktree's pathname is unique among worktrees
+ * (say, "work/foo" and "work/bar"), it can be used to identify the worktree
+ * unambiguously.
+ *
+ * `prefix` should be the `prefix` handed to top-level Git commands along with
+ * `argc` and `argv`.
+ *
+ * Return the worktree identified by `arg`, or NULL if not found.
  */
 struct worktree *find_worktree(struct worktree **list,
 			       const char *prefix,
 			       const char *arg);
 
 /*
+ * Return the worktree corresponding to `path`, or NULL if no such worktree
+ * exists.
+ */
+struct worktree *find_worktree_by_path(struct worktree **, const char *path);
+
+/*
  * Return true if the given worktree is the main one.
  */
 int is_main_worktree(const struct worktree *wt);