-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
Make rebase.autostash default #1307
base: master
Are you sure you want to change the base?
Conversation
Welcome to GitGitGadgetHi @ohhmm, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that your Pull Request has a good description, as it will be used as cover letter. You can CC potential reviewers by adding a footer to the PR description with the following syntax:
Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:
It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code. Contributing the patchesBefore you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form Both the person who commented An alternative is the channel
Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment If you want to see what email(s) would be sent for a After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail). If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the curl -g --user "<EMailAddress>:<Password>" \
--url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):
To send a new iteration, just add another PR comment with the contents: Need help?New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join. You may also be able to find help in real time in the developer IRC channel, |
There are issues in commit f2795a4: |
/allow |
User ohhmm is now allowed to use GitGitGadget. WARNING: ohhmm has no public email address set on GitHub; |
@ohhmm this is a template that was supposed to be acknowledged and then edited...
Apart from missing the Signed-off-by footer (see https://git-scm.com/docs/SubmittingPatches#sign-off for details), the commit messages in the Git project are expected to be much more than one-liners. See https://github.blog/2022-06-30-write-better-commits-build-better-projects/ for guidance how to improve the commit message substantially. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have missed https://github.com/git/git/blob/v2.37.1/builtin/rebase.c#L786-L789
There are issues in commit d70b9d2: |
75ed67e
to
106a056
Compare
Ok. Ready. Thanks. |
@ohhmm then it's time to |
/submit |
Submitted as pull.1307.git.git.1660831231.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
@@ -19,7 +19,7 @@ rebase.autoStash:: | |||
successful rebase might result in non-trivial conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, "brian m. carlson" wrote (reply to this):
On 2022-08-18 at 14:00:30, Sergio via GitGitGadget wrote:
> From: Sergio <sergeikrivonos@gmail.com>
>
> Signed-off-by: Sergio <sergeikrivonos@gmail.com>
Typically you'll want to explain in the commit message why this is a
valuable change. For example, I don't have this option set and don't use
it, and I always stash my changes manually before rebasing. You should
tell me why the user will benefit from this setting defaulting to
enabled, since I personally don't see a need for it.
You may also want to discuss why any pitfalls of stash, such as unadded
changes being added after a stash pop, are not problematic here and why
this behaviour won't be more surprising or annoying to experienced users
who are used to seeing an error message instead.
This isn't to say that the change is bad or we shouldn't accept it, only
that I (and others) need help understanding why it's a good change to make.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
User |
.gitignore
Outdated
@@ -246,3 +246,5 @@ Release/ | |||
/git.VC.db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, "brian m. carlson" wrote (reply to this):
On 2022-08-18 at 14:00:31, Sergio via GitGitGadget wrote:
> From: Sergio <sergeikrivonos@gmail.com>
>
> Signed-off-by: Sergio <sergeikrivonos@gmail.com>
> ---
> .gitignore | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/.gitignore b/.gitignore
> index 42fd7253b44..13755c31caf 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -246,3 +246,5 @@ Release/
> /git.VC.db
> *.dSYM
> /contrib/buildsystems/out
> +/.cproject
> +/.project
I have no strong opinion on this change, but typically, to avoid a
proliferation of patterns with everyone's favourite editor settings, it
can be useful if each individual user sets their own editor files in
~/.config/git/ignore (or core.excludesFile, if you prefer a different
location). For example, I do this with Vim-related files, and it
applies to all repos on my system, such that other developers don't have
to care what editor I use.
However, Eclipse is a popular editor, so it may be that Junio really
likes this change since it will benefit many people.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> location). For example, I do this with Vim-related files, and it
> applies to all repos on my system, such that other developers don't have
> to care what editor I use.
>
> However, Eclipse is a popular editor, so it may be that Junio really
> likes this change since it will benefit many people.
I am all for making new contributor's life better, and in this case,
NOT adding editor-specific patterns to OUR .gitignore contributes
better for that goal. It will be a shame for us to make a move that
will keep our contributors unaware of what they can do with Git, and
in this case, lack of Eclipse specific patterns did trigger Sergio
to notice that these are not ignored, and learn that a better place
to do so is in $HOME/.gitignore, because it will help not only when
the contributor works on Git, but when the same contributor works on
anything using Eclipse. Adding editor-specific patterns ourselves
robs such a learning opportunity from new contributors.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, wrote (reply to this):
On August 18, 2022 2:18 PM, Junio C Hamano wrote:
>To: brian m. carlson <sandals@crustytoothpaste.net>
>Cc: Sergio via GitGitGadget <gitgitgadget@gmail.com>; git@vger.kernel.org;
>Sergei Krivonos <sergeikrivonos@gmail.com>
>Subject: Re: [PATCH 2/2] Add Eclipse project settings files to .gitignore
>
>"brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
>> location). For example, I do this with Vim-related files, and it
>> applies to all repos on my system, such that other developers don't
>> have to care what editor I use.
>>
>> However, Eclipse is a popular editor, so it may be that Junio really
>> likes this change since it will benefit many people.
>
>I am all for making new contributor's life better, and in this case, NOT
adding
>editor-specific patterns to OUR .gitignore contributes better for that
goal. It will
>be a shame for us to make a move that will keep our contributors unaware of
>what they can do with Git, and in this case, lack of Eclipse specific
patterns did
>trigger Sergio to notice that these are not ignored, and learn that a
better place to
>do so is in $HOME/.gitignore, because it will help not only when the
contributor
>works on Git, but when the same contributor works on anything using
Eclipse.
>Adding editor-specific patterns ourselves robs such a learning opportunity
from
>new contributors.
There is a related case to this in ECLIPSE,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575408, discussing a problem
with where ECLIPSE CDT is improperly storing and modifying build settings.
What my project team found is that much of the ECLIPSE settings need to be
preserved, especially the encodings - .gitignore is not a valid option for
these. ECLIPSE has a habit of inheriting container encodings, which is not
always correct (we keep our files in UTF-8 not cp1292). Most settings should
be retained, but the ones in .settings/language.settings.xml changes each
time ECLIPSE restarts or sometimes clones a project. Unfortunately, some of
the settings in that file are needed to bootstrap builds for new clones. The
case has been open a while with no resolution. Whether a good idea or not,
what our team found an acceptable solution is to use update-index
--assume-unchanged on that specific file and manage other ECLIPSE artifacts
in git not excluding them in .gitignore.
--Randall
@@ -19,7 +19,7 @@ rebase.autoStash:: | |||
successful rebase might result in non-trivial conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
"Sergio via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Sergio <sergeikrivonos@gmail.com>
Neither the cover letter nor the proposed log message even attempt
to justify why this is a good change.
Probably that is because it is not justifiable. I do not think it
is a good idea to change the default, either.
> diff --git a/builtin/pull.c b/builtin/pull.c
> index 403a24d7ca6..333d6a232a7 100644
> --- a/builtin/pull.c
> +++ b/builtin/pull.c
> @@ -362,7 +362,7 @@ static int git_pull_config(const char *var, const char *value, void *cb)
> int status;
>
> if (!strcmp(var, "rebase.autostash")) {
> - config_autostash = git_config_bool(var, value);
> + config_autostash = git_config_bool_or_default(var, value, 1);
This is wrong. What this says is "if the user has rebase.autostash,
attempt to interpret its value as a Boolean, and store it in this
variable. If the value cannot be read as a Boolean, pretend as if
true was given".
That does not set the default to a configuration variable. The
default is the value used when the user does *NOT* specify
rebase.autostash anywhere, but anything the code does inside the
block guarded by that strcmp() cannot affect that case.
If it were a good idea to make the variable default to true, the
place to do so would probably be
diff --git i/builtin/pull.c w/builtin/pull.c
index 403a24d7ca..0bb8421dfc 100644
--- i/builtin/pull.c
+++ w/builtin/pull.c
@@ -87,7 +87,7 @@ static char *opt_ff;
static char *opt_verify_signatures;
static char *opt_verify;
static int opt_autostash = -1;
-static int config_autostash;
+static int config_autostash = 1; /* default to true */
static int check_trust_level = 1;
static struct strvec opt_strategies = STRVEC_INIT;
static struct strvec opt_strategy_opts = STRVEC_INIT;
> diff --git a/config.c b/config.c
> index e8ebef77d5c..c4f6da3547e 100644
> --- a/config.c
> +++ b/config.c
> @@ -1437,6 +1437,14 @@ int git_config_bool(const char *name, const char *value)
> return v;
> }
>
> +int git_config_bool_or_default(const char *name, const char *value, int default_value)
> +{
> + int v = git_parse_maybe_bool(value);
> + if (v < 0)
> + v = default_value;
> + return v;
> +}
And this is not a useful helper function. At least, this is not
useful for this particular case. We have tristate Booleans that
take yes/no/auto, and
git_config_bool_or_default(name, value, 2);
can take "name.value=auto" and turn it into 2 (instead of 0=no
1=yes), but because the helper takes *any* garbage that is not a
Boolean and gives the same default_value, the value does not have to
be "auto" here, which makes the helper pretty much useless.
The patch is incomplete. It only changes "git pull" but does not
do anything to "git rebase".
User |
Signed-off-by: Sergio <sergeikrivonos@gmail.com>
Thanks for taking the time to contribute to Git! Please be advised that the
Git community does not use github.com for their contributions. Instead, we use
a mailing list (git@vger.kernel.org) for code submissions, code reviews, and
bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/)
to conveniently send your Pull Requests commits to our mailing list.
Please read the "guidelines for contributing" linked above!
cc: "brian m. carlson" sandals@crustytoothpaste.net
cc: rsbecker@nexbridge.com