Skip to content

Change {Key: key, Value: xxx} to {key: xxx}#17

Open
kuyacarlo wants to merge 2 commits into
dotzero:masterfrom
kuyacarlo:feat/minify-config
Open

Change {Key: key, Value: xxx} to {key: xxx}#17
kuyacarlo wants to merge 2 commits into
dotzero:masterfrom
kuyacarlo:feat/minify-config

Conversation

@kuyacarlo

@kuyacarlo kuyacarlo commented Jun 26, 2026

Copy link
Copy Markdown

changed the config file to key:value instead of Key: value, Value: value

How about current installs?

Upon update, it would migrate from old configuration to new configuration in place.

Note: after this update, the config won't be backwards compatible.

Possible Fix

Put the new config into the config directly with XDG

@dotzero

dotzero commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR! I really like the direction of moving toward XDG support, but I have some concerns about the current implementation.

One of the goals of the current architecture is to allow complete isolation of any Git configuration, not just user identity settings.

For example, it’s currently possible to do something like:

git-profile add work core.autocrlf input

With the approach proposed in this PR, the tool becomes limited to just three settings: user.name, user.email, and user.signingkey.

I’d like to preserve the existing flexibility, since it allows users to isolate and manage arbitrary Git configuration values, not only identity-related ones.

- test: add testing for old and new config formats
- feat: sort by configuration keys when using `list` command
@kuyacarlo

Copy link
Copy Markdown
Author

Thanks for the PR! I really like the direction of moving toward XDG support, but I have some concerns about the current implementation.

Thanks, I was totally wondering on how to remove homedir entirely, since its deprecated and all. ATM, only root.go uses it. We can find another library, or just homebrew it such as below. Not sure if I should add it in this PR, however.

func ParseFilePath(fp string) (string, error) {
	if fp == "" {
		return "", fmt.Errorf("empty path")
	}

	// ~ to home
	if fp == "~" {
		return xdg.Home, nil
	}

	// ~/path to home/path
	if strings.HasPrefix(fp, "~/") {
		return filepath.Join(xdg.Home, fp[2:]), nil
	}

	// ~username unsupported, SSH config shouldn't need this probably
	if strings.HasPrefix(fp, "~") && fp[1] != '/' {
		return "", fmt.Errorf("unsupported: ~username expansion")
	}

	// clean it up
	return filepath.Clean(fp), nil
}

One of the goals of the current architecture is to allow complete isolation of any Git configuration, not just user identity settings.

For example, it’s currently possible to do something like:

git-profile add work core.autocrlf input

With the approach proposed in this PR, the tool becomes limited to just three settings: user.name, user.email, and user.signingkey.

I’d like to preserve the existing flexibility, since it allows users to isolate and manage arbitrary Git configuration values, not only identity-related ones.

This is absolutely my bad, I was very conflicted on whether I should use what's on the files themselves, or be flexible, along with my somewhat inexperience with go, of which I played safe. On that note, the new commits does allow for flexibility specified in your comment.

@kuyacarlo kuyacarlo changed the title Change {Key: user.xxx, Value: xxx} to {user.xxx: xxx} Change {Key: key, Value: xxx} to {key: xxx} Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants