Rebirth of the Night (RotN)

Rebirth of the Night (RotN)

1M Downloads

[Enhancement] Improve Git workflow

democat3457 opened this issue · 9 comments

commented

Ever get those pesky merge conflicts about the files under config/fantasticlib/reference and config/multimob/? Well, there is a wonderful solution that I ask all contributors to do.

git update-index --assume-unchanged config/fantasticlib/reference/
git update-index --assume-unchanged config/multimob/mobInformation/
git update-index --skip-worktree config/jei/
git update-index --skip-worktree config/InvTweaks.cfg
git config --global filter.defaultlistfilter.clean "sed 's/#    >> Block_Array:\[ Value={ mod_id:block_id, mod_id:block_id\[<properties>], mod_id:\* }, Default={ .* } ]/#    >> Block_Array:[ Value={ mod_id:block_id, mod_id:block_id[<properties>], mod_id:* }, Default={ long_list_here } ]/'"
git config --global filter.slashfilter.clean "sed 's:config\\itlt\\icon.png:config/itlt/icon.png:'"

This solution allows git to ignore any local changes to fantasticlib/ and multimob/ while also accepting pull changes (basically telling git to ignore any local changes to this file on this revision). However, if the files are changed and they are pulled, the flag will get reset and will need to be added again, unless more merge conflicts are wanted - this is why all contributors need to do these commands.

This solution also uses the --skip-worktree flag, which tells git to never touch these files but keep them in the repository. If any of the files are changed locally or are changed via a pull, any local changes will not be tracked by git (basically telling git to ignore any local changes to this file on any revisions). This is especially useful for files that should never be touched but should still be present in the repository.

Actually neither of the flags is intuitive enough. Assume-unchanged assumes that a developer shouldn’t change a file. If a file was changed – than that change is not important. This flag is meant for improving performance for not-changing folders like SDKs. But if the promise is broken and a file is actually changed, git reverts the flag to reflect the reality. Probably it’s ok to have some inconsistent flags in generally not-meant-to-be-changed folders. On the other hand skip-worktree is useful when you instruct git not to touch a specific file ever. That is useful for an already tracked config file. Upstream main repository hosts some production-ready config but you would like to change some settings in the config to be able to do some local testing. And you don’t want to accidentally check the changes in such file to affect the production config. In that case skip-worktree makes perfect scene.

From https://fallengamer.livejournal.com/93321.html

commented

how do we do this

commented

Run the commands that are in the codeblock line-by-line while inside a terminal or command prompt that is at the repository location. For example, if your RotN development location was at C:/Users/myname/Documents/RotN then you would open the command prompt, type cd C:\Users\myname\Documents\RotN, hit enter, then type each of the lines and hit enter after each line.

commented

nice thanks demo, done

commented

git isn't recognized as a valid command :c

commented

wat

commented

if you have git installed, it should work

commented

he doesn't

commented

oh. rip

commented

UPDATE: Also run these two commands to add specific lines to a filter (that will help reduce unnecessary merge conflicts and file changes):

git config --global filter.defaultlistfilter.clean "sed 's/#    >> Block_Array:\[ Value={ mod_id:block_id, mod_id:block_id\[<properties>], mod_id:\* }, Default={ .* } ]/#    >> Block_Array:[ Value={ mod_id:block_id, mod_id:block_id[<properties>], mod_id:* }, Default={ long_list_here } ]/'"
git config --global filter.slashfilter.clean "sed 's:config\\itlt\\icon.png:config/itlt/icon.png:'"

Goes with commit 861539a