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

Idea: exclude generated files from stg edit -d #425

Open
proski opened this issue Feb 28, 2024 · 4 comments
Open

Idea: exclude generated files from stg edit -d #425

proski opened this issue Feb 28, 2024 · 4 comments

Comments

@proski
Copy link
Contributor

proski commented Feb 28, 2024

Whether we like it of not, generated files are often under version control. StGit itself has Cargo.lock in git.

I'm a heavy user of stg edit -d, it helps me produce good patched that only have the intended changes. Unfortunately, changes to generated files often dominate the diff file, so I have to navigate around them.

I suggest that we add an option that would exclude certain files from stg edit -d. Those files should remain unchanged once stg edit -d finishes. It's up to the user to regenerate them.

The simplest approach would be to use a set of shell patterns (e.g. "configure", "*.lock", "Cargo.nix"). The global configuration could have the default patterns. It should be possible to suppress the default.

A more sophisticated approach would be to have something like .gitignore hierarchy for "non-editable" files in the sources. It would be hard to introduce a new standard. But we could check if there is an existing proposal with some traction.

@proski
Copy link
Contributor Author

proski commented Feb 28, 2024

Some ideas how to do it with git: https://stackoverflow.com/questions/10415100/exclude-file-from-git-diff

@lkraav
Copy link

lkraav commented Feb 29, 2024

Yeah GH does it great in PR Files view.

@jpgrayson
Copy link
Collaborator

For clarification, @proski, when you use stg edit -d do you modify the diff? Or just use it as a reference?

I ask because excluding files from a diff being used purely as a reference seems easier than having to deal with an incomplete diff that is nonetheless intended to be applied after edit.

@proski
Copy link
Contributor Author

proski commented Mar 25, 2024

I do edit files occasionally. These are the ways I use stg edit -d:

  • Writing or improving commit description while looking at the commit
  • Removing chunks that don't belong to the commit, e.g. accidental edits
  • Renaming newly added identifiers
  • Renaming newly added files (amazing feature, BTW)

I don't ever add diffs for new files in stg edit -d, which could be a concern.

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

3 participants