submodule: 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 bc099914d4a83e53a31eb6952d4366d9d8ac2c79
2 files changed +16 -16
submodule.c
+15 -15
@@ -590,7 +590,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
590 struct object_id *one, struct object_id *two,
591 unsigned dirty_submodule)
592 {
593 - const struct object_id *old = the_hash_algo->empty_tree, *new = the_hash_algo->empty_tree;
593 + const struct object_id *old_oid = the_hash_algo->empty_tree, *new_oid = the_hash_algo->empty_tree;
594 struct commit *left = NULL, *right = NULL;
595 struct commit_list *merge_bases = NULL;
596 struct child_process cp = CHILD_PROCESS_INIT;
@@ -605,9 +605,9 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
605 goto done;
606
607 if (left)
608 - old = one;
608 + old_oid = one;
609 if (right)
610 - new = two;
610 + new_oid = two;
611
612 cp.git_cmd = 1;
613 cp.dir = path;
@@ -630,7 +630,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
630 argv_array_pushf(&cp.args, "--dst-prefix=%s%s/",
631 o->b_prefix, path);
632 }
633 - argv_array_push(&cp.args, oid_to_hex(old));
633 + argv_array_push(&cp.args, oid_to_hex(old_oid));
634 /*
635 * If the submodule has modified content, we will diff against the
636 * work tree, under the assumption that the user has asked for the
@@ -638,7 +638,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
638 * haven't yet been committed to the submodule yet.
639 */
640 if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
641 - argv_array_push(&cp.args, oid_to_hex(new));
641 + argv_array_push(&cp.args, oid_to_hex(new_oid));
642
643 prepare_submodule_repo_env(&cp.env_array);
644 if (start_command(&cp))
@@ -1578,8 +1578,8 @@ static void submodule_reset_index(const char *path)
1578 * pass NULL for old or new respectively.
1579 */
1580 int submodule_move_head(const char *path,
1581 - const char *old,
1582 - const char *new,
1581 + const char *old_head,
1582 + const char *new_head,
1583 unsigned flags)
1584 {
1585 int ret = 0;
@@ -1600,7 +1600,7 @@ int submodule_move_head(const char *path,
1600 else
1601 error_code_ptr = NULL;
1602
1603 - if (old && !is_submodule_populated_gently(path, error_code_ptr))
1603 + if (old_head && !is_submodule_populated_gently(path, error_code_ptr))
1604 return 0;
1605
1606 sub = submodule_from_path(&null_oid, path);
@@ -1608,14 +1608,14 @@ int submodule_move_head(const char *path,
1608 if (!sub)
1609 die("BUG: could not get submodule information for '%s'", path);
1610
1611 - if (old && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {
1611 + if (old_head && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {
1612 /* Check if the submodule has a dirty index. */
1613 if (submodule_has_dirty_index(sub))
1614 return error(_("submodule '%s' has dirty index"), path);
1615 }
1616
1617 if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
1618 - if (old) {
1618 + if (old_head) {
1619 if (!submodule_uses_gitfile(path))
1620 absorb_git_dir_into_superproject("", path,
1621 ABSORB_GITDIR_RECURSE_SUBMODULES);
@@ -1629,7 +1629,7 @@ int submodule_move_head(const char *path,
1629 submodule_reset_index(path);
1630 }
1631
1632 - if (old && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
1632 + if (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
1633 char *gitdir = xstrfmt("%s/modules/%s",
1634 get_git_common_dir(), sub->name);
1635 connect_work_tree_and_git_dir(path, gitdir);
@@ -1658,9 +1658,9 @@ int submodule_move_head(const char *path,
1658 argv_array_push(&cp.args, "-m");
1659
1660 if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
1661 - argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
1661 + argv_array_push(&cp.args, old_head ? old_head : EMPTY_TREE_SHA1_HEX);
1662
1663 - argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
1663 + argv_array_push(&cp.args, new_head ? new_head : EMPTY_TREE_SHA1_HEX);
1664
1665 if (run_command(&cp)) {
1666 ret = -1;
@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,
1668 }
1669
1670 if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
1671 - if (new) {
1671 + if (new_head) {
1672 child_process_init(&cp);
1673 /* also set the HEAD accordingly */
1674 cp.git_cmd = 1;
@@ -1677,7 +1677,7 @@ int submodule_move_head(const char *path,
1677
1678 prepare_submodule_repo_env(&cp.env_array);
1679 argv_array_pushl(&cp.args, "update-ref", "HEAD",
1680 - "--no-deref", new, NULL);
1680 + "--no-deref", new_head, NULL);
1681
1682 if (run_command(&cp)) {
1683 ret = -1;
submodule.h
+1 -1
@@ -117,7 +117,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule);
117 #define SUBMODULE_MOVE_HEAD_FORCE (1<<1)
118 extern int submodule_move_head(const char *path,
119 const char *old,
120 - const char *new,
120 + const char *new_head,
121 unsigned flags);
122
123 /*