From: Matthieu Moy <Matthieu.Moy@matthieu-moy.fr>
To: Pratyush Yadav <me@yadavpratyush.com>
Cc: Matthieu Moy <git@matthieu-moy.fr>,
git@vger.kernel.org, corentin.bompard@etu.univ-lyon1.fr,
gitster@pobox.com, nathan.berbezier@etu.univ-lyon1.fr,
pablo.chabanne@etu.univ-lyon1.fr
Subject: Re: [PATCH] pull, fetch: add --set-upstream option
Date: Mon, 19 Aug 2019 11:08:05 +0200 [thread overview]
Message-ID: <86a7c5cykq.fsf@matthieu-moy.fr> (raw)
In-Reply-To: <20190814171404.zqtd4xctjobgpzby@localhost.localdomain> (Pratyush Yadav's message of "Wed, 14 Aug 2019 22:44:04 +0530")
Pratyush Yadav <me@yadavpratyush.com> writes:
> This is not really a review. Just some minor nitpicks I spotted while
> reading through.
Thanks for the comments.
>> -static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity, deepen_relative;
>> +static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity, deepen_relative, set_upstream;
>
> This line is getting pretty long. I think it is a good idea to split it
> into two.
Indeed, and it was already >80 characters, I've split it.
>> + if (set_upstream) {
>> + struct branch *branch = branch_get("HEAD");
>> + struct ref *rm;
>> + struct ref *source_ref = NULL;
>> +
>> + /*
>> + * We're setting the upstream configuration for the current branch. The
>> + * relevent upstream is the fetched branch that is meant to be merged with
>> + * the current one, i.e. the one fetched to FETCH_HEAD.
>> + *
>> + * When there are several such branches, consider the request ambiguous and
>> + * err on the safe side by doing nothing and just emit a warning.
>> + */
>
> The comment lines cross the 80 column boundary. The usual convention in
> this project is to try to keep lines below 80 columns. For strings IMO
> an exception can be allowed because breaking them up makes it harder to
> grep for them. But comments are the easiest to format.
>
> Are you using a tab size of 4?
I'm not, but it's possible that the original authors had. Anyway, I've
wrapped it.
>> + for (rm = ref_map; rm; rm = rm->next) {
>> + if (!rm->peer_ref) {
>> + if (source_ref) {
>> + warning(_("multiple branch detected, incompatible with --set-upstream"));
>> + goto skip;
>> + } else {
>> + source_ref = rm;
>> + }
>> + }
>> + }
>> + if (source_ref) {
>> + if (!strcmp(source_ref->name, "HEAD") ||
>
> This line has a trailing space.
Fixed.
> So this should change to something like:
>
> install_branch_config(0, branch->name,
> transport->remote->name,
> source_ref->name);
I've added a newline after the comma, I don't like mixing "several
arguments on the same line" and "one argument per line".
>
> Maybe this discrepancy is because you are using the wrong tab size?
>
>> + } else if (starts_with(source_ref->name, "refs/remotes/")) {
>> + warning(_("not setting upstream for a remote remote-tracking branch"));
>> + } else if (starts_with(source_ref->name, "refs/tags/")) {
>> + warning(_("not setting upstream for a remote tag"));
>> + } else {
>> + warning(_("unknown branch type"));
>> + }
>
> No need to wrap single line if statements in braces.
Fixed.
>> +#tests for fetch --set-upstream
>
> Add a space after the '#'. Same in other comments below.
Fixed.
Thanks. Version 2 fixing all these follows.
--
Matthieu Moy
https://matthieu-moy.fr/
next prev parent reply other threads:[~2019-08-19 9:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <d21d42228425408298da9e99b5877ac9@BPMBX2013-01.univ-lyon1.fr>
2019-04-04 15:43 ` [PATCH] [WIP/RFC] add git pull and git fetch --set-upstream Matthieu Moy
2019-04-09 12:52 ` Corentin BOMPARD
2019-04-17 16:01 ` Corentin BOMPARD
2019-04-18 1:35 ` Junio C Hamano
2019-04-19 16:00 ` Corentin BOMPARD
2019-04-19 18:42 ` Corentin BOMPARD
[not found] ` <f601baa2c2a04ddea4ba32ab25d0dd21@BPMBX2013-01.univ-lyon1.fr>
2019-04-22 10:38 ` Matthieu Moy
2019-08-14 13:46 ` [PATCH] pull, fetch: add --set-upstream option Matthieu Moy
2019-08-14 17:14 ` Pratyush Yadav
2019-08-19 9:08 ` Matthieu Moy [this message]
2019-08-19 9:11 ` [PATCH v2] " Matthieu Moy
2019-08-14 17:38 ` [PATCH] " Junio C Hamano
2019-08-19 9:07 ` Matthieu Moy
2019-08-19 20:04 ` Junio C Hamano
2019-08-20 8:09 ` Matthieu Moy
[not found] ` <36559daca9d84f7a91933add734020cd@BPMBX2013-01.univ-lyon1.fr>
2019-04-18 9:51 ` [PATCH] [WIP/RFC] add git pull and git fetch --set-upstream Matthieu Moy
2019-04-19 4:46 ` Junio C Hamano
[not found] ` <04f23ebf83bd4aff90ee9ca88cec984e@BPMBX2013-01.univ-lyon1.fr>
2019-04-19 9:44 ` Matthieu Moy
[not found] ` <3d2ba75520b74c2e9e8251c41d6632ba@BPMBX2013-01.univ-lyon1.fr>
2019-04-18 9:56 ` Matthieu Moy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86a7c5cykq.fsf@matthieu-moy.fr \
--to=matthieu.moy@matthieu-moy.fr \
--cc=corentin.bompard@etu.univ-lyon1.fr \
--cc=git@matthieu-moy.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@yadavpratyush.com \
--cc=nathan.berbezier@etu.univ-lyon1.fr \
--cc=pablo.chabanne@etu.univ-lyon1.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).