Skip to content

Commit efdfe11

Browse files
bmwillgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 31c2c7a commit efdfe11

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

builtin/replace.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -284,30 +284,30 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
284284
{
285285
char *tmpfile = git_pathdup("REPLACE_EDITOBJ");
286286
enum object_type type;
287-
struct object_id old, new, prev;
287+
struct object_id old_oid, new_oid, prev;
288288
struct strbuf ref = STRBUF_INIT;
289289

290-
if (get_oid(object_ref, &old) < 0)
290+
if (get_oid(object_ref, &old_oid) < 0)
291291
die("Not a valid object name: '%s'", object_ref);
292292

293-
type = sha1_object_info(old.hash, NULL);
293+
type = sha1_object_info(old_oid.hash, NULL);
294294
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));
296296

297-
check_ref_valid(&old, &prev, &ref, force);
297+
check_ref_valid(&old_oid, &prev, &ref, force);
298298
strbuf_release(&ref);
299299

300-
export_object(&old, type, raw, tmpfile);
300+
export_object(&old_oid, type, raw, tmpfile);
301301
if (launch_editor(tmpfile, NULL, NULL) < 0)
302302
die("editing object file failed");
303-
import_object(&new, type, raw, tmpfile);
303+
import_object(&new_oid, type, raw, tmpfile);
304304

305305
free(tmpfile);
306306

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));
309309

310-
return replace_object_oid(object_ref, &old, "replacement", &new, force);
310+
return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
311311
}
312312

313313
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)
386386

387387
static int create_graft(int argc, const char **argv, int force)
388388
{
389-
struct object_id old, new;
389+
struct object_id old_oid, new_oid;
390390
const char *old_ref = argv[0];
391391
struct commit *commit;
392392
struct strbuf buf = STRBUF_INIT;
393393
const char *buffer;
394394
unsigned long size;
395395

396-
if (get_oid(old_ref, &old) < 0)
396+
if (get_oid(old_ref, &old_oid) < 0)
397397
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);
399399

400400
buffer = get_commit_buffer(commit, &size);
401401
strbuf_add(&buf, buffer, size);
@@ -410,15 +410,15 @@ static int create_graft(int argc, const char **argv, int force)
410410

411411
check_mergetags(commit, argc, argv);
412412

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))
414414
die(_("could not write replacement commit for: '%s'"), old_ref);
415415

416416
strbuf_release(&buf);
417417

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));
420420

421-
return replace_object_oid(old_ref, &old, "replacement", &new, force);
421+
return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force);
422422
}
423423

424424
int cmd_replace(int argc, const char **argv, const char *prefix)

0 commit comments

Comments
 (0)