From: David Bryson <hidden> Date: 2016-06-15 22:45:26
Signed-off-by: David Bryson <redacted>
I tried to keep with the naming/coding conventions that I found in
remote.c. Feedback welcome.
---
remote.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:26
David Bryson wrote:
quoted hunk
Signed-off-by: David Bryson <redacted>
I tried to keep with the naming/coding conventions that I found in
remote.c. Feedback welcome.
---
remote.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
Not very mnemonic. I'm sure you can think up a better name, even if it's
a long one. Git is notoriously sparse when it comes to comments. We rely
instead on self-explanatory code.
quoted hunk
struct remote *remote;
struct branch *branch;
if (!prefixcmp(key, "branch.")) {
@@ -314,15 +315,15 @@ static int handle_config(const char *key, const char *value, void *cb) return 0; branch = make_branch(name, subkey - name); if (!strcmp(subkey, ".remote")) {- if (!value)- return config_error_nonbool(key);- branch->remote_name = xstrdup(value);+ if (git_config_string(&v, key, value) ) + return -1;+ branch->remote_name = v; if (branch == current_branch) default_remote_name = branch->remote_name; } else if (!strcmp(subkey, ".merge")) {- if (!value)- return config_error_nonbool(key);- add_merge(branch, xstrdup(value));+ if (git_config_string(&v, key, value )) + return -1;+ add_merge(branch, v); } return 0; }
@@ -334,9 +335,9 @@ static int handle_config(const char *key, const char *value, void *cb) return 0; rewrite = make_rewrite(name, subkey - name); if (!strcmp(subkey, ".insteadof")) {- if (!value)- return config_error_nonbool(key);- add_instead_of(rewrite, xstrdup(value));+ if (git_config_string(&v, key, value )) + return -1;+ add_instead_of(rewrite, v); } } if (prefixcmp(key, "remote."))
Other than that, the patch looks good.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: David Bryson <hidden> Date: 2016-06-15 22:45:26
On Fri, Oct 03, 2008 at 07:28:42AM +0200 or thereabouts, Andreas Ericsson wrote:
David Bryson wrote:
quoted
Signed-off-by: David Bryson <redacted>
I tried to keep with the naming/coding conventions that I found in
remote.c. Feedback welcome.
---
remote.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
Not very mnemonic. I'm sure you can think up a better name, even if it's
a long one. Git is notoriously sparse when it comes to comments. We rely
instead on self-explanatory code.
Oh I agree entirely, it is quite vague, however like I mentioned I tried
to keep to the conventios in the file. This strategy(v) is used in several
other places in remote.c, if this is Bad Code, then I have no problem
changing it.
Thoughts from anybody else ?
From: Alex Riesen <hidden> Date: 2016-06-15 22:45:26
2008/10/3 David Bryson [off-list ref]:
On Fri, Oct 03, 2008 at 07:28:42AM +0200 or thereabouts, Andreas Ericsson wrote:
quoted
David Bryson wrote:
Oh I agree entirely, it is quite vague, however like I mentioned I tried
to keep to the conventios in the file. This strategy(v) is used in several
other places in remote.c, if this is Bad Code, then I have no problem
changing it.
Thoughts from anybody else ?
You can redeclare of the variable in the contexts where
it is used and not even rename it: it is close to its users then.
What is the reason not to write
if (git_config_string(&branch->remote_name, key, value))
return -1;
? (Also note that we do not like the space between the two closing
parentheses.)
Ciao,
Dscho