Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import-git-aliases doesn't understand multiline aliases #30

Closed
henrebotha opened this issue Dec 2, 2020 · 1 comment · Fixed by #31
Closed

import-git-aliases doesn't understand multiline aliases #30

henrebotha opened this issue Dec 2, 2020 · 1 comment · Fixed by #31

Comments

@henrebotha
Copy link
Contributor

I have aliases that look like this in my .gitconfig.

[alias]
	wkadd = ! "f() { \n\
		git worktree add ../$(echo \"$1\" | sed \"s./.--.g\") $2 -b $1 && \n\
		echo \"$2\" | grep -qv \"^origin/\" || git branch --unset-upstream $1; \n\
		}; f"

When I run abbr import-git-aliases, I get output like this.

Did not import the Git alias `wkadd` because its expansion is a function
Added the global user abbreviation `g$' '$'     'git`
Added the regular user abbreviation `$' '$'     'git`
Added the global user abbreviation `g$' '$'     'echo`
Added the regular user abbreviation `$' '$'     'echo`
Added the global user abbreviation `g$' '$'     '\}\;`
Added the regular user abbreviation `$' '$'     '\}\;`

The first line of course makes sense, but the rest don't.

import-git-aliases should probably be made more aware of multiline aliases so that it knows to skip the whole alias definition if it finds a function alias, and not just the first line of it.

@olets
Copy link
Owner

olets commented Dec 2, 2020

Thanks for catching that! And happy to know someone's used import-git-aliases

@olets olets closed this as completed in #31 Dec 13, 2020
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 a pull request may close this issue.

2 participants