@matheusbsbs / matheus-bagliano / commits / 13931236b9
Fork 0

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>

Matthieu Moy committed Nov 2, 2010 at 16:31 UTC 13931236b9ee2895a98ffdbdacbd0f895956d8a8
10 files changed +20 -18
branch.h
+2 -2
@@ -22,8 +22,8 @@ void create_branch(const char *head, const char *name, const char *start_name,
22 void remove_branch_state(void);
23
24 /*
25 - * Configure local branch "local" to merge remote branch "remote"
26 - * taken from origin "origin".
25 + * Configure local branch "local" as downstream to branch "remote"
26 + * from remote "origin". Used by git branch --set-upstream.
27 */
28 #define BRANCH_CONFIG_VERBOSE 01
29 extern void install_branch_config(int flag, const char *local, const char *origin, const char *remote);
builtin/fetch.c
+1 -1
@@ -359,7 +359,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
359 what = rm->name + 10;
360 }
361 else if (!prefixcmp(rm->name, "refs/remotes/")) {
362 - kind = "remote branch";
362 + kind = "remote-tracking branch";
363 what = rm->name + 13;
364 }
365 else {
builtin/fmt-merge-msg.c
+3 -3
@@ -100,8 +100,8 @@ static int handle_line(char *line)
100 origin = line;
101 string_list_append(&src_data->tag, origin + 4);
102 src_data->head_status |= 2;
103 - } else if (!prefixcmp(line, "remote branch ")) {
104 - origin = line + 14;
103 + } else if (!prefixcmp(line, "remote-tracking branch ")) {
104 + origin = line + strlen("remote-tracking branch ");
105 string_list_append(&src_data->r_branch, origin);
106 src_data->head_status |= 2;
107 } else {
@@ -233,7 +233,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
233 if (src_data->r_branch.nr) {
234 strbuf_addstr(out, subsep);
235 subsep = ", ";
236 - print_joined("remote branch ", "remote branches ",
236 + print_joined("remote-tracking branch ", "remote-tracking branches ",
237 &src_data->r_branch, out);
238 }
239 if (src_data->tag.nr) {
builtin/merge.c
+1 -1
@@ -403,7 +403,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
403 goto cleanup;
404 }
405 if (!prefixcmp(found_ref, "refs/remotes/")) {
406 - strbuf_addf(msg, "%s\t\tremote branch '%s' of .\n",
406 + strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n",
407 sha1_to_hex(branch_head), remote);
408 goto cleanup;
409 }
builtin/remote.c
+3 -3
@@ -507,7 +507,7 @@ static int add_branch_for_removal(const char *refname,
507 return 0;
508 }
509
510 - /* don't delete non-remote refs */
510 + /* don't delete non-remote-tracking refs */
511 if (prefixcmp(refname, "refs/remotes")) {
512 /* advise user how to delete local branches */
513 if (!prefixcmp(refname, "refs/heads/"))
@@ -791,9 +791,9 @@ static int rm(int argc, const char **argv)
791
792 if (skipped.nr) {
793 fprintf(stderr, skipped.nr == 1 ?
794 - "Note: A non-remote branch was not removed; "
794 + "Note: A branch outside the refs/remotes/ hierarchy was not removed;\n"
795 "to delete it, use:\n" :
796 - "Note: Non-remote branches were not removed; "
796 + "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
797 "to delete them, use:\n");
798 for (i = 0; i < skipped.nr; i++)
799 fprintf(stderr, " git branch -d %s\n",
contrib/examples/builtin-fetch--tool.c
+1 -1
@@ -148,7 +148,7 @@ static int append_fetch_head(FILE *fp,
148 what = remote_name + 10;
149 }
150 else if (!strncmp(remote_name, "refs/remotes/", 13)) {
151 - kind = "remote branch";
151 + kind = "remote-tracking branch";
152 what = remote_name + 13;
153 }
154 else {
t/t1507-rev-parse-upstream.sh
+1 -1
@@ -85,7 +85,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '
85 git branch -t new my-side@{u} &&
86 git merge -s ours new@{u} &&
87 git show -s --pretty=format:%s >actual &&
88 - echo "Merge remote branch ${sq}origin/side${sq}" >expect &&
88 + echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect &&
89 test_cmp expect actual
90 )
91 '
t/t3409-rebase-preserve-merges.sh
+1 -1
@@ -72,7 +72,7 @@ test_expect_success 'rebase -p fakes interactive rebase' '
72 git fetch &&
73 git rebase -p origin/topic &&
74 test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
75 - test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote branch " | wc -l)
75 + test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote-tracking branch " | wc -l)
76 )
77 '
78
t/t5505-remote.sh
+5 -3
@@ -107,16 +107,18 @@ test_expect_success 'remove remote' '
107 )
108 '
109
110 -test_expect_success 'remove remote protects non-remote branches' '
110 +test_expect_success 'remove remote protects local branches' '
111 (
112 cd test &&
113 { cat >expect1 <<EOF
114 -Note: A non-remote branch was not removed; to delete it, use:
114 +Note: A branch outside the refs/remotes/ hierarchy was not removed;
115 +to delete it, use:
116 git branch -d master
117 EOF
118 } &&
119 { cat >expect2 <<EOF
119 -Note: Non-remote branches were not removed; to delete them, use:
120 +Note: Some branches outside the refs/remotes/ hierarchy were not removed;
121 +to delete them, use:
122 git branch -d foobranch
123 git branch -d master
124 EOF
t/t7608-merge-messages.sh
+2 -2
@@ -47,14 +47,14 @@ test_expect_success 'ambiguous tag' '
47 check_oneline "Merge commit QambiguousQ"
48 '
49
50 -test_expect_success 'remote branch' '
50 +test_expect_success 'remote-tracking branch' '
51 git checkout -b remote master &&
52 test_commit remote-1 &&
53 git update-ref refs/remotes/origin/master remote &&
54 git checkout master &&
55 test_commit master-5 &&
56 git merge origin/master &&
57 - check_oneline "Merge remote branch Qorigin/masterQ"
57 + check_oneline "Merge remote-tracking branch Qorigin/masterQ"
58 '
59
60 test_done