This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253482 - Unable to set default committer and author
Summary: Unable to set default committer and author
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-15 05:27 UTC by hifi
Modified: 2015-09-13 01:22 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hifi 2015-07-15 05:27:56 UTC
When you make a commit and you type your *actual* name and email address in the "Author" and "Committer" fields, NetBeans will still always default to whatever username you have on your system and you need to re-select them every time.

NetBeans should do these two things:

a) Have a field for Author and Committer in Options -> Team -> Versioning -> Git which will be the default when nothing is in .git/config
b) Save the selected/typed author/committer to the LOCAL .git/config of the current repository making it the sticky default for that only

I have in the past located the global .gitconfig on Windows, created it and set up my Author and Committer but that's way too much to ask just to get your name set up.
Comment 1 Ondrej Vrabec 2015-07-15 06:56:45 UTC
well, b) makes sense. If there is no author set yet, you should be offered to persist the author in .git/config.
Comment 2 hifi 2015-07-15 07:00:46 UTC
How a) does not make sense? If it in practice is a nicer UI to ~/.gitconfig and in many cases the global default is what you mostly want to be offered and not your system username which is usually worse than forcing you to type something.
Comment 3 Ondrej Vrabec 2015-07-15 07:03:54 UTC
a) is the same as setting the author in the global gitconfig. I am not a fan of duplicating settings in NetBeans.
Comment 4 hifi 2015-07-15 07:06:10 UTC
(In reply to Ondrej Vrabec from comment #3)
> a) is the same as setting the author in the global gitconfig. I am not a fan
> of duplicating settings in NetBeans.

But that's exactly what I said, to have an UI for global gitconfig for your personal info. It's not duplicating settings but having an UI for them.
Comment 5 hifi 2015-07-15 07:19:56 UTC
Let me rephrase as it seems I was somewhat ambiguous:

When you make a commit to a repository, first prioritize repository local .git/config for default author and committer. If they are not set, look them in global .gitconfig. If they are not set, use the horrible default of what it already offers.

And when you do *change* them in the fields of your commit window, it would always save them as the defaults in repository local .git/config.

Make sense?
Comment 6 Ondrej Vrabec 2015-07-15 07:24:28 UTC
(In reply to hifi from comment #5)
> When you make a commit to a repository, first prioritize repository local
> .git/config for default author and committer. If they are not set, look them
> in global .gitconfig. If they are not set, use the horrible default of what
> it already offers.
That's how it behaves at the moment i believe. The order is:
- .git/config
- user global config
- system global config
- useless machine-name derived username
> And when you do *change* them in the fields of your commit window, it would
> always save them as the defaults in repository local .git/config.
Not always, that does not make sense. Git users often apply other people's patches and for them you want to temporarily commit the patch as the original author (author of the patch). But that's just temporary setting, next time you'll be committing as *you* again, so you want to keep the author that's already set in the config file.
Comment 7 Ondrej Vrabec 2015-07-15 07:26:01 UTC
Isn't it that you're just trying to solve the state when the author is not yet set in the global user nor repository-level config?
Comment 8 hifi 2015-07-15 07:38:15 UTC
(In reply to Ondrej Vrabec from comment #6)
> (In reply to hifi from comment #5)
> > When you make a commit to a repository, first prioritize repository local
> > .git/config for default author and committer. If they are not set, look them
> > in global .gitconfig. If they are not set, use the horrible default of what
> > it already offers.
> That's how it behaves at the moment i believe. The order is:
> - .git/config
> - user global config
> - system global config
> - useless machine-name derived username

Ok, then the internal order is right and nothing needs to be changed regarding that, only more UIs.

> > And when you do *change* them in the fields of your commit window, it would
> > always save them as the defaults in repository local .git/config.
> Not always, that does not make sense. Git users often apply other people's
> patches and for them you want to temporarily commit the patch as the
> original author (author of the patch). But that's just temporary setting,
> next time you'll be committing as *you* again, so you want to keep the
> author that's already set in the config file.

Then what you suggested, adding an option to save them as default for the current repository, is the correct solution and with the current loading order it will just work as it should.

With the global config UI for your user defaults (Name & Email) it's more than enough for regular use. Isn't the "Options -> Team -> Versioning -> Git" the right place for editing user ~/.gitconfig with simple fields for the options that makes sense?

Even better, when you are making a commit and there is no user global setting, NetBeans would prompt you to set them up and open that exact place for you to save them. Git CLI does this a bit too late (suggest you to set them) when you've already made the commit.
Comment 9 Ondrej Vrabec 2015-07-30 08:39:55 UTC
Let's do it this way then:
- when committing and there is no author set yet, user is asked to persist the author set in the commit window into te repository .gitconfig
- i will look at bug 253483 that would allow user to open the global config and set the author there manually.
- please file another enhancement request (not a defect) for setting the global username/email in Tools->Options, i will consider that also and save that setting in the global user config file.
Comment 10 hifi 2015-08-02 19:27:16 UTC
Proposed changes are reasonable and will fix all remaining issues as far as I could tell. Filed bug 254082 for the UI bit. Thanks.
Comment 11 Ondrej Vrabec 2015-09-11 12:25:52 UTC
fix: http://hg.netbeans.org/core-main/rev/db9a1fe61c87
Comment 12 Quality Engineering 2015-09-13 01:22:48 UTC
Integrated into 'main-silver', will be available in build *201509130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/db9a1fe61c87
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #253482 - Unable to set default committer and author
Ask user to persist the current author as the default repository
user when the repository has no user specified yet.