Change incorrect "remote branch" to "remote tracking branch" in C code
(Just like we did for documentation already) In the process, we change "non-remote branch" to "branch outside the refs/remotes/ hierarchy" to avoid the ugly "non-remote-tracking branch". The new formulation actually corresponds to how the code detects this case (i.e. prefixcmp(refname, "refs/remotes")). Also, we use 'remote-tracking branch' in generated merge messages (by merge an fmt-merge-msg). Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
29b9a66f28
commit
13931236b9
4
branch.h
4
branch.h
@ -22,8 +22,8 @@ void create_branch(const char *head, const char *name, const char *start_name,
|
|||||||
void remove_branch_state(void);
|
void remove_branch_state(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure local branch "local" to merge remote branch "remote"
|
* Configure local branch "local" as downstream to branch "remote"
|
||||||
* taken from origin "origin".
|
* from remote "origin". Used by git branch --set-upstream.
|
||||||
*/
|
*/
|
||||||
#define BRANCH_CONFIG_VERBOSE 01
|
#define BRANCH_CONFIG_VERBOSE 01
|
||||||
extern void install_branch_config(int flag, const char *local, const char *origin, const char *remote);
|
extern void install_branch_config(int flag, const char *local, const char *origin, const char *remote);
|
||||||
|
@ -359,7 +359,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
|
|||||||
what = rm->name + 10;
|
what = rm->name + 10;
|
||||||
}
|
}
|
||||||
else if (!prefixcmp(rm->name, "refs/remotes/")) {
|
else if (!prefixcmp(rm->name, "refs/remotes/")) {
|
||||||
kind = "remote branch";
|
kind = "remote-tracking branch";
|
||||||
what = rm->name + 13;
|
what = rm->name + 13;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -100,8 +100,8 @@ static int handle_line(char *line)
|
|||||||
origin = line;
|
origin = line;
|
||||||
string_list_append(&src_data->tag, origin + 4);
|
string_list_append(&src_data->tag, origin + 4);
|
||||||
src_data->head_status |= 2;
|
src_data->head_status |= 2;
|
||||||
} else if (!prefixcmp(line, "remote branch ")) {
|
} else if (!prefixcmp(line, "remote-tracking branch ")) {
|
||||||
origin = line + 14;
|
origin = line + strlen("remote-tracking branch ");
|
||||||
string_list_append(&src_data->r_branch, origin);
|
string_list_append(&src_data->r_branch, origin);
|
||||||
src_data->head_status |= 2;
|
src_data->head_status |= 2;
|
||||||
} else {
|
} else {
|
||||||
@ -233,7 +233,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
|
|||||||
if (src_data->r_branch.nr) {
|
if (src_data->r_branch.nr) {
|
||||||
strbuf_addstr(out, subsep);
|
strbuf_addstr(out, subsep);
|
||||||
subsep = ", ";
|
subsep = ", ";
|
||||||
print_joined("remote branch ", "remote branches ",
|
print_joined("remote-tracking branch ", "remote-tracking branches ",
|
||||||
&src_data->r_branch, out);
|
&src_data->r_branch, out);
|
||||||
}
|
}
|
||||||
if (src_data->tag.nr) {
|
if (src_data->tag.nr) {
|
||||||
|
@ -403,7 +403,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!prefixcmp(found_ref, "refs/remotes/")) {
|
if (!prefixcmp(found_ref, "refs/remotes/")) {
|
||||||
strbuf_addf(msg, "%s\t\tremote branch '%s' of .\n",
|
strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n",
|
||||||
sha1_to_hex(branch_head), remote);
|
sha1_to_hex(branch_head), remote);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ static int add_branch_for_removal(const char *refname,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't delete non-remote refs */
|
/* don't delete non-remote-tracking refs */
|
||||||
if (prefixcmp(refname, "refs/remotes")) {
|
if (prefixcmp(refname, "refs/remotes")) {
|
||||||
/* advise user how to delete local branches */
|
/* advise user how to delete local branches */
|
||||||
if (!prefixcmp(refname, "refs/heads/"))
|
if (!prefixcmp(refname, "refs/heads/"))
|
||||||
@ -791,9 +791,9 @@ static int rm(int argc, const char **argv)
|
|||||||
|
|
||||||
if (skipped.nr) {
|
if (skipped.nr) {
|
||||||
fprintf(stderr, skipped.nr == 1 ?
|
fprintf(stderr, skipped.nr == 1 ?
|
||||||
"Note: A non-remote branch was not removed; "
|
"Note: A branch outside the refs/remotes/ hierarchy was not removed;\n"
|
||||||
"to delete it, use:\n" :
|
"to delete it, use:\n" :
|
||||||
"Note: Non-remote branches were not removed; "
|
"Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
|
||||||
"to delete them, use:\n");
|
"to delete them, use:\n");
|
||||||
for (i = 0; i < skipped.nr; i++)
|
for (i = 0; i < skipped.nr; i++)
|
||||||
fprintf(stderr, " git branch -d %s\n",
|
fprintf(stderr, " git branch -d %s\n",
|
||||||
|
@ -148,7 +148,7 @@ static int append_fetch_head(FILE *fp,
|
|||||||
what = remote_name + 10;
|
what = remote_name + 10;
|
||||||
}
|
}
|
||||||
else if (!strncmp(remote_name, "refs/remotes/", 13)) {
|
else if (!strncmp(remote_name, "refs/remotes/", 13)) {
|
||||||
kind = "remote branch";
|
kind = "remote-tracking branch";
|
||||||
what = remote_name + 13;
|
what = remote_name + 13;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -85,7 +85,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '
|
|||||||
git branch -t new my-side@{u} &&
|
git branch -t new my-side@{u} &&
|
||||||
git merge -s ours new@{u} &&
|
git merge -s ours new@{u} &&
|
||||||
git show -s --pretty=format:%s >actual &&
|
git show -s --pretty=format:%s >actual &&
|
||||||
echo "Merge remote branch ${sq}origin/side${sq}" >expect &&
|
echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
@ -72,7 +72,7 @@ test_expect_success 'rebase -p fakes interactive rebase' '
|
|||||||
git fetch &&
|
git fetch &&
|
||||||
git rebase -p origin/topic &&
|
git rebase -p origin/topic &&
|
||||||
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
|
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
|
||||||
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote branch " | wc -l)
|
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote-tracking branch " | wc -l)
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -107,16 +107,18 @@ test_expect_success 'remove remote' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'remove remote protects non-remote branches' '
|
test_expect_success 'remove remote protects local branches' '
|
||||||
(
|
(
|
||||||
cd test &&
|
cd test &&
|
||||||
{ cat >expect1 <<EOF
|
{ cat >expect1 <<EOF
|
||||||
Note: A non-remote branch was not removed; to delete it, use:
|
Note: A branch outside the refs/remotes/ hierarchy was not removed;
|
||||||
|
to delete it, use:
|
||||||
git branch -d master
|
git branch -d master
|
||||||
EOF
|
EOF
|
||||||
} &&
|
} &&
|
||||||
{ cat >expect2 <<EOF
|
{ cat >expect2 <<EOF
|
||||||
Note: Non-remote branches were not removed; to delete them, use:
|
Note: Some branches outside the refs/remotes/ hierarchy were not removed;
|
||||||
|
to delete them, use:
|
||||||
git branch -d foobranch
|
git branch -d foobranch
|
||||||
git branch -d master
|
git branch -d master
|
||||||
EOF
|
EOF
|
||||||
|
@ -47,14 +47,14 @@ test_expect_success 'ambiguous tag' '
|
|||||||
check_oneline "Merge commit QambiguousQ"
|
check_oneline "Merge commit QambiguousQ"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'remote branch' '
|
test_expect_success 'remote-tracking branch' '
|
||||||
git checkout -b remote master &&
|
git checkout -b remote master &&
|
||||||
test_commit remote-1 &&
|
test_commit remote-1 &&
|
||||||
git update-ref refs/remotes/origin/master remote &&
|
git update-ref refs/remotes/origin/master remote &&
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_commit master-5 &&
|
test_commit master-5 &&
|
||||||
git merge origin/master &&
|
git merge origin/master &&
|
||||||
check_oneline "Merge remote branch Qorigin/masterQ"
|
check_oneline "Merge remote-tracking branch Qorigin/masterQ"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user