This returns Ok(true) if the worktree has any modified files (staged or
unstaged), or any added (staged) files. Ok(false) if not.
Ignores untracked files.
This avoids leaving prunable worktrees around if we dirtied the worktree
and didn't commit.
This can happen in the following situation:
1. User runs `ent new`.
2. ent creates a new directory for the issue.
3. ent opens an editor to let the user type in the description of the
new issue. The editor saves to `ISSUE/description`.
4. User changes their mind and no longer wants to make a new issue, so
they save an empty buffer and exit the editor.
5. ent sees that the file is empty, and returns an error from
Issue::edit_description().
6. ent propagates the error up through program exit, and eventually
the git::Worktree struct is dropped. Since the worktree is dirty
(it has the new issue dir with an empty description file in it),
`git worktree remove` fails.
But `git worktree remove --force` works!
This commit makes a couple of changes:
- `ent show ISSUE` now displays the Issue's Comments in chronological
order
- the Comment struct now includes a timestamp, which is the Author Time
of the oldest commit that touches the comment's directory
- the Issue struct now stores its Comments in a sorted Vec, not in
a HashMap
- The Comment's uuid moved into the Comment struct itself, instead of
being the key in the Issue's HashMap of Comments
In a worktree with the `entomologist-data` branch checked out in it:
1. `git fetch REMOTE`
2. `git merge REMOTE/BRANCH`
3. `git push REMOTE BRANCH`
Pretty straight-forward. If anything goes wrong we error out and ask
the human to help.
This mostly provides an abstraction for "ephemeral worktrees", which
is a branch checked out in a worktree, to be read and maybe modified,
and the worktree is deleted/pruned when we're done with it.
There are also some helper functions for doing git things, the most
important one creates an orphaned branch.
The intent is to keep all the issues in a git branch. When we want to
do anything with issues (list them, add new issues, modify an issue,
etc) we check the issues branch out into an ephemeral worktree, modify
the branch, and delete the worktree.