On Mon, 23 Apr 2018 10:47:09 -0700 Jonathan Nieder <jrnieder@xxxxxxxxx> wrote: > Hi, > Hi Jonathan, thank you for your comment. > Antonio Ospite wrote: > > > vcsh[1] uses bare git repositories and detached work-trees to manage > > *distinct* sets of configuration files directly into $HOME. > > Cool! I like the tooling you're creating for this, though keep in mind > that Git has some weaknesses as a tool for deployment. > I am not the author BTW, just a user trying to address the remaining corner cases. > In particular, keep in mind that when git updates a file, there is a > period of time while it is missing from the filesystem, which can be > problematic for dotfiles. > Thanks for the reminder, it may be worth mentioning this in vcsh documentation, however I don't have knowledge of users experiencing problems related to that. > [...] > > However when multiple repositories take turns using the same directory > > as their work-tree, and more than one of them want to use submodules, > > there could still be conflicts about the '.gitmodules' file because git > > hardcodes this path. > > > > For comparison, in case of '.gitignore' a similar conflict might arise, > > but git has alternative ways to specify exclude files, so vcsh solves > > this by setting core.excludesFile for each repository and track ignored > > files somewhere else (in ~/.gitignore.d/$VCSH_REPO_NAME). > > For reference: > > core.excludesFile > Specifies the pathname to the file that contains > patterns to describe paths that are not meant to be > tracked, in addition to .gitignore (per-directory) and > .git/info/exclude. Defaults to > $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is > either not set or empty, $HOME/.config/git/ignore is > used instead. See gitignore(5). > > Using this as a substitute for <worktree>/.gitignore is a bit of a > hack. It happens to work, though, so reading on. :) > > [...] > > So this series proposes a mechanism to set an alternative path for the > > submodules configuration file (from now on "gitmodules file"). > > I am nervous about this. I wonder if there is another way to > accomplish the goal. > > One possibility would be to handle the case where .gitmodules is > excluded by a sparse checkout specification and use .gitmodules from > the index in that case. Would that work for you? > Since part of the problem is that .gitmodules *collide* between repositories, a sparse-checkout approach make sense indeed. As discussed[1] with Stefan Beller having git use .gitmodules from the index without the need to have it checked out should work for us. [1] https://www.spinics.net/lists/git/msg329153.html Ideally git should also be able to write to that file when it's not checked out (e.g. when running "git submodule add"), to save the user from tedious sparse/unsparse rounds when operating with submodules. As suggested by Stefan I'll first try to remove the hardcoded references to .gitmodules in git-submodule.sh adding a helper sub-command to access .gitmodules in a more robust way, and after that git could be taught to use the file from the index, but this second part is currently beyond my current git knowledge. If this mechanism of using unchecked-out files from the index could be extended to .gitignore (and .gitattributes), then vcsh might even stop abusing core.excludesFile; sparse checkouts seem the more natural git way to deal with colliding files in a shared-workdir scenario. However, having users *write* to .gitignore and .gitattributes while they are not checked out still sounds quite problematic to me, but maybe this could be handled by vcsh itself, similarly to what is done for the file pointed by core.excludesFile. Ciao, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?