Closed
Description
I have git-branchless setup in this repository and for the longest time I was confounded, why set_tracking_branch
did not work (anymore).
Turns out, git-branchless adds an [include]
section to the .git/config
file and this causes GitPython to quietly skip writing the config changes back that are necessary for set_tracking_branch
to have any effect.
Could we maybe set merge_includes=False
for the config_writer; at least in the Head class?
Activity
Byron commentedon Jul 14, 2023
A PR with a fix would definitely be welcome. It seems the issue is that configuration that was read with
merge_includes
can't write itself back to a single file as that would write too much. Maybe there is a way to letset_tracking_branch
read its repository configuration without includes, so the writing will work as expected.bodograumann commentedon Jul 17, 2023
I have looked a bit at git's own config implementation and from what I understand there is a similar option
respect_includes
there akin to whatmerge_includes
does here.The respective command-line flag is
--includes
, but that does not take effect while writing a config setting, leavingrespect_includes
disabled.So what we should do here, is to disable
merge_includes
for theconfig_writer
everywhere as well.That seems easy enough. It means a slight change to the public API, because in principle a config_writer could have been used to read as well, but I think the upside of following the official git implementation is well worth it.
I'll try sending a PR later.