694
o.show_rename_progress = 1;
695
696
head_tree = parse_tree_indirect(head);
697
- next_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);
698
- base_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);
697
+ next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);
698
+ base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);
699
700
for (i = 0; i < opts->xopts_nr; i++)
701
parse_merge_opt(&o, opts->xopts[i]);
773
* the commit is invalid, repo_parse_commit() will complain. So
774
* there is nothing for us to say here. Just return failure.
775
*/
776
- if (repo_parse_commit(the_repository, head_commit))
776
+ if (repo_parse_commit(r, head_commit))
777
return -1;
778
779
if (!(cache_tree_oid = get_cache_tree_oid(istate)))
1338
commit = lookup_commit(r, oid);
1339
if (!commit)
1340
die(_("couldn't look up newly created commit"));
1341
- if (repo_parse_commit(the_repository, commit))
1341
+ if (repo_parse_commit(r, commit))
1342
die(_("could not parse newly created commit"));
1343
1344
strbuf_addstr(&format, "format:%h] %s");
1345
1346
- repo_format_commit_message(the_repository, commit, "%an <%ae>",
1347
- &author_ident, &pctx);
1348
- repo_format_commit_message(the_repository, commit, "%cn <%ce>",
1349
- &committer_ident, &pctx);
1346
+ repo_format_commit_message(r, commit, "%an <%ae>", &author_ident,
1347
+ &pctx);
1348
+ repo_format_commit_message(r, commit, "%cn <%ce>", &committer_ident,
1349
+ &pctx);
1350
if (strbuf_cmp(&author_ident, &committer_ident)) {
1351
strbuf_addstr(&format, "\n Author: ");
1352
strbuf_addbuf_percentquote(&format, &author_ident);
1354
if (flags & SUMMARY_SHOW_AUTHOR_DATE) {
1355
struct strbuf date = STRBUF_INIT;
1356
1357
- repo_format_commit_message(the_repository, commit, "%ad",
1358
- &date, &pctx);
1357
+ repo_format_commit_message(r, commit, "%ad", &date, &pctx);
1358
strbuf_addstr(&format, "\n Date: ");
1359
strbuf_addbuf_percentquote(&format, &date);
1360
strbuf_release(&date);
1384
rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
1385
diff_setup_done(&rev.diffopt);
1386
1388
- refs = get_main_ref_store(the_repository);
1387
+ refs = get_main_ref_store(r);
1388
head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL);
1389
if (!head)
1390
die(_("unable to resolve HEAD after creating commit"));
1410
struct commit *current_head;
1411
struct object_id oid;
1412
1414
- if (repo_get_oid(the_repository, "HEAD", &oid)) {
1413
+ if (repo_get_oid(r, "HEAD", &oid)) {
1414
current_head = NULL;
1415
} else {
1416
current_head = lookup_commit_reference(r, &oid);
1420
warning(_("HEAD %s is not a commit!"),
1421
oid_to_hex(&oid));
1422
}
1424
- if (repo_parse_commit(the_repository, current_head))
1423
+ if (repo_parse_commit(r, current_head))
1424
return error(_("could not parse HEAD commit"));
1425
}
1426
*head = current_head;
1463
if (flags & AMEND_MSG) {
1464
const char *exclude_gpgsig[] = { "gpgsig", "gpgsig-sha256", NULL };
1465
const char *out_enc = get_commit_output_encoding();
1467
- const char *message = repo_logmsg_reencode(the_repository,
1468
- current_head, NULL,
1469
- out_enc);
1466
+ const char *message = repo_logmsg_reencode(r, current_head,
1467
+ NULL, out_enc);
1468
1469
if (!msg) {
1470
const char *orig_message = NULL;
1475
hook_commit = "HEAD";
1476
}
1477
author = amend_author = get_author(message);
1480
- repo_unuse_commit_buffer(the_repository, current_head,
1478
+ repo_unuse_commit_buffer(r, current_head,
1479
message);
1480
if (!author) {
1481
res = error(_("unable to parse commit author"));
2002
struct commit *head_commit;
2003
const char *head_message, *body;
2004
2007
- if (repo_get_oid(the_repository, "HEAD", &head))
2005
+ if (repo_get_oid(r, "HEAD", &head))
2006
return error(_("need a HEAD to fixup"));
2007
if (!(head_commit = lookup_commit_reference(r, &head)))
2008
return error(_("could not read HEAD"));
2011
- if (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))
2009
+ if (!(head_message = repo_logmsg_reencode(r, head_commit, NULL,
2010
+ encoding)))
2011
return error(_("could not read HEAD's commit message"));
2012
2013
find_commit_subject(head_message, &body);
2014
if (command == TODO_FIXUP && !flag && write_message(body, strlen(body),
2015
rebase_path_fixup_msg(), 0) < 0) {
2017
- repo_unuse_commit_buffer(the_repository, head_commit,
2018
- head_message);
2016
+ repo_unuse_commit_buffer(r, head_commit, head_message);
2017
return error(_("cannot write '%s'"), rebase_path_fixup_msg());
2018
}
2019
strbuf_addf(&buf, "%c ", comment_line_char);
2028
else
2029
strbuf_addstr(&buf, body);
2030
2033
- repo_unuse_commit_buffer(the_repository, head_commit,
2034
- head_message);
2031
+ repo_unuse_commit_buffer(r, head_commit, head_message);
2032
}
2033
2037
- if (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))
2034
+ if (!(message = repo_logmsg_reencode(r, commit, NULL, encoding)))
2035
return error(_("could not read commit message of %s"),
2036
oid_to_hex(&commit->object.oid));
2037
find_commit_subject(message, &body);
2046
strbuf_add_commented_lines(&buf, body, strlen(body));
2047
} else
2048
return error(_("unknown command: %d"), command);
2052
- repo_unuse_commit_buffer(the_repository, commit, message);
2049
+ repo_unuse_commit_buffer(r, commit, message);
2050
2051
if (!res)
2052
res = write_message(buf.buf, buf.len, rebase_path_squash_msg(),
2159
if (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))
2160
return error(_("your index file is unmerged."));
2161
} else {
2165
- unborn = repo_get_oid(the_repository, "HEAD", &head);
2162
+ unborn = repo_get_oid(r, "HEAD", &head);
2163
/* Do we want to generate a root commit? */
2164
if (is_pick_or_similar(command) && opts->have_squash_onto &&
2165
oideq(&head, &opts->squash_onto)) {
2221
msg_file = NULL;
2222
goto fast_forward_edit;
2223
}
2227
- if (parent && repo_parse_commit(the_repository, parent) < 0)
2224
+ if (parent && repo_parse_commit(r, parent) < 0)
2225
/* TRANSLATORS: The first %s will be a "todo" command like
2226
"revert" or "pick", the second %s a SHA1. */
2227
return error(_("%s: cannot parse parent commit %s"),
2613
end_of_object_name = (char *) bol + strcspn(bol, " \t\n");
2614
saved = *end_of_object_name;
2615
*end_of_object_name = '\0';
2619
- status = repo_get_oid(the_repository, bol, &commit_oid);
2616
+ status = repo_get_oid(r, bol, &commit_oid);
2617
if (status < 0)
2618
error(_("could not parse '%s'"), bol); /* return later */
2619
*end_of_object_name = saved;
3528
strbuf_addf(&buf, "%s/message", get_dir(opts));
3529
if (!file_exists(buf.buf)) {
3530
const char *encoding = get_commit_output_encoding();
3534
- const char *commit_buffer = repo_logmsg_reencode(the_repository,
3531
+ const char *commit_buffer = repo_logmsg_reencode(r,
3532
commit, NULL,
3533
encoding);
3534
find_commit_subject(commit_buffer, &subject);
3535
res |= write_message(subject, strlen(subject), buf.buf, 1);
3539
- repo_unuse_commit_buffer(the_repository, commit,
3536
+ repo_unuse_commit_buffer(r, commit,
3537
commit_buffer);
3538
}
3539
strbuf_release(&buf);
3713
if (!transaction) {
3714
error("%s", err.buf);
3715
ret = -1;
3719
- } else if (repo_get_oid(the_repository, "HEAD", &head_oid)) {
3716
+ } else if (repo_get_oid(r, "HEAD", &head_oid)) {
3717
error(_("could not read HEAD"));
3718
ret = -1;
3719
} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,
4001
4002
if (commit) {
4003
const char *encoding = get_commit_output_encoding();
4007
- const char *message = repo_logmsg_reencode(the_repository,
4008
- commit, NULL,
4004
+ const char *message = repo_logmsg_reencode(r, commit, NULL,
4005
encoding);
4006
const char *body;
4007
int len;
4015
find_commit_subject(message, &body);
4016
len = strlen(body);
4017
ret = write_message(body, len, git_path_merge_msg(r), 0);
4022
- repo_unuse_commit_buffer(the_repository, commit, message);
4018
+ repo_unuse_commit_buffer(r, commit, message);
4019
if (ret) {
4020
error_errno(_("could not write '%s'"),
4021
git_path_merge_msg(r));
4115
}
4116
4117
merge_commit = to_merge->item;
4122
- bases = repo_get_merge_bases(the_repository, head_commit,
4123
- merge_commit);
4118
+ bases = repo_get_merge_bases(r, head_commit, merge_commit);
4119
if (bases && oideq(&merge_commit->object.oid,
4120
&bases->item->object.oid)) {
4121
ret = 0;
4470
if (capture_command(&stash, &buf, GIT_MAX_HEXSZ))
4471
die(_("Cannot autostash"));
4472
strbuf_trim_trailing_newline(&buf);
4478
- if (repo_get_oid(the_repository, buf.buf, &oid))
4473
+ if (repo_get_oid(r, buf.buf, &oid))
4474
die(_("Unexpected stash response: '%s'"),
4475
buf.buf);
4476
strbuf_reset(&buf);
4595
struct commit *commit;
4596
struct commit_message message;
4597
4603
- if (repo_get_oid(the_repository, "HEAD", &head) ||
4598
+ if (repo_get_oid(r, "HEAD", &head) ||
4599
!(commit = lookup_commit(r, &head)) ||
4605
- repo_parse_commit(the_repository, commit) || get_message(commit, &message))
4600
+ repo_parse_commit(r, commit) || get_message(commit, &message))
4601
fprintf(stderr, _("Stopped at HEAD\n"));
4602
else {
4603
fprintf(stderr, _("Stopped at %s\n"), message.label);
4745
* otherwise we do not.
4746
*/
4747
if (item->command == TODO_REWORD &&
4753
- !repo_get_oid(the_repository, "HEAD", &oid) &&
4748
+ !repo_get_oid(r, "HEAD", &oid) &&
4749
(oideq(&item->commit->object.oid, &oid) ||
4750
(opts->have_squash_onto &&
4751
oideq(&opts->squash_onto, &oid))))
4834
struct object_id head, orig;
4835
int res;
4836
4842
- if (repo_get_oid(the_repository, "HEAD", &head)) {
4837
+ if (repo_get_oid(r, "HEAD", &head)) {
4838
res = error(_("cannot read HEAD"));
4839
cleanup_head_ref:
4840
strbuf_release(&head_ref);
4881
log_tree_opt.disable_stdin = 1;
4882
4883
if (read_oneliner(&buf, rebase_path_orig_head(), 0) &&
4889
- !repo_get_oid(the_repository, buf.buf, &orig) &&
4890
- !repo_get_oid(the_repository, "HEAD", &head)) {
4884
+ !repo_get_oid(r, buf.buf, &orig) &&
4885
+ !repo_get_oid(r, "HEAD", &head)) {
4886
diff_tree_oid(&orig, &head, "",
4887
&log_tree_opt.diffopt);
4888
log_tree_diff_flush(&log_tree_opt);
4974
struct strbuf rev = STRBUF_INIT;
4975
struct object_id head, to_amend;
4976
4982
- if (repo_get_oid(the_repository, "HEAD", &head))
4977
+ if (repo_get_oid(r, "HEAD", &head))
4978
return error(_("cannot amend non-existing commit"));
4979
if (!read_oneliner(&rev, rebase_path_amend(), 0))
4980
return error(_("invalid file: '%s'"), rebase_path_amend());
5054
const char *encoding = get_commit_output_encoding();
5055
5056
if (parse_head(r, &commit) ||
5062
- !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||
5057
+ !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||
5058
write_message(p, strlen(p), path, 0)) {
5064
- repo_unuse_commit_buffer(the_repository,
5065
- commit, p);
5059
+ repo_unuse_commit_buffer(r, commit, p);
5060
return error(_("could not write file: "
5061
"'%s'"), path);
5062
}
5069
- repo_unuse_commit_buffer(the_repository,
5063
+ repo_unuse_commit_buffer(r,
5064
commit, p);
5065
}
5066
}
5200
if (!strlen(name))
5201
continue;
5202
5209
- if (!repo_get_oid(the_repository, name, &oid)) {
5203
+ if (!repo_get_oid(r, name, &oid)) {
5204
if (!lookup_commit_reference_gently(r, &oid, 1)) {
5205
enum object_type type = oid_object_info(r,
5206
&oid,
5243
if (walk_revs_populate_todo(&todo_list, opts) ||
5244
create_seq_dir(r) < 0)
5245
return -1;
5252
- if (repo_get_oid(the_repository, "HEAD", &oid) && (opts->action == REPLAY_REVERT))
5246
+ if (repo_get_oid(r, "HEAD", &oid) && (opts->action == REPLAY_REVERT))
5247
return error(_("can't revert as initial commit"));
5248
if (save_head(oid_to_hex(&oid)))
5249
return -1;
5938
continue;
5939
if (item->command != TODO_PICK)
5940
break;
5947
- if (repo_parse_commit(the_repository, item->commit)) {
5941
+ if (repo_parse_commit(r, item->commit)) {
5942
return error(_("could not parse commit '%s'"),
5943
oid_to_hex(&item->commit->object.oid));
5944
}
6109
struct object_id oid = onto->object.oid;
6110
int res;
6111
6118
- repo_find_unique_abbrev_r(the_repository, shortonto, &oid,
6112
+ repo_find_unique_abbrev_r(r, shortonto, &oid,
6113
DEFAULT_ABBREV);
6114
6115
if (buf->len == 0) {
6389
if (file_exists(git_path_seq_dir()))
6390
*whence = FROM_CHERRY_PICK_MULTI;
6391
if (file_exists(rebase_path()) &&
6398
- !repo_get_oid(the_repository, "REBASE_HEAD", &rebase_head) &&
6399
- !repo_get_oid(the_repository, "CHERRY_PICK_HEAD", &cherry_pick_head) &&
6392
+ !repo_get_oid(r, "REBASE_HEAD", &rebase_head) &&
6393
+ !repo_get_oid(r, "CHERRY_PICK_HEAD", &cherry_pick_head) &&
6394
oideq(&rebase_head, &cherry_pick_head))
6395
*whence = FROM_REBASE_PICK;
6396
else