Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: select what will be committed #37

Open
hrehfeld opened this issue May 29, 2021 · 3 comments
Open

feature: select what will be committed #37

hrehfeld opened this issue May 29, 2021 · 3 comments
Assignees

Comments

@hrehfeld
Copy link

hrehfeld commented May 29, 2021

I see the following options here:

  • commit only single file (setq git-auto-commit-mode-context 'file)
  • commit all (staged and/or unstaged) commits in subtree (subdirectory) (setq git-auto-commit-mode-context 'subtree)
  • commit all (staged and/or unstaged) commits in repo (setq git-auto-commit-mode-context 'repository)
  • commit all (staged and/or unstaged) changes to file and its "companion files", e.g. gtd.org would add (setq git-auto-commit-mode-context '("gtd.archive.org" "inbox.org")

And then also (setq git-auto-commit-mode-staged-only t)

@ryuslash ryuslash self-assigned this Jul 1, 2021
@ryuslash
Copy link
Owner

ryuslash commented Jul 1, 2021

Hey! Thanks for these suggestions! Does this mean the current situation isn't to your liking? If git-auto-commit-mode is enabled for all files in a repository every time you make a change you would get a new commit, so I'm not sure which files would be left to commit with it.

Can you elaborate on your situation perhaps?

@hrehfeld
Copy link
Author

hrehfeld commented Jul 14, 2021

So, I took some notes in the last weeks. I notice the following use-cases/problems relating to single file commits:

  • I have two org-mode files. I move a headline from a.org to b.org, and save all org-mode buffers. Now I have two commits, one which removes the headline in a.org and one that adds it to b.org, which feels a lot like inconsistent history/information lost. On code this would be a broken commit.
  • I add a headline in a.org, which creates an entry in .org-id-locations. I save a.org, but only a.org is committed, not .org-id-locations.
  • I add a picture to the directory and link to it in a.org. I save the file, a.org is commited, but I have to manually add the picture file and commit, leaving me with a half-broken commit.

So, there are two problems:

  • how do we handle other files (indexed/not indexed) in the same working copy?
  • we don't actually want to commit on save, give the operation a chance to finish and/or wait for a slight idle time. (optional, ofc)

@ryuslash
Copy link
Owner

Thank you, that helps a lot! Those are excellent points. For the first problem you mention I don't think there is currently anything that can help this, I'll have a look at implementing this when I have some time.

For the second problem you mention, I think this is what gac-debounce-interval should help with. You should be able to set this to the number of seconds that you want to wait before committing. But I think this only works for individual files at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants