git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 13/37] remote: rename 'new' variables

From
BWBrandon Williams <bmwill@google.com>
Date
Jan 29, 2018, 22:37 UTC
Message-ID
<20180129223728.30569-14-bmwill@google.com>
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
Previous: Brandon WilliamsNext: Brandon Williams
Message 38 of 89 in “removal of some c++ keywords”
  1. 00/37 removal of some c++ keywordsBrandon Williams, Jan 29, 2018
  2. 01/37 object_info: change member name from 'typename' to 'type_name'Brandon Williams, Jan 29, 2018
  3. 02/37 object: rename function 'typename' to 'type_name'Brandon Williams, Jan 29, 2018
  4. 03/37 blame: rename 'this' variablesBrandon Williams, Jan 29, 2018
  5. 04/37 pack-objects: rename 'this' variablesBrandon Williams, Jan 29, 2018
  6. 05/37 rev-parse: rename 'this' variableBrandon Williams, Jan 29, 2018
  7. 06/37 diff: rename 'this' variablesBrandon Williams, Jan 29, 2018
  8. 08/37 apply: rename 'new' variablesBrandon Williams, Jan 29, 2018
  9. 07/37 apply: rename 'try' variablesBrandon Williams, Jan 29, 2018
  10. 09/37 checkout: rename 'new' variablesBrandon Williams, Jan 29, 2018
  11. 14/37 combine-diff: rename 'new' variablesBrandon Williams, Jan 29, 2018
  12. 17/37 diff: rename 'new' variablesBrandon Williams, Jan 29, 2018
  13. 18/37 diffcore-delta: rename 'new' variablesBrandon Williams, Jan 29, 2018
  14. 19/37 entry: rename 'new' variablesBrandon Williams, Jan 29, 2018
  15. 23/37 read-cache: rename 'new' variablesBrandon Williams, Jan 29, 2018
  16. 24/37 ref-filter: rename 'new' variablesBrandon Williams, Jan 29, 2018
  17. 26/37 split-index: rename 'new' variablesBrandon Williams, Jan 29, 2018
  18. 25/37 remote: rename 'new' variablesBrandon Williams, Jan 29, 2018
  19. 22/37 line-log: rename 'new' variablesBrandon Williams, Jan 29, 2018
  20. 30/37 init-db: rename 'template' variablesBrandon Williams, Jan 29, 2018
  21. 31/37 environment: rename 'template' variablesBrandon Williams, Jan 29, 2018
  22. 32/37 diff: rename 'template' variablesBrandon Williams, Jan 29, 2018
  23. 34/37 wrapper: rename 'template' variablesBrandon Williams, Jan 29, 2018
  24. 35/37 tempfile: rename 'template' variablesBrandon Williams, Jan 29, 2018
  25. 36/37 trailer: rename 'template' variablesBrandon Williams, Jan 29, 2018
  26. 37/37 replace: rename 'new' variablesBrandon Williams, Jan 29, 2018
  27. Stefan BellerJan 30, 2018
  28. Junio C HamanoJan 30, 2018
  29. 33/37 environment: rename 'namespace' variablesBrandon Williams, Jan 29, 2018
  30. 27/37 submodule: rename 'new' variablesBrandon Williams, Jan 29, 2018
  31. 28/37 trailer: rename 'new' variablesBrandon Williams, Jan 29, 2018
  32. 29/37 unpack-trees: rename 'new' variablesBrandon Williams, Jan 29, 2018
  33. 21/37 imap-send: rename 'new' variablesBrandon Williams, Jan 29, 2018
  34. 20/37 http: rename 'new' variablesBrandon Williams, Jan 29, 2018
  35. 15/37 commit: rename 'new' variablesBrandon Williams, Jan 29, 2018
  36. 16/37 diff-lib: rename 'new' variableBrandon Williams, Jan 29, 2018
  37. 10/37 help: rename 'new' variablesBrandon Williams, Jan 29, 2018
  38. 13/37 remote: rename 'new' variablesBrandon Williams, Jan 29, 2018
  39. 11/37 pack-redundant: rename 'new' variablesBrandon Williams, Jan 29, 2018
  40. 12/37 reflog: rename 'new' variablesBrandon Williams, Jan 29, 2018
  41. Duy NguyenJan 30, 2018
  42. Junio C HamanoJan 30, 2018
  43. Stefan BellerJan 30, 2018
  44. Duy NguyenJan 31, 2018
  45. Stefan BellerJan 31, 2018
  46. Duy NguyenJan 31, 2018
  47. Johannes SixtJan 30, 2018
  48. 00/37 removal of some c++ keywordsBrandon Williams, Feb 14, 2018
  49. 01/37 object_info: change member name from 'typename' to 'type_name'Brandon Williams, Feb 14, 2018
  50. 02/37 object: rename function 'typename' to 'type_name'Brandon Williams, Feb 14, 2018
  51. 04/37 pack-objects: rename 'this' variablesBrandon Williams, Feb 14, 2018
  52. 03/37 blame: rename 'this' variablesBrandon Williams, Feb 14, 2018
  53. 05/37 rev-parse: rename 'this' variableBrandon Williams, Feb 14, 2018
  54. 06/37 diff: rename 'this' variablesBrandon Williams, Feb 14, 2018
  55. Junio C HamanoFeb 14, 2018
  56. Brandon WilliamsFeb 14, 2018
  57. 09/37 checkout: rename 'new' variablesBrandon Williams, Feb 14, 2018
  58. 10/37 help: rename 'new' variablesBrandon Williams, Feb 14, 2018
  59. 11/37 pack-redundant: rename 'new' variablesBrandon Williams, Feb 14, 2018
  60. 12/37 reflog: rename 'new' variablesBrandon Williams, Feb 14, 2018
  61. 15/37 commit: rename 'new' variablesBrandon Williams, Feb 14, 2018
  62. 16/37 diff-lib: rename 'new' variableBrandon Williams, Feb 14, 2018
  63. 18/37 diffcore-delta: rename 'new' variablesBrandon Williams, Feb 14, 2018
  64. 19/37 entry: rename 'new' variablesBrandon Williams, Feb 14, 2018
  65. 20/37 http: rename 'new' variablesBrandon Williams, Feb 14, 2018
  66. 21/37 imap-send: rename 'new' variablesBrandon Williams, Feb 14, 2018
  67. 22/37 line-log: rename 'new' variablesBrandon Williams, Feb 14, 2018
  68. 23/37 read-cache: rename 'new' variablesBrandon Williams, Feb 14, 2018
  69. 24/37 ref-filter: rename 'new' variablesBrandon Williams, Feb 14, 2018
  70. 26/37 split-index: rename 'new' variablesBrandon Williams, Feb 14, 2018
  71. 25/37 remote: rename 'new' variablesBrandon Williams, Feb 14, 2018
  72. 28/37 trailer: rename 'new' variablesBrandon Williams, Feb 14, 2018
  73. 29/37 unpack-trees: rename 'new' variablesBrandon Williams, Feb 14, 2018
  74. 27/37 submodule: rename 'new' variablesBrandon Williams, Feb 14, 2018
  75. 30/37 init-db: rename 'template' variablesBrandon Williams, Feb 14, 2018
  76. 33/37 environment: rename 'namespace' variablesBrandon Williams, Feb 14, 2018
  77. 34/37 wrapper: rename 'template' variablesBrandon Williams, Feb 14, 2018
  78. 35/37 tempfile: rename 'template' variablesBrandon Williams, Feb 14, 2018
  79. 36/37 trailer: rename 'template' variablesBrandon Williams, Feb 14, 2018
  80. 37/37 replace: rename 'new' variablesBrandon Williams, Feb 14, 2018
  81. 31/37 environment: rename 'template' variablesBrandon Williams, Feb 14, 2018
  82. 32/37 diff: rename 'template' variablesBrandon Williams, Feb 14, 2018
  83. 17/37 diff: rename 'new' variablesBrandon Williams, Feb 14, 2018
  84. 07/37 apply: rename 'try' variablesBrandon Williams, Feb 14, 2018
  85. 14/37 combine-diff: rename 'new' variablesBrandon Williams, Feb 14, 2018
  86. 08/37 apply: rename 'new' variablesBrandon Williams, Feb 14, 2018
  87. Stefan BellerFeb 14, 2018
  88. 13/37 remote: rename 'new' variablesBrandon Williams, Feb 14, 2018
  89. Stefan BellerFeb 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.