emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
822 stars 74 forks source link

upgrading via straight.el reports a dirty worktree #136

Closed orzechowskid closed 3 years ago

orzechowskid commented 3 years ago

I've installed emacstree-sitter and tree-sitter-langs using straight.el. when I attempt to upgrade packages, straight.el occasionally reports the following message:

Repository "emacs-tree-sitter" has a dirty worktree: M langs

this warning is harmless, as far as I can tell (worst case, I discard the changes to langs and rebuild next time I launch emacs), but a bit annoying. it looks like langs is a git submodule so I assume it's not a good idea to add it to .gitignore in order to suppress this warning? how would you recommend I avoid generating this message?

thanks for the great work on these packages!

ubolonton commented 3 years ago

The main repo tracks tree-sitter-langs as a git submodule only for testing, so it can be safely ignored.

Is the modification only a difference in the checked-out version, or does it contain some file modifications as well (shown with a -dirty suffix in magit status buffer)?

If it's the former, it probably means straight does not update submodules when upgrading a repository. That would be a bug, or missing feature, in straight. You should probably report the issue there.

orzechowskid commented 3 years ago

thanks for your response. I'll take a look and report back the next time this occurs for me.

orzechowskid commented 3 years ago

wow, good timing - I just ran into this again. I'm using this function to update all of my installed packages:

(defun my/update-packages ()
  (interactive)
  (straight-fetch-all)
  (straight-pull-all)
  (straight-rebuild-all))

when I cd ~/.emacs.d/straight/repos/emacs-tree-sitter and run git status, I see this:

On branch master
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   langs (new commits)

'git log --oneline | head -1 tells me that my emacs-tree-sitter is currently at ae26995. if I cd into langs and run git status again, I get this:

HEAD detached at fcd267f
nothing to commit, working tree clean

that is a really old commit so I think your thought about straight.el not updating submodules is correct. I'll go open an issue against that library.

thanks for the help.