>Corentin BOMPARD <corentin.bompard@xxxxxxxxxxxxxxxxx> writes: > >> Add the --set-upstream option to git pull/fetch >> which lets the user set the upstream configuration >> for the current branch. > > I think it is a good idea to mention what you exactly mean by "the > upstream configuration" here. > > Do you mean the "branch.<current-branch-name>.merge" configuration > variable? The upstream configuration means the branch.<current-branch-name>.merge and branch.<current-branch-name>.remote >> + /* >> + * 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 waring. >> + */ >> + for (rm = ref_map; rm; rm = rm->next) { >> + fprintf(stderr, "\n -%s", rm->name); >> + if (rm->peer_ref) { >> + fprintf(stderr, " -> %s", rm->peer_ref->name); >> + } else { >> + if (source_ref) { >> + fprintf(stderr, " -> FETCH_HEAD\n"); >> + warning(_("Multiple branch detected, incompatible with set-upstream")); > > Shouldn't this be diagnosed as an error and stop the "fetch" or > "pull", though? We can actually replace the warning with a die, but we think it's too harsh on the user, and if the warning is showing the upstream stays the same. We fixed the spotted bugs/mistakes. The fixed patch will follow.