larkery / zsh-histdb

A slightly better history for zsh
MIT License
1.25k stars 74 forks source link

histdb-sync results in error: cannot rebase: You have unstaged changes. #129

Open jheidbrink opened 2 years ago

jheidbrink commented 2 years ago

I'm using histdb Git rev 30797f0c.

When running histdb-sync, I'm getting

error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.

I ran it again with set -x, and the relevant logs are:

+(anon):11> _histdb_stop_sqlite_pipe
+_histdb_stop_sqlite_pipe:1> [[ -n 11 ]]
+_histdb_stop_sqlite_pipe:2> print -nu11
+(anon):12> git commit -am history
[master 79eb3d9] history
 1 file changed, 0 insertions(+), 0 deletions(-)
+(anon):12> git pull --no-edit
Initializing Keybase... done.
Syncing with Keybase... done.
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.
+(anon):13> _histdb_start_sqlite_pipe
+_histdb_start_sqlite_pipe:1> local PIPE=/tmp/zsh2G3k4o
+_histdb_start_sqlite_pipe:2> setopt local_options no_notify no_monitor
+_histdb_start_sqlite_pipe:3> mkfifo /tmp/zsh2G3k4o
+_histdb_start_sqlite_pipe:5> sysopen -w -o cloexec -u HISTDB_FD -- /tmp/zsh2G3k4o
+_histdb_start_sqlite_pipe:4> sqlite3 -batch -noheader /home/jan/.histdb/zsh-history.db
+_histdb_start_sqlite_pipe:6> rm /tmp/zsh2G3k4o
+_histdb_start_sqlite_pipe:7> zstat -A HISTDB_INODE +inode /home/jan/.histdb/zsh-history.db

So it looks like right after committing and before pulling, something (probably zsh-histdb itself) changes zsh-history.db. I assume _histdb_stop_sqlite_pipe is meant to prevent precisely that? Not sure how to reproduce this, but I can help debugging if someone tells me how ;)

jheidbrink commented 2 years ago

btw I rebooted, and got

~: histdb-sync
truncating WAL
fatal: confused by unstable object source data for 9125a2218f5286ae9cf06c0c5898c86cf58d9517

I only got this once though, and afterwards it's again

~/.histdb: histdb-sync                                                                                                                                                              [± master]
truncating WAL
[master 0abee61] history
 1 file changed, 0 insertions(+), 0 deletions(-)
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
jheidbrink commented 2 years ago

Update: It works now, not sure why.