Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-07 09:05:22 +0300
committerJunio C Hamano <gitster@pobox.com>2019-02-07 09:05:23 +0300
commit7589e63648bf5224e186990931b1491f36e10a4b (patch)
treedfd3004e735b69ae91dc08ac4f742f1cb84eae5d /notes-utils.c
parente52c6bbd131f1f4f17b95e28d12ead0c81a8e890 (diff)
parentf8adbec9feaa7a1ab9814db1115826e87033712e (diff)
Merge branch 'nd/the-index-final'
The assumption to work on the single "in-core index" instance has been reduced from the library-ish part of the codebase. * nd/the-index-final: cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch read-cache.c: remove the_* from index_has_changes() merge-recursive.c: remove implicit dependency on the_repository merge-recursive.c: remove implicit dependency on the_index sha1-name.c: remove implicit dependency on the_index read-cache.c: replace update_index_if_able with repo_& read-cache.c: kill read_index() checkout: avoid the_index when possible repository.c: replace hold_locked_index() with repo_hold_locked_index() notes-utils.c: remove the_repository references grep: use grep_opt->repo instead of explict repo argument
Diffstat (limited to 'notes-utils.c')
-rw-r--r--notes-utils.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/notes-utils.c b/notes-utils.c
index 14ea03178e..a819410698 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -5,7 +5,9 @@
#include "notes-utils.h"
#include "repository.h"
-void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
+void create_notes_commit(struct repository *r,
+ struct notes_tree *t,
+ struct commit_list *parents,
const char *msg, size_t msg_len,
struct object_id *result_oid)
{
@@ -20,8 +22,7 @@ void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
/* Deduce parent commit from t->ref */
struct object_id parent_oid;
if (!read_ref(t->ref, &parent_oid)) {
- struct commit *parent = lookup_commit(the_repository,
- &parent_oid);
+ struct commit *parent = lookup_commit(r, &parent_oid);
if (parse_commit(parent))
die("Failed to find/parse commit %s", t->ref);
commit_list_insert(parent, &parents);
@@ -34,7 +35,7 @@ void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
die("Failed to commit notes tree to database");
}
-void commit_notes(struct notes_tree *t, const char *msg)
+void commit_notes(struct repository *r, struct notes_tree *t, const char *msg)
{
struct strbuf buf = STRBUF_INIT;
struct object_id commit_oid;
@@ -50,7 +51,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
strbuf_addstr(&buf, msg);
strbuf_complete_line(&buf);
- create_notes_commit(t, NULL, buf.buf, buf.len, &commit_oid);
+ create_notes_commit(r, t, NULL, buf.buf, buf.len, &commit_oid);
strbuf_insert(&buf, 0, "notes: ", 7); /* commit message starts at index 7 */
update_ref(buf.buf, t->update_ref, &commit_oid, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
@@ -171,11 +172,13 @@ int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
return ret;
}
-void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c, const char *msg)
+void finish_copy_notes_for_rewrite(struct repository *r,
+ struct notes_rewrite_cfg *c,
+ const char *msg)
{
int i;
for (i = 0; c->trees[i]; i++) {
- commit_notes(c->trees[i], msg);
+ commit_notes(r, c->trees[i], msg);
free_notes(c->trees[i]);
}
free(c->trees);