remote: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Feb 14, 2018 at 10:59 UTC b537e0b1cfe9b1e52fad2623c8de0de40ab12beb
1 file changed +33 -33
builtin/remote.c
+33 -33
@@ -322,7 +322,7 @@ static void read_branches(void)
322
323 struct ref_states {
324 struct remote *remote;
325 - struct string_list new, stale, tracked, heads, push;
325 + struct string_list new_refs, stale, tracked, heads, push;
326 int queried;
327 };
328
@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
337 die(_("Could not get fetch map for refspec %s"),
338 states->remote->fetch_refspec[i]);
339
340 - states->new.strdup_strings = 1;
340 + states->new_refs.strdup_strings = 1;
341 states->tracked.strdup_strings = 1;
342 states->stale.strdup_strings = 1;
343 for (ref = fetch_map; ref; ref = ref->next) {
344 if (!ref->peer_ref || !ref_exists(ref->peer_ref->name))
345 - string_list_append(&states->new, abbrev_branch(ref->name));
345 + string_list_append(&states->new_refs, abbrev_branch(ref->name));
346 else
347 string_list_append(&states->tracked, abbrev_branch(ref->name));
348 }
@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
356 free_refs(stale_refs);
357 free_refs(fetch_map);
358
359 - string_list_sort(&states->new);
359 + string_list_sort(&states->new_refs);
360 string_list_sort(&states->tracked);
361 string_list_sort(&states->stale);
362
@@ -546,8 +546,8 @@ static int add_branch_for_removal(const char *refname,
546 }
547
548 struct rename_info {
549 - const char *old;
550 - const char *new;
549 + const char *old_name;
550 + const char *new_name;
551 struct string_list *remote_branches;
552 };
553
@@ -560,7 +560,7 @@ static int read_remote_branches(const char *refname,
560 int flag;
561 const char *symref;
562
563 - strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
563 + strbuf_addf(&buf, "refs/remotes/%s/", rename->old_name);
564 if (starts_with(refname, buf.buf)) {
565 item = string_list_append(rename->remote_branches, xstrdup(refname));
566 symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING,
@@ -615,36 +615,36 @@ static int mv(int argc, const char **argv)
615 if (argc != 3)
616 usage_with_options(builtin_remote_rename_usage, options);
617
618 - rename.old = argv[1];
619 - rename.new = argv[2];
618 + rename.old_name = argv[1];
619 + rename.new_name = argv[2];
620 rename.remote_branches = &remote_branches;
621
622 - oldremote = remote_get(rename.old);
622 + oldremote = remote_get(rename.old_name);
623 if (!remote_is_configured(oldremote, 1))
624 - die(_("No such remote: %s"), rename.old);
624 + die(_("No such remote: %s"), rename.old_name);
625
626 - if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
626 + if (!strcmp(rename.old_name, rename.new_name) && oldremote->origin != REMOTE_CONFIG)
627 return migrate_file(oldremote);
628
629 - newremote = remote_get(rename.new);
629 + newremote = remote_get(rename.new_name);
630 if (remote_is_configured(newremote, 1))
631 - die(_("remote %s already exists."), rename.new);
631 + die(_("remote %s already exists."), rename.new_name);
632
633 - strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new);
633 + strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new_name);
634 if (!valid_fetch_refspec(buf.buf))
635 - die(_("'%s' is not a valid remote name"), rename.new);
635 + die(_("'%s' is not a valid remote name"), rename.new_name);
636
637 strbuf_reset(&buf);
638 - strbuf_addf(&buf, "remote.%s", rename.old);
639 - strbuf_addf(&buf2, "remote.%s", rename.new);
638 + strbuf_addf(&buf, "remote.%s", rename.old_name);
639 + strbuf_addf(&buf2, "remote.%s", rename.new_name);
640 if (git_config_rename_section(buf.buf, buf2.buf) < 1)
641 return error(_("Could not rename config section '%s' to '%s'"),
642 buf.buf, buf2.buf);
643
644 strbuf_reset(&buf);
645 - strbuf_addf(&buf, "remote.%s.fetch", rename.new);
645 + strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
646 git_config_set_multivar(buf.buf, NULL, NULL, 1);
647 - strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
647 + strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
648 for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
649 char *ptr;
650
@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)
655 refspec_updated = 1;
656 strbuf_splice(&buf2,
657 ptr-buf2.buf + strlen(":refs/remotes/"),
658 - strlen(rename.old), rename.new,
659 - strlen(rename.new));
658 + strlen(rename.old_name), rename.new_name,
659 + strlen(rename.new_name));
660 } else
661 warning(_("Not updating non-default fetch refspec\n"
662 "\t%s\n"
@@ -670,10 +670,10 @@ static int mv(int argc, const char **argv)
670 for (i = 0; i < branch_list.nr; i++) {
671 struct string_list_item *item = branch_list.items + i;
672 struct branch_info *info = item->util;
673 - if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
673 + if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
674 strbuf_reset(&buf);
675 strbuf_addf(&buf, "branch.%s.remote", item->string);
676 - git_config_set(buf.buf, rename.new);
676 + git_config_set(buf.buf, rename.new_name);
677 }
678 }
679
@@ -703,8 +703,8 @@ static int mv(int argc, const char **argv)
703 continue;
704 strbuf_reset(&buf);
705 strbuf_addstr(&buf, item->string);
706 - strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
707 - rename.new, strlen(rename.new));
706 + strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old_name),
707 + rename.new_name, strlen(rename.new_name));
708 strbuf_reset(&buf2);
709 strbuf_addf(&buf2, "remote: renamed %s to %s",
710 item->string, buf.buf);
@@ -718,12 +718,12 @@ static int mv(int argc, const char **argv)
718 continue;
719 strbuf_reset(&buf);
720 strbuf_addstr(&buf, item->string);
721 - strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
722 - rename.new, strlen(rename.new));
721 + strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old_name),
722 + rename.new_name, strlen(rename.new_name));
723 strbuf_reset(&buf2);
724 strbuf_addstr(&buf2, item->util);
725 - strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old),
726 - rename.new, strlen(rename.new));
725 + strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old_name),
726 + rename.new_name, strlen(rename.new_name));
727 strbuf_reset(&buf3);
728 strbuf_addf(&buf3, "remote: renamed %s to %s",
729 item->string, buf.buf);
@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)
822
823 static void free_remote_ref_states(struct ref_states *states)
824 {
825 - string_list_clear(&states->new, 0);
825 + string_list_clear(&states->new_refs, 0);
826 string_list_clear(&states->stale, 1);
827 string_list_clear(&states->tracked, 0);
828 string_list_clear(&states->heads, 0);
@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
907 if (states->queried) {
908 const char *fmt = "%s";
909 const char *arg = "";
910 - if (string_list_has_string(&states->new, name)) {
910 + if (string_list_has_string(&states->new_refs, name)) {
911 fmt = _(" new (next fetch will store in remotes/%s)");
912 arg = states->remote->name;
913 } else if (string_list_has_string(&states->tracked, name))
@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)
1176
1177 /* remote branch info */
1178 info.width = 0;
1179 - for_each_string_list(&states.new, add_remote_to_show_info, &info);
1179 + for_each_string_list(&states.new_refs, add_remote_to_show_info, &info);
1180 for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
1181 for_each_string_list(&states.stale, add_remote_to_show_info, &info);
1182 if (info.list->nr)