git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: j6t@kdbg.org, avarab@gmail.com, Brandon Williams <bmwill@google.com>
Subject: [PATCH 13/37] remote: rename 'new' variables
Date: Mon, 29 Jan 2018 14:37:04 -0800	[thread overview]
Message-ID: <20180129223728.30569-14-bmwill@google.com> (raw)
In-Reply-To: <20180129223728.30569-1-bmwill@google.com>

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>
---
 builtin/remote.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index d95bf904c..4f4783e70 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -322,7 +322,7 @@ static void read_branches(void)
 
 struct ref_states {
 	struct remote *remote;
-	struct string_list new, stale, tracked, heads, push;
+	struct string_list new_refs, stale, tracked, heads, push;
 	int queried;
 };
 
@@ -337,12 +337,12 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 			die(_("Could not get fetch map for refspec %s"),
 				states->remote->fetch_refspec[i]);
 
-	states->new.strdup_strings = 1;
+	states->new_refs.strdup_strings = 1;
 	states->tracked.strdup_strings = 1;
 	states->stale.strdup_strings = 1;
 	for (ref = fetch_map; ref; ref = ref->next) {
 		if (!ref->peer_ref || !ref_exists(ref->peer_ref->name))
-			string_list_append(&states->new, abbrev_branch(ref->name));
+			string_list_append(&states->new_refs, abbrev_branch(ref->name));
 		else
 			string_list_append(&states->tracked, abbrev_branch(ref->name));
 	}
@@ -356,7 +356,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
 	free_refs(stale_refs);
 	free_refs(fetch_map);
 
-	string_list_sort(&states->new);
+	string_list_sort(&states->new_refs);
 	string_list_sort(&states->tracked);
 	string_list_sort(&states->stale);
 
@@ -547,7 +547,7 @@ static int add_branch_for_removal(const char *refname,
 
 struct rename_info {
 	const char *old;
-	const char *new;
+	const char *new_name;
 	struct string_list *remote_branches;
 };
 
@@ -616,33 +616,33 @@ static int mv(int argc, const char **argv)
 		usage_with_options(builtin_remote_rename_usage, options);
 
 	rename.old = argv[1];
-	rename.new = argv[2];
+	rename.new_name = argv[2];
 	rename.remote_branches = &remote_branches;
 
 	oldremote = remote_get(rename.old);
 	if (!remote_is_configured(oldremote, 1))
 		die(_("No such remote: %s"), rename.old);
 
-	if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
+	if (!strcmp(rename.old, rename.new_name) && oldremote->origin != REMOTE_CONFIG)
 		return migrate_file(oldremote);
 
-	newremote = remote_get(rename.new);
+	newremote = remote_get(rename.new_name);
 	if (remote_is_configured(newremote, 1))
-		die(_("remote %s already exists."), rename.new);
+		die(_("remote %s already exists."), rename.new_name);
 
-	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new);
+	strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new_name);
 	if (!valid_fetch_refspec(buf.buf))
-		die(_("'%s' is not a valid remote name"), rename.new);
+		die(_("'%s' is not a valid remote name"), rename.new_name);
 
 	strbuf_reset(&buf);
 	strbuf_addf(&buf, "remote.%s", rename.old);
-	strbuf_addf(&buf2, "remote.%s", rename.new);
+	strbuf_addf(&buf2, "remote.%s", rename.new_name);
 	if (git_config_rename_section(buf.buf, buf2.buf) < 1)
 		return error(_("Could not rename config section '%s' to '%s'"),
 				buf.buf, buf2.buf);
 
 	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s.fetch", rename.new);
+	strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
 	git_config_set_multivar(buf.buf, NULL, NULL, 1);
 	strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
 	for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
@@ -655,8 +655,8 @@ static int mv(int argc, const char **argv)
 			refspec_updated = 1;
 			strbuf_splice(&buf2,
 				      ptr-buf2.buf + strlen(":refs/remotes/"),
-				      strlen(rename.old), rename.new,
-				      strlen(rename.new));
+				      strlen(rename.old), rename.new_name,
+				      strlen(rename.new_name));
 		} else
 			warning(_("Not updating non-default fetch refspec\n"
 				  "\t%s\n"
@@ -673,7 +673,7 @@ static int mv(int argc, const char **argv)
 		if (info->remote_name && !strcmp(info->remote_name, rename.old)) {
 			strbuf_reset(&buf);
 			strbuf_addf(&buf, "branch.%s.remote", item->string);
-			git_config_set(buf.buf, rename.new);
+			git_config_set(buf.buf, rename.new_name);
 		}
 	}
 
@@ -704,7 +704,7 @@ static int mv(int argc, const char **argv)
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
 		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addf(&buf2, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -719,11 +719,11 @@ static int mv(int argc, const char **argv)
 		strbuf_reset(&buf);
 		strbuf_addstr(&buf, item->string);
 		strbuf_splice(&buf, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf2);
 		strbuf_addstr(&buf2, item->util);
 		strbuf_splice(&buf2, strlen("refs/remotes/"), strlen(rename.old),
-				rename.new, strlen(rename.new));
+				rename.new_name, strlen(rename.new_name));
 		strbuf_reset(&buf3);
 		strbuf_addf(&buf3, "remote: renamed %s to %s",
 				item->string, buf.buf);
@@ -822,7 +822,7 @@ static void clear_push_info(void *util, const char *string)
 
 static void free_remote_ref_states(struct ref_states *states)
 {
-	string_list_clear(&states->new, 0);
+	string_list_clear(&states->new_refs, 0);
 	string_list_clear(&states->stale, 1);
 	string_list_clear(&states->tracked, 0);
 	string_list_clear(&states->heads, 0);
@@ -907,7 +907,7 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
 	if (states->queried) {
 		const char *fmt = "%s";
 		const char *arg = "";
-		if (string_list_has_string(&states->new, name)) {
+		if (string_list_has_string(&states->new_refs, name)) {
 			fmt = _(" new (next fetch will store in remotes/%s)");
 			arg = states->remote->name;
 		} else if (string_list_has_string(&states->tracked, name))
@@ -1176,7 +1176,7 @@ static int show(int argc, const char **argv)
 
 		/* remote branch info */
 		info.width = 0;
-		for_each_string_list(&states.new, add_remote_to_show_info, &info);
+		for_each_string_list(&states.new_refs, add_remote_to_show_info, &info);
 		for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
 		for_each_string_list(&states.stale, add_remote_to_show_info, &info);
 		if (info.list->nr)
-- 
2.16.0.rc1.238.g530d649a79-goog


  parent reply	other threads:[~2018-01-29 22:40 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 22:36 [PATCH 00/37] removal of some c++ keywords Brandon Williams
2018-01-29 22:36 ` [PATCH 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
2018-01-29 22:36 ` [PATCH 02/37] object: rename function " Brandon Williams
2018-01-29 22:36 ` [PATCH 03/37] blame: rename 'this' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 04/37] pack-objects: " Brandon Williams
2018-01-29 22:36 ` [PATCH 05/37] rev-parse: rename 'this' variable Brandon Williams
2018-01-29 22:36 ` [PATCH 06/37] diff: rename 'this' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 07/37] apply: rename 'try' variables Brandon Williams
2018-01-29 22:36 ` [PATCH 08/37] apply: rename 'new' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 09/37] checkout: " Brandon Williams
2018-01-29 22:37 ` [PATCH 10/37] help: " Brandon Williams
2018-01-29 22:37 ` [PATCH 11/37] pack-redundant: " Brandon Williams
2018-01-29 22:37 ` [PATCH 12/37] reflog: " Brandon Williams
2018-01-29 22:37 ` Brandon Williams [this message]
2018-01-29 22:37 ` [PATCH 14/37] combine-diff: " Brandon Williams
2018-01-29 22:37 ` [PATCH 15/37] commit: " Brandon Williams
2018-01-29 22:37 ` [PATCH 16/37] diff-lib: rename 'new' variable Brandon Williams
2018-01-29 22:37 ` [PATCH 17/37] diff: rename 'new' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 18/37] diffcore-delta: " Brandon Williams
2018-01-29 22:37 ` [PATCH 19/37] entry: " Brandon Williams
2018-01-29 22:37 ` [PATCH 20/37] http: " Brandon Williams
2018-01-29 22:37 ` [PATCH 21/37] imap-send: " Brandon Williams
2018-01-29 22:37 ` [PATCH 22/37] line-log: " Brandon Williams
2018-01-29 22:37 ` [PATCH 23/37] read-cache: " Brandon Williams
2018-01-29 22:37 ` [PATCH 24/37] ref-filter: " Brandon Williams
2018-01-29 22:37 ` [PATCH 25/37] remote: " Brandon Williams
2018-01-29 22:37 ` [PATCH 26/37] split-index: " Brandon Williams
2018-01-29 22:37 ` [PATCH 27/37] submodule: " Brandon Williams
2018-01-29 22:37 ` [PATCH 28/37] trailer: " Brandon Williams
2018-01-29 22:37 ` [PATCH 29/37] unpack-trees: " Brandon Williams
2018-01-29 22:37 ` [PATCH 30/37] init-db: rename 'template' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 31/37] environment: " Brandon Williams
2018-01-29 22:37 ` [PATCH 32/37] diff: " Brandon Williams
2018-01-29 22:37 ` [PATCH 33/37] environment: rename 'namespace' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 34/37] wrapper: rename 'template' variables Brandon Williams
2018-01-29 22:37 ` [PATCH 35/37] tempfile: " Brandon Williams
2018-01-29 22:37 ` [PATCH 36/37] trailer: " Brandon Williams
2018-01-29 22:37 ` [PATCH 37/37] replace: rename 'new' variables Brandon Williams
2018-01-30 22:58   ` Stefan Beller
2018-01-30 23:21     ` Junio C Hamano
2018-01-30  0:13 ` [PATCH 00/37] removal of some c++ keywords Duy Nguyen
2018-01-30 22:36   ` Junio C Hamano
2018-01-30 23:01     ` Stefan Beller
2018-01-31  0:48       ` Duy Nguyen
2018-01-31  0:57         ` Stefan Beller
2018-01-31  1:05           ` Duy Nguyen
2018-01-30 20:54 ` Johannes Sixt
2018-02-14 18:59 ` [PATCH v2 " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 01/37] object_info: change member name from 'typename' to 'type_name' Brandon Williams
2018-02-14 18:59   ` [PATCH v2 02/37] object: rename function " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 03/37] blame: rename 'this' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 04/37] pack-objects: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 05/37] rev-parse: rename 'this' variable Brandon Williams
2018-02-14 18:59   ` [PATCH v2 06/37] diff: rename 'this' variables Brandon Williams
2018-02-14 21:19     ` Junio C Hamano
2018-02-14 21:24       ` Brandon Williams
2018-02-14 18:59   ` [PATCH v2 07/37] apply: rename 'try' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 08/37] apply: rename 'new' variables Brandon Williams
2018-02-14 21:40     ` Stefan Beller
2018-02-14 18:59   ` [PATCH v2 09/37] checkout: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 10/37] help: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 11/37] pack-redundant: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 12/37] reflog: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 13/37] remote: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 14/37] combine-diff: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 15/37] commit: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 16/37] diff-lib: rename 'new' variable Brandon Williams
2018-02-14 18:59   ` [PATCH v2 17/37] diff: rename 'new' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 18/37] diffcore-delta: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 19/37] entry: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 20/37] http: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 21/37] imap-send: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 22/37] line-log: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 23/37] read-cache: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 24/37] ref-filter: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 25/37] remote: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 26/37] split-index: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 27/37] submodule: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 28/37] trailer: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 29/37] unpack-trees: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 30/37] init-db: rename 'template' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 31/37] environment: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 32/37] diff: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 33/37] environment: rename 'namespace' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 34/37] wrapper: rename 'template' variables Brandon Williams
2018-02-14 18:59   ` [PATCH v2 35/37] tempfile: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 36/37] trailer: " Brandon Williams
2018-02-14 18:59   ` [PATCH v2 37/37] replace: rename 'new' variables Brandon Williams
2018-02-14 22:41   ` [PATCH v2 00/37] removal of some c++ keywords Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180129223728.30569-14-bmwill@google.com \
    --to=bmwill@google.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).