Commit graph

18 commits

Author SHA1 Message Date
c15736259c add git::git_log_oldest_author_timestamp(), saves us one git log
This cuts about 30% off the time to read the issues from
entomologist-data.
2025-07-22 13:04:54 -06:00
c217434071 better error handling in comment and git
This replaces a bunch of `unwrap()` calls with error returns.
2025-07-19 10:38:15 -06:00
3721483c2d git::sync(): more helpful error message when merge fails 2025-07-12 14:54:48 -06:00
08e0698418 git::sync(): show somewhat ugly git logs of stuff fetched and pushed 2025-07-11 13:09:23 -06:00
7b6efdf925 rename git::add_file() to just add(), it can add directories too 2025-07-11 10:17:11 -06:00
f8d35e13ff add git::Worktree::new_detached()
This makes a detached worktree, useful for read-only operations on the
issues database branch.
2025-07-10 12:39:03 -06:00
bfdf6178f4 add git::commit() 2025-07-09 22:33:58 -06:00
16de030b8e add git::add_file() 2025-07-09 22:33:58 -06:00
ac72251e0e add git::restore_file()
This restores a file from the index to the worktree.
2025-07-09 22:33:58 -06:00
1509c42734 add git::worktree_is_dirty()
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.
2025-07-09 22:33:58 -06:00
ca353352f8 git::Worktree::drop() now force-drops the worktree
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!
2025-07-09 22:31:07 -06:00
7acd94f7c0 add author to Comment 2025-07-08 20:59:02 -06:00
a2c7ce34a3 fix git::git_log_oldest_timestamp() when there are multiple log entries 2025-07-08 18:42:14 -06:00
be362517fb give Comment a timestamp, display in chronological order
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
2025-07-08 18:42:14 -06:00
9c54a92152 add ent sync
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.
2025-07-08 10:50:37 -06:00
172055c480 always render issue UUIDs as 128 bit hex numbers 2025-07-07 12:53:05 -06:00
5b1c7a52b9 git: add git_commit_file() 2025-07-06 00:22:30 -06:00
e8910b906a add git support
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.
2025-07-05 21:20:16 -06:00