git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] fetch: trivial fixes
@ 2013-09-21 14:09 Felipe Contreras
  2013-09-21 14:09 ` [PATCH 1/2] fetch: add missing documentation Felipe Contreras
  2013-09-21 14:09 ` [PATCH 2/2] remote: fix trivial memory leak Felipe Contreras
  0 siblings, 2 replies; 15+ messages in thread
From: Felipe Contreras @ 2013-09-21 14:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

Felipe Contreras (2):
  fetch: add missing documentation
  remote: fix trivial memory leak

 Documentation/git-fetch.txt | 3 +++
 remote.c                    | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
1.8.4.2.gac946cf.dirty

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/2] fetch: add missing documentation
  2013-09-21 14:09 [PATCH 0/2] fetch: trivial fixes Felipe Contreras
@ 2013-09-21 14:09 ` Felipe Contreras
  2013-09-24  5:03   ` Jeff King
  2013-09-21 14:09 ` [PATCH 2/2] remote: fix trivial memory leak Felipe Contreras
  1 sibling, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-21 14:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

There's no mention of the 'origin' default, or the fact that the
upstream tracking branch remote is used.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-fetch.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index e08a028..7e75dc4 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -37,6 +37,9 @@ or from several repositories at once if <group> is given and
 there is a remotes.<group> entry in the configuration file.
 (See linkgit:git-config[1]).
 
+When no remote is specified, by the default the `origin` remote will be used,
+unless there's an upstream branch configured for the current branch.
+
 OPTIONS
 -------
 include::fetch-options.txt[]
-- 
1.8.4.2.gac946cf.dirty

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/2] remote: fix trivial memory leak
  2013-09-21 14:09 [PATCH 0/2] fetch: trivial fixes Felipe Contreras
  2013-09-21 14:09 ` [PATCH 1/2] fetch: add missing documentation Felipe Contreras
@ 2013-09-21 14:09 ` Felipe Contreras
  2013-09-24  5:19   ` Jeff King
  1 sibling, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-21 14:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

There's no need to set the default remote name beforehand, only to be
overridden later on, and causing a memory leak, we can do it after the
configuration has been handled.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 remote.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/remote.c b/remote.c
index efcba93..654e7f5 100644
--- a/remote.c
+++ b/remote.c
@@ -480,7 +480,6 @@ static void read_config(void)
 	int flag;
 	if (default_remote_name) /* did this already */
 		return;
-	default_remote_name = xstrdup("origin");
 	current_branch = NULL;
 	head_ref = resolve_ref_unsafe("HEAD", sha1, 0, &flag);
 	if (head_ref && (flag & REF_ISSYMREF) &&
@@ -489,6 +488,8 @@ static void read_config(void)
 			make_branch(head_ref + strlen("refs/heads/"), 0);
 	}
 	git_config(handle_config, NULL);
+	if (!default_remote_name)
+		default_remote_name = xstrdup("origin");
 	alias_all_urls();
 }
 
-- 
1.8.4.2.gac946cf.dirty

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-21 14:09 ` [PATCH 1/2] fetch: add missing documentation Felipe Contreras
@ 2013-09-24  5:03   ` Jeff King
  2013-09-24  5:23     ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  5:03 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Sat, Sep 21, 2013 at 09:09:22AM -0500, Felipe Contreras wrote:

> There's no mention of the 'origin' default, or the fact that the
> upstream tracking branch remote is used.

Sounds like a good thing to mention.

> diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
> index e08a028..7e75dc4 100644
> --- a/Documentation/git-fetch.txt
> +++ b/Documentation/git-fetch.txt
> @@ -37,6 +37,9 @@ or from several repositories at once if <group> is given and
>  there is a remotes.<group> entry in the configuration file.
>  (See linkgit:git-config[1]).
>  
> +When no remote is specified, by the default the `origin` remote will be used,

s/the (default the)/\1/

> +unless there's an upstream branch configured for the current branch.

Should this be "upstream remote" rather than "upstream branch"? I don't
think we should be looking at branch.*.merge at all for git-fetch.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] remote: fix trivial memory leak
  2013-09-21 14:09 ` [PATCH 2/2] remote: fix trivial memory leak Felipe Contreras
@ 2013-09-24  5:19   ` Jeff King
  2013-10-15 21:50     ` Junio C Hamano
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  5:19 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Sat, Sep 21, 2013 at 09:09:23AM -0500, Felipe Contreras wrote:

> diff --git a/remote.c b/remote.c
> index efcba93..654e7f5 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -480,7 +480,6 @@ static void read_config(void)
>  	int flag;
>  	if (default_remote_name) /* did this already */
>  		return;
> -	default_remote_name = xstrdup("origin");
>  	current_branch = NULL;
>  	head_ref = resolve_ref_unsafe("HEAD", sha1, 0, &flag);
>  	if (head_ref && (flag & REF_ISSYMREF) &&
> @@ -489,6 +488,8 @@ static void read_config(void)
>  			make_branch(head_ref + strlen("refs/heads/"), 0);
>  	}
>  	git_config(handle_config, NULL);
> +	if (!default_remote_name)
> +		default_remote_name = xstrdup("origin");
>  	alias_all_urls();

I wondered if we might also leak when seeing duplicate config options
(i.e., leaking the old one when replacing it with the new). But we don't
actually strdup() the configured remote names, but instead just point
into the "struct branch", which owns the data.

So I think an even better fix would be:

-- >8 --
Subject: remote: do not copy "origin" string literal

Our default_remote_name starts at "origin", but may be
overridden by the config file. In the former case, we
allocate a new string, but in the latter case, we point to
the remote name in an existing "struct branch".

This gives the variable inconsistent free() semantics (we
are sometimes responsible for freeing the string and
sometimes pointing to somebody else's storage), and causes a
small leak when the allocated string is overridden by
config.

We can fix both by simply dropping the extra copy and
pointing to the string literal.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
 remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/remote.c b/remote.c
index e9fedfa..9f1a8aa 100644
--- a/remote.c
+++ b/remote.c
@@ -483,7 +483,7 @@ static void read_config(void)
 	int flag;
 	if (default_remote_name) /* did this already */
 		return;
-	default_remote_name = xstrdup("origin");
+	default_remote_name = "origin";
 	current_branch = NULL;
 	head_ref = resolve_ref_unsafe("HEAD", sha1, 0, &flag);
 	if (head_ref && (flag & REF_ISSYMREF) &&
-- 
1.8.4.rc3.19.g9da5bf6

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:03   ` Jeff King
@ 2013-09-24  5:23     ` Felipe Contreras
  2013-09-24  5:30       ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-24  5:23 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, Sep 24, 2013 at 12:03 AM, Jeff King <peff@peff.net> wrote:
> On Sat, Sep 21, 2013 at 09:09:22AM -0500, Felipe Contreras wrote:
>
>> There's no mention of the 'origin' default, or the fact that the
>> upstream tracking branch remote is used.
>
> Sounds like a good thing to mention.
>
>> diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
>> index e08a028..7e75dc4 100644
>> --- a/Documentation/git-fetch.txt
>> +++ b/Documentation/git-fetch.txt
>> @@ -37,6 +37,9 @@ or from several repositories at once if <group> is given and
>>  there is a remotes.<group> entry in the configuration file.
>>  (See linkgit:git-config[1]).
>>
>> +When no remote is specified, by the default the `origin` remote will be used,
>
> s/the (default the)/\1/

Right.

>> +unless there's an upstream branch configured for the current branch.
>
> Should this be "upstream remote" rather than "upstream branch"? I don't
> think we should be looking at branch.*.merge at all for git-fetch.

As a general user, how do I configure the "upstream remote"?

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:23     ` Felipe Contreras
@ 2013-09-24  5:30       ` Jeff King
  2013-09-24  5:36         ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  5:30 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Tue, Sep 24, 2013 at 12:23:21AM -0500, Felipe Contreras wrote:

> > Should this be "upstream remote" rather than "upstream branch"? I don't
> > think we should be looking at branch.*.merge at all for git-fetch.
> 
> As a general user, how do I configure the "upstream remote"?

Yeah, it's not a term we use elsewhere, so it's not great. Probably
"default remote" would be better, or even just say "branch.*.remote for
the current branch" or something.

I dunno. I don't particularly like any of those, but I really dislike
the imprecision of "upstream branch" in this case.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:30       ` Jeff King
@ 2013-09-24  5:36         ` Felipe Contreras
  2013-09-24  5:40           ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-24  5:36 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, Sep 24, 2013 at 12:30 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Sep 24, 2013 at 12:23:21AM -0500, Felipe Contreras wrote:
>
>> > Should this be "upstream remote" rather than "upstream branch"? I don't
>> > think we should be looking at branch.*.merge at all for git-fetch.
>>
>> As a general user, how do I configure the "upstream remote"?
>
> Yeah, it's not a term we use elsewhere, so it's not great. Probably
> "default remote" would be better, or even just say "branch.*.remote for
> the current branch" or something.

Yeah, general users don't know what you are talking about when you say that.

> I dunno. I don't particularly like any of those, but I really dislike
> the imprecision of "upstream branch" in this case.

For most users it's the remote configured by:

% git branch --set-upstream-to foo
% git checkout -b foo origin/foo
% git checkout -t -b foo bar

So when they read "upstream branch" they know from where it got configured.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:36         ` Felipe Contreras
@ 2013-09-24  5:40           ` Jeff King
  2013-09-24  5:57             ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  5:40 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Tue, Sep 24, 2013 at 12:36:38AM -0500, Felipe Contreras wrote:

> > Yeah, it's not a term we use elsewhere, so it's not great. Probably
> > "default remote" would be better, or even just say "branch.*.remote for
> > the current branch" or something.
> 
> Yeah, general users don't know what you are talking about when you say that.

Right, I understand your complaint and agree that those terms are
potentially confusing.

> > I dunno. I don't particularly like any of those, but I really dislike
> > the imprecision of "upstream branch" in this case.
> 
> For most users it's the remote configured by:
> 
> % git branch --set-upstream-to foo
> % git checkout -b foo origin/foo
> % git checkout -t -b foo bar
> 
> So when they read "upstream branch" they know from where it got configured.

Yes, but it is also wrong, in the sense that the upstream branch is
unrelated. You are giving breadcrumbs to users who know "upstream
branch" as a concept and nothing else, but you are misleading users who
know that branch.*.remote exists.

I was hoping you might suggest something that can help both users by
being both precise and giving the appropriate breadcrumbs.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:40           ` Jeff King
@ 2013-09-24  5:57             ` Felipe Contreras
  2013-09-24  6:10               ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-24  5:57 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, Sep 24, 2013 at 12:40 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Sep 24, 2013 at 12:36:38AM -0500, Felipe Contreras wrote:
>
>> > Yeah, it's not a term we use elsewhere, so it's not great. Probably
>> > "default remote" would be better, or even just say "branch.*.remote for
>> > the current branch" or something.
>>
>> Yeah, general users don't know what you are talking about when you say that.
>
> Right, I understand your complaint and agree that those terms are
> potentially confusing.
>
>> > I dunno. I don't particularly like any of those, but I really dislike
>> > the imprecision of "upstream branch" in this case.
>>
>> For most users it's the remote configured by:
>>
>> % git branch --set-upstream-to foo
>> % git checkout -b foo origin/foo
>> % git checkout -t -b foo bar
>>
>> So when they read "upstream branch" they know from where it got configured.
>
> Yes, but it is also wrong, in the sense that the upstream branch is
> unrelated. You are giving breadcrumbs to users who know "upstream
> branch" as a concept and nothing else, but you are misleading users who
> know that branch.*.remote exists.

No, I'm not. The users that know branch.*.remote exists know why it
exists. The part where it is explained, 'git config --help', is
perfectly clear: "When on branch <name>, it tells 'git fetch' and 'git
push' which remote to fetch from/push to.". So what does
branch.<name>.remote does, if not precisely what the documentation
says?

This is not a rhetorical question, I'm actually expecting you to
answer, if a user knows that branch.<name>.remote exists, how would
the above confuse him?

> I was hoping you might suggest something that can help both users by
> being both precise and giving the appropriate breadcrumbs.

This is documentation for a Git porcelain command,
branch.<name>.remote is an implementation detail, and it's irrelevant
in the documentation at this level.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  5:57             ` Felipe Contreras
@ 2013-09-24  6:10               ` Jeff King
  2013-09-24  6:31                 ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  6:10 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Tue, Sep 24, 2013 at 12:57:36AM -0500, Felipe Contreras wrote:

> No, I'm not. The users that know branch.*.remote exists know why it
> exists. The part where it is explained, 'git config --help', is
> perfectly clear: "When on branch <name>, it tells 'git fetch' and 'git
> push' which remote to fetch from/push to.". So what does
> branch.<name>.remote does, if not precisely what the documentation
> says?
> 
> This is not a rhetorical question, I'm actually expecting you to
> answer, if a user knows that branch.<name>.remote exists, how would
> the above confuse him?

I do not know if by "above" you mean the part of git-config.1 you quoted
above, or the text you are proposing to put into git-fetch.1.

If the former, then I do not think it is confusing at all. The existing
text explains exactly what is going on.

If the latter, then my concern is that the term "upstream branch"
implies implies that "git fetch" depends on branch.*.merge, but it does
not.

> > I was hoping you might suggest something that can help both users by
> > being both precise and giving the appropriate breadcrumbs.
> 
> This is documentation for a Git porcelain command,
> branch.<name>.remote is an implementation detail, and it's irrelevant
> in the documentation at this level.

I don't think it is the end of the world if we say "upstream branch". I
was hoping to find a term that could be both friendly and accurate.

And failing that, I hoped you might say "I see what you are saying, but
I cannot think of a term that is more precise that does not sacrifice
friendliness". But as I seem incapable of even communicating the issue
to you, I'm giving up. It is not worth wasting more time on it.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  6:10               ` Jeff King
@ 2013-09-24  6:31                 ` Felipe Contreras
  2013-09-24  6:54                   ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Felipe Contreras @ 2013-09-24  6:31 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, Sep 24, 2013 at 1:10 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Sep 24, 2013 at 12:57:36AM -0500, Felipe Contreras wrote:
>
>> No, I'm not. The users that know branch.*.remote exists know why it
>> exists. The part where it is explained, 'git config --help', is
>> perfectly clear: "When on branch <name>, it tells 'git fetch' and 'git
>> push' which remote to fetch from/push to.". So what does
>> branch.<name>.remote does, if not precisely what the documentation
>> says?
>>
>> This is not a rhetorical question, I'm actually expecting you to
>> answer, if a user knows that branch.<name>.remote exists, how would
>> the above confuse him?
>
> I do not know if by "above" you mean the part of git-config.1 you quoted
> above, or the text you are proposing to put into git-fetch.1.
>
> If the former, then I do not think it is confusing at all. The existing
> text explains exactly what is going on.
>
> If the latter, then my concern is that the term "upstream branch"
> implies implies that "git fetch" depends on branch.*.merge, but it does
> not.

That does not answer the question. The user knows branch.<name>.remote
exists, the user reads "When no remote is specified, by the default
the upstream branch configured for the current branch will be used",
how would that confuse him?

Since you are not able to answer, I will answer for you; the user
would not be confused, because the user knows the upstream tracking
branch is composed by branch.<name>.remote+merge, if the user doesn't
know that (very highly unlikely), the user can ignore the whole text,
and the concept of "upstream branch" (which any user familiar with
branch.<name>.remote would know anyway).

So, to this hypothetical non-existent user, such text would read "When
no remote is specified, by the default whaa-whaa-whaa will be used".
Doesn't matter what whaa-whaa-whaa is, the user knows
branch.<name>.remote will be used, because that's what the
documentation for branch.<name>.remote says.

But let's imagine an even more hypothetical user who does actually
wonder what would take priority, whaa-whaa-whaa, or
branch.<name>.remote. Well, clearly, if he hasn't specifically set
whaa-whaa-whaa, then his beloved branch.<name>.remote would be used,
but wait, there's more, he wonders if whaa-whaa-whaa is actually set
somehow, without him knowing, well then there are three options: 1)
whaa-whaa-whaa takes priority, 2) branch.<name>.remote takes priority
3) they are the same. Of these only 1) is a problem.

But this extremely extremely hypothetical user can just go ahead and
google "git upstream branch", and quickly find it indeed is
branch.<name>.remote+merge.

So... Where is the problem?

>> > I was hoping you might suggest something that can help both users by
>> > being both precise and giving the appropriate breadcrumbs.
>>
>> This is documentation for a Git porcelain command,
>> branch.<name>.remote is an implementation detail, and it's irrelevant
>> in the documentation at this level.
>
> I don't think it is the end of the world if we say "upstream branch". I
> was hoping to find a term that could be both friendly and accurate.
>
> And failing that, I hoped you might say "I see what you are saying, but
> I cannot think of a term that is more precise that does not sacrifice
> friendliness". But as I seem incapable of even communicating the issue
> to you, I'm giving up. It is not worth wasting more time on it.

And I was hoping you wouldn't use rhetorical warfare and label things
as "inaccurate", "imprecise", "breadcrumbs".

At this porcelain level, branch.<name>.remote does not exist, so
"upstream branch" is accurate. Period.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  6:31                 ` Felipe Contreras
@ 2013-09-24  6:54                   ` Jeff King
  2013-09-24  7:41                     ` Felipe Contreras
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff King @ 2013-09-24  6:54 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Tue, Sep 24, 2013 at 01:31:48AM -0500, Felipe Contreras wrote:

> > I don't think it is the end of the world if we say "upstream branch". I
> > was hoping to find a term that could be both friendly and accurate.
> >
> > And failing that, I hoped you might say "I see what you are saying, but
> > I cannot think of a term that is more precise that does not sacrifice
> > friendliness". But as I seem incapable of even communicating the issue
> > to you, I'm giving up. It is not worth wasting more time on it.
> 
> And I was hoping you wouldn't use rhetorical warfare and label things
> as "inaccurate", "imprecise", "breadcrumbs".

FWIW, the term "breadcrumbs" was meant as a _good_ thing. I meant that
you are using a term that will link the user to other concepts that use
the same term (like "branch --set-upstream-to"), and that is something
we would like to keep.

As for the others, I find your accusation of rhetorical warfare
ridiculous. Insulting your patch with non-constructive insults would be
rhetorical. Saying "I think it has a flaw, here are my reasons, and I
hope we can come up with a solution that does not have that flaw without
weakening the other properties" is collaboration. Or an attempt at it
anyway.

I do not know why you and I have so much trouble communicating on even
basic things. I am willing to accept that it is entirely my fault. But
that does not change the fact that I often find it a waste of time, and
I plan to do less of it by ending my involvement in threads that seem to
be unproductive.

> At this porcelain level, branch.<name>.remote does not exist, so
> "upstream branch" is accurate. Period.

I do not agree with your first sentence at all. And your second one is
purely rhetorical.

I can elaborate if you really care, but I have a feeling you do not.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] fetch: add missing documentation
  2013-09-24  6:54                   ` Jeff King
@ 2013-09-24  7:41                     ` Felipe Contreras
  0 siblings, 0 replies; 15+ messages in thread
From: Felipe Contreras @ 2013-09-24  7:41 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, Sep 24, 2013 at 1:54 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Sep 24, 2013 at 01:31:48AM -0500, Felipe Contreras wrote:
>
>> > I don't think it is the end of the world if we say "upstream branch". I
>> > was hoping to find a term that could be both friendly and accurate.
>> >
>> > And failing that, I hoped you might say "I see what you are saying, but
>> > I cannot think of a term that is more precise that does not sacrifice
>> > friendliness". But as I seem incapable of even communicating the issue
>> > to you, I'm giving up. It is not worth wasting more time on it.
>>
>> And I was hoping you wouldn't use rhetorical warfare and label things
>> as "inaccurate", "imprecise", "breadcrumbs".
>
> FWIW, the term "breadcrumbs" was meant as a _good_ thing. I meant that
> you are using a term that will link the user to other concepts that use
> the same term (like "branch --set-upstream-to"), and that is something
> we would like to keep.

"breadcrumbs" implies it's not the full thing the user expects. While
in some cases it might indeed lead the user to further concepts, it's
also likely the user already knows what "upstream branch" means, in
which case it's not a "breadcrumb", it's the full meal.

It's as misleading as saying Atlas Shrugged is a light read, sure, it
might be to some people, but it's certainly not the case for
everybody, so saying so is not an actual fact.

> As for the others, I find your accusation of rhetorical warfare
> ridiculous. Insulting your patch with non-constructive insults would be
> rhetorical.

That actually wouldn't be rhetorical. If you say "I think this is
crap", that would simply be stating an opinion, and everyone would
understand that, saying "This is imprecise" is rhetorical, because you
convey an opinion as a fact, and it's actually much more damaging than
the former, because people wouldn't read it as an opinion, which is
precisely what rhetoric is about: persuation, rightly or not.

Even worst, you might believe it yourself.

> Saying "I think it has a flaw, here are my reasons, and I
> hope we can come up with a solution that does not have that flaw without
> weakening the other properties" is collaboration.

But you didn't say you *thought* there was a flaw, you said there was
a flaw, specifically, you said it was imprecise.

USA didn't say "Well, uhm, we think Iraq has weapons of mass
destruction", they said "Iraq has weapons of mass destruction, and
it's not a question of _if_ they are going to use them, but _when_".
These two statements cause a very different reaction from the
listener, thanks to the art of rhetoric.

> I do not know why you and I have so much trouble communicating on even
> basic things. I am willing to accept that it is entirely my fault. But
> that does not change the fact that I often find it a waste of time, and
> I plan to do less of it by ending my involvement in threads that seem to
> be unproductive.

I think it's very clear, you think your opinions are worth a hundred
times more than my opinions. Actually, it's even worst, you think your
opinions are facts. What kind of person challenges facts? only stupid
little brats on the Internet, or morons, right? But when two equals
have a difference of opinion, it's just that.

If you accepted that my opinion weighs as much has yours, and that
when we differ it might be you the one that is wrong, as much as it
might be me, things would go very differently.

>> At this porcelain level, branch.<name>.remote does not exist, so
>> "upstream branch" is accurate. Period.
>
> I do not agree with your first sentence at all.

> And your second one is purely rhetorical.

Exactly. You used rhetoric to convey your opinions as facts, so I used
it to the same effect.

> I can elaborate if you really care, but I have a feeling you do not.

If you are going to present your opinion as facts, then no, I do not care.

If you are going to explain why you *personally* *think* *in your
opinion* that branch.<name>.remote is a porcelain level concept,  then
sure, I would be interested in hearing why. But first I would like for
you do an exercise and find out where exactly does this high level
concept lands in the ProGit book.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] remote: fix trivial memory leak
  2013-09-24  5:19   ` Jeff King
@ 2013-10-15 21:50     ` Junio C Hamano
  0 siblings, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2013-10-15 21:50 UTC (permalink / raw)
  To: Jeff King; +Cc: Felipe Contreras, git

Jeff King <peff@peff.net> writes:

> I wondered if we might also leak when seeing duplicate config options
> (i.e., leaking the old one when replacing it with the new). But we don't
> actually strdup() the configured remote names, but instead just point
> into the "struct branch", which owns the data.

In addition, we do not copy this string to remote->name in make_remote(),
so even if we start allowing destruction of existing remote[], the
resulting code will stay safe.

> So I think an even better fix would be:
>
> -- >8 --
> Subject: remote: do not copy "origin" string literal
>
> Our default_remote_name starts at "origin", but may be
> overridden by the config file. In the former case, we
> allocate a new string, but in the latter case, we point to
> the remote name in an existing "struct branch".
>
> This gives the variable inconsistent free() semantics (we
> are sometimes responsible for freeing the string and
> sometimes pointing to somebody else's storage), and causes a
> small leak when the allocated string is overridden by
> config.
>
> We can fix both by simply dropping the extra copy and
> pointing to the string literal.
>
> Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
> Signed-off-by: Jeff King <peff@peff.net>

Sounds sensible. Thanks.

> ---
>  remote.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/remote.c b/remote.c
> index e9fedfa..9f1a8aa 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -483,7 +483,7 @@ static void read_config(void)
>  	int flag;
>  	if (default_remote_name) /* did this already */
>  		return;
> -	default_remote_name = xstrdup("origin");
> +	default_remote_name = "origin";
>  	current_branch = NULL;
>  	head_ref = resolve_ref_unsafe("HEAD", sha1, 0, &flag);
>  	if (head_ref && (flag & REF_ISSYMREF) &&

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-10-15 21:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-21 14:09 [PATCH 0/2] fetch: trivial fixes Felipe Contreras
2013-09-21 14:09 ` [PATCH 1/2] fetch: add missing documentation Felipe Contreras
2013-09-24  5:03   ` Jeff King
2013-09-24  5:23     ` Felipe Contreras
2013-09-24  5:30       ` Jeff King
2013-09-24  5:36         ` Felipe Contreras
2013-09-24  5:40           ` Jeff King
2013-09-24  5:57             ` Felipe Contreras
2013-09-24  6:10               ` Jeff King
2013-09-24  6:31                 ` Felipe Contreras
2013-09-24  6:54                   ` Jeff King
2013-09-24  7:41                     ` Felipe Contreras
2013-09-21 14:09 ` [PATCH 2/2] remote: fix trivial memory leak Felipe Contreras
2013-09-24  5:19   ` Jeff King
2013-10-15 21:50     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).