Hi,
it is a very good idea to read the information which remote tracks which
branch from the config, i.e. if you branch "refs/remotes/hallo", to look
if there is any remote information for that local ref.
On Mon, 5 Mar 2007, Paolo Bonzini wrote:
extra empty line.
This is the first time I saw that sscanf format type. How portable is it?
I really would rather do
const char *p;
if (!prefixcmp(value, "refs/") && (p = strchr(value, ':')) &&
!strcmp(p + 1, start_ref)) {
asprintf() is a GNU extension. I guess it is better to just
config_repo = xstrdup(value);
config_repo[p - value] = '\0';
Same here:
else if (!prefixcmp(value, "refs/") && (p = strchr(value, ':')) &&
!memcmp(p + 1, start_ref, remote_len) &&
!strcmp(p + 1 + remote_len, "/*")) {
config_repo = xstrdup(value);
config_repo[p - value] = '\0';
}
BTW I prefer to skip the curly brackets when there is only one statement
in the block.
Just to be on the safe side, you might want to check here if there are
more than one remotes "tracking" into start_ref. However, it might not be
relevant in practice.
FWIW I don't think .trackIntoLocalBranches" is needed. Opinions?
Maybe call it "set_branch_defaults()"?
die() does not return, so no need to "goto out;"... But then, it might be
nicer to return -1, i.e.
ret = error("what a long branch name you have!");
and saying
if (!ret) {
git_config_set(key, value);
...
printf("Branch %s setup...
}
}
if (repo_config)
free(repo_config);
return ret;
But I see you made it return "void", so you can skip the "return ret;".
I know, I should have said that earlier, but I just found out myself: We
have a config variable core.warnambiguousrefs, and maybe we should _not_
complain and set the defaults when the global variable warn_ambiguous_refs
is 0.
Ciao,
Dscho
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html