git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

`git-extras update` disregards aliases

Open apjanke opened this issue 9 years ago • 8 comments

If I install git-extras manually, I get prompts for conflicting aliases, and can skip those.

~/local/opp/git/git-extras
[~/local/opp/git/git-extras on ⇄ relocatable-etc]
$ make PREFIX=/tmp/gitex SYSCONFPREFIX=/tmp/gitex install
... installing bins to /tmp/gitex/bin
... installing man pages to /tmp/gitex/share/man/man1
... installing git-archive-file
... installing git-authors
... installing git-back
git-bug conflicts with an alias, still install it and disable the alias? [y/n]n
... installing git-changelog

With git-extras update, it doesn't issue the prompt, and just clobbers all the aliases with commands.

$ git config --get-regexp 'alias.*'
alias.bug git checkout
[~]
$ git-extras update
...
... installing git-back
... installing git-bug
... installing git-changelog
... installing git-chore
... installing git-commits-since

I suspect it's because the curl -s | bash form that git-extras update uses from #381 is incompatible with the prompting the Makefile does: it can't read user response from stdin because the script it's executing is on stdin instead.

apjanke avatar Oct 02 '15 08:10 apjanke

//cc @spacewander

hemanth avatar Oct 02 '15 16:10 hemanth

The alias detection seems a bit tricky in other ways. What gets installed depends on what user you install it as, since git configuration is per-user. And if you're in a repo when you do the installation, it will detect aliases local to that repo, too. (Could be fixed by doing --global with the config --get-regexp.) I wonder if there's a runtime way to prioritize user aliases instead?

apjanke avatar Oct 02 '15 20:10 apjanke

I wonder if there's a runtime way to prioritize user aliases instead?

No, [a git command will shadow an alias](I wonder if there's a runtime way to prioritize user aliases instead?).

nicolaiskogheim avatar Oct 02 '15 23:10 nicolaiskogheim

A runtime way to prioritize user aliases... Err, we can put something at the head of scripts like is_git_repo, and detect if an user alias of the same name exists. But I don't think it is a good idea.

I just got a new idea about alias conflict avoidance. Instead of prompting it in the Makefile, we can just throw out warning, and tell the users how to remove conflicted files.

spacewander avatar Oct 03 '15 09:10 spacewander