I've got code (where commit_id
is already set) like:
git_note* note;
git_note_read(¬e, repo, "refs/notes/label", &commit_oid);
printf("%s\n", note->message);
git_note_free(note);
It doesn't compile, complaining:
.../importer_test.cc:103:22: error: member access into incomplete type 'git_note'
printf("%s\n", note->message);
^
.../include/git2/types.h:160:16: note: forward declaration of 'git_note'
typedef struct git_note git_note;
If I just copy/paste from src/notes.h
into this file:
struct git_note {
git_oid id;
git_signature *author;
git_signature *committer;
char *message;
};
It compiles and runs correctly. But surely that's not the right solution?
git_note
is an opaque type. You're not meant to access members of the data directly. You should be using the accessor functions to read from it. In your case, you would want to use git_note_message()
to get the message.