replace: 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 efdfe11f4f1f901db1ebfa7ebda6337293a2e5c5
1 file changed +17 -17
builtin/replace.c
+17 -17
@@ -284,30 +284,30 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
284 {
285 char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
286 enum object_type type;
287 - struct object_id old, new, prev;
287 + struct object_id old_oid, new_oid, prev;
288 struct strbuf ref = STRBUF_INIT;
289
290 - if (get_oid(object_ref, &old) < 0)
290 + if (get_oid(object_ref, &old_oid) < 0)
291 die("Not a valid object name: '%s'", object_ref);
292
293 - type = sha1_object_info(old.hash, NULL);
293 + type = sha1_object_info(old_oid.hash, NULL);
294 if (type < 0)
295 - die("unable to get object type for %s", oid_to_hex(&old));
295 + die("unable to get object type for %s", oid_to_hex(&old_oid));
296
297 - check_ref_valid(&old, &prev, &ref, force);
297 + check_ref_valid(&old_oid, &prev, &ref, force);
298 strbuf_release(&ref);
299
300 - export_object(&old, type, raw, tmpfile);
300 + export_object(&old_oid, type, raw, tmpfile);
301 if (launch_editor(tmpfile, NULL, NULL) < 0)
302 die("editing object file failed");
303 - import_object(&new, type, raw, tmpfile);
303 + import_object(&new_oid, type, raw, tmpfile);
304
305 free(tmpfile);
306
307 - if (!oidcmp(&old, &new))
308 - return error("new object is the same as the old one: '%s'", oid_to_hex(&old));
307 + if (!oidcmp(&old_oid, &new_oid))
308 + return error("new object is the same as the old one: '%s'", oid_to_hex(&old_oid));
309
310 - return replace_object_oid(object_ref, &old, "replacement", &new, force);
310 + return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
311 }
312
313 static void replace_parents(struct strbuf *buf, int argc, const char **argv)
@@ -386,16 +386,16 @@ static void check_mergetags(struct commit *commit, int argc, const char **argv)
386
387 static int create_graft(int argc, const char **argv, int force)
388 {
389 - struct object_id old, new;
389 + struct object_id old_oid, new_oid;
390 const char *old_ref = argv[0];
391 struct commit *commit;
392 struct strbuf buf = STRBUF_INIT;
393 const char *buffer;
394 unsigned long size;
395
396 - if (get_oid(old_ref, &old) < 0)
396 + if (get_oid(old_ref, &old_oid) < 0)
397 die(_("Not a valid object name: '%s'"), old_ref);
398 - commit = lookup_commit_or_die(&old, old_ref);
398 + commit = lookup_commit_or_die(&old_oid, old_ref);
399
400 buffer = get_commit_buffer(commit, &size);
401 strbuf_add(&buf, buffer, size);
@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)
410
411 check_mergetags(commit, argc, argv);
412
413 - if (write_sha1_file(buf.buf, buf.len, commit_type, new.hash))
413 + if (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))
414 die(_("could not write replacement commit for: '%s'"), old_ref);
415
416 strbuf_release(&buf);
417
418 - if (!oidcmp(&old, &new))
419 - return error("new commit is the same as the old one: '%s'", oid_to_hex(&old));
418 + if (!oidcmp(&old_oid, &new_oid))
419 + return error("new commit is the same as the old one: '%s'", oid_to_hex(&old_oid));
420
421 - return replace_object_oid(old_ref, &old, "replacement", &new, force);
421 + return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force);
422 }
423
424 int cmd_replace(int argc, const char **argv, const char *prefix)