git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH v3 3/4] doc: dissuade users from trying to ignore tracked files

From
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
Date
Nov 2, 2019, 20:14 UTC
Message-ID
<001501d591ba$1d190060$574b0120$@nexbridge.com>
In-Reply-To
<20191102192615.10013-4-sandals@crustytoothpaste.net>
On November 2, 2019 3:26 PM, brian m. carlson wrote:
> It is quite common for users to want to ignore the changes to a file that
Git
Show 11 quoted lines
> tracks.  Common scenarios for this case are IDE settings and configuration
> files, which should generally not be tracked and possibly generated from
> tracked files using a templating mechanism.
> 
> However, users learn about the assume-unchanged and skip-worktree bits
> and try to use them to do this anyway.  This is problematic, because when
> these bits are set, many operations behave as the user expects, but they
> usually do not help when git checkout needs to replace a file.
> 
> There is no sensible behavior in this case, because sometimes the data is
> precious, such as certain configuration files, and sometimes it is
irrelevant
> data that the user would be happy to discard.
> 
> Since this is not a supported configuration and users are prone to misuse
the
Show 8 quoted lines
> existing features for unintended purposes, causing general sadness and
> confusion, let's document the existing behavior and the pitfalls in the
> documentation for git update-index so that users know they should explore
> alternate solutions.
> 
> In additon, let's provide a recommended solution to dealing with the
> common case of configuration files, since there are well-known approaches
> used successfully in many environments.

Just noodling about a potential solution. If we assume the use case that files are modified by an IDE that have no real relevance, but should not interfere with other git operations including checkout...

What if we introduce something like .gitignore.changes, with the same syntax as .gitignore. The difference is files listed in this file will not show in git status (or could show as "changes ignored" with an option to enable that. The only way to have the changes considered would be git add -f, so git add . and git commit -a would not pick up the changes. From checkout's perspective, the file would be considered unmodified so if a change is incoming for that path, checkout replaces it instead of rejecting the checkout, otherwise the file is untouched. Pull would act similarly. Branch switching would be permitted without stashing the files - they would remain unchanged unless the switch modified the files.

OTOH, this is a change that is most relevant to IDE users, so JGit would have to implement it as well to really get any real benefit.

This does have some benefit in post-install situations as well as the IDE use-case, but for that I might want to consider finer granularity, like some way to identify regions of files being ignored. This being a pretty deep rabbit hole we'd end up following.

If this idea seems reasonable, it might make a nice small project for someone, possibly me, if I could unentangle from my current hellish $DAYJOB project.

Just my few coins of thought.
Randall
Previous: brian m. carlsonNext: Jakub Narebski
Message 6 of 25 in “Documentation for common user misconceptions”
  1. 0/4 Documentation for common user misconceptionsbrian m. carlson, Nov 2, 2019
  2. 2/4 doc: provide guidance on user.name formatbrian m. carlson, Nov 2, 2019
  3. Jakub NarebskiNov 3, 2019
  4. brian m. carlsonNov 3, 2019
  5. 3/4 doc: dissuade users from trying to ignore tracked filesbrian m. carlson, Nov 2, 2019
  6. rsbecker@nexbridge.comNov 2, 2019
  7. Jakub NarebskiNov 3, 2019
  8. Jakub NarebskiNov 3, 2019
  9. brian m. carlsonNov 3, 2019
  10. Jakub NarebskiNov 3, 2019
  11. brian m. carlsonNov 3, 2019
  12. Jakub NarebskiNov 5, 2019
  13. Jeff KingNov 4, 2019
  14. brian m. carlsonNov 4, 2019
  15. 4/4 docs: mention when increasing http.postBuffer is valuablebrian m. carlson, Nov 2, 2019
  16. 1/4 doc: move author and committer information to git-commit(1)brian m. carlson, Nov 2, 2019
  17. Jakub NarebskiNov 3, 2019
  18. Jeff KingNov 4, 2019
  19. Junio C HamanoNov 6, 2019
  20. Jeff KingNov 4, 2019
  21. Junio C HamanoNov 6, 2019
  22. brian m. carlsonNov 6, 2019
  23. Junio C HamanoNov 6, 2019
  24. Emily ShafferJan 16, 2020
  25. brian m. carlsonJan 16, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.