Repository navigation
Mount the gitconfig at the container user's home directory - #365
Conversation
The git extension guessed the target as /home/<host username>/.gitconfig, which does not match the home directory the user extension creates in the container when the host home is not /home/<name>, e.g. /root for root. Use the same home directory logic as the user extension. Fixes osrf#337
tfoote
left a comment
There was a problem hiding this comment.
Thanks this is good to consolidate the logic together and make sure it stays in sync.
Can you look into making this cleaner with a staticmethod if possible so we don't end up with Extensions being created just to share their cli parsing logic?
| if 'user_override_name' in cli_args and cli_args['user_override_name']: | ||
| username = cli_args['user_override_name'] | ||
| user_gitconfig_target = '/home/%(username)s/.gitconfig' % locals() | ||
| homedir = User().get_home_dir(cli_args) |
There was a problem hiding this comment.
My first reaction here was that this should potentially be a staticmethod or a classmethod rather than a member method. In particular it doesn't make sense to have the Git extension creating a User extension temporarily just to call one argument parsing function from it. Especially when it's being default constructed and then immediately drops out of scope. So we're clearly not saving or storing any state.
The Git extension no longer builds a User extension just to read the home directory.
tfoote
left a comment
There was a problem hiding this comment.
Thanks this is great to make consistent.
The git extension guessed the target as /home//.gitconfig, which does not match the home directory the user extension creates in the container when the host home is not /home/, e.g. /root for root. Use the same home directory logic as the user extension.
Fixes #337