Skip to content

Commit b4b6343

Browse files
artagnongitster
authored andcommitted
remote.c: simplify a bit of code using git_config_string()
A small segment where handle_config() parses the branch.remote configuration variable can be simplified using git_config_string(). Signed-off-by: Ramkumar Ramachandra <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cc3e4eb commit b4b6343

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

remote.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,8 @@ static int handle_config(const char *key, const char *value, void *cb)
357357
return 0;
358358
branch = make_branch(name, subkey - name);
359359
if (!strcmp(subkey, ".remote")) {
360-
if (!value)
361-
return config_error_nonbool(key);
362-
branch->remote_name = xstrdup(value);
360+
if (git_config_string(&branch->remote_name, key, value))
361+
return -1;
363362
if (branch == current_branch) {
364363
default_remote_name = branch->remote_name;
365364
explicit_default_remote_name = 1;

0 commit comments

Comments
 (0)