Re: Issue with global config defaults "user.useConfigOnly = true" + "pull.rebase = preserve" - "user.email"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 29, 2016, 17:47 UTC
- Message-ID
- <xmqqoa5gnxow.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAG0BQXnVAYdpk9EM_uiD+=UKSKmK=z1YEar5MresTr5XfDCxHw@mail.gmail.com>
Dakota Hawkins <dakotahawkins@gmail.com> writes:
Show 14 quoted lines
> I have a question which may be a bug (I'm a bit skeptical), but here goes: > > In my global .gitconfig, I have "user.useConfigOnly = true" and > user.email isn't set there (I prefer to be forced to set it on a > per-repo basis, as I use different emails for work and personal > repos). I ALSO have "pull.rebase = preserve" set. > > An example of the problem I have is with tools like golang (I filed an > issue there, they closed it and suggested the problem is with git or > my config: https://github.com/golang/go/issues/16516#issuecomment-235800085) > that use git to pull in package repos without any real user > interaction. When something like that runs a git pull for me (to > update a package repo) my global config makes it try to rebase, which > fails because git doesn't know who I am.
It's an interesting chicken-and-egg problem that user.useConfigOnly introduces. It seems that the design of that configuration variable is not perfect and has room for improvement.
Show 9 quoted lines
> In those cases specifically, I never have local commits that differ > from the remote, so a "pull --ff-only" should leave me in the same > state as a "pull --rebase". > > Is this a case of rebase trying to make sure it has enough information > for me to be a committer before knowing whether I even need to rewrite > any commits, and could/should that be avoided? Alternatively (or also) > could/should rebase detect that a fast-forward is possible and prefer > to do that instead?
I think that is a reasonable argument, but to solve this for a more general case, shouldn't we be discussing a solution that would also work when rebase _does_ need to create a new commit? And when the latter is solved, I would imagine that "this rebase happens to be fast-forward, and not having an ident shouldn't be an issue for this special case" would become moot.