Merge branch 'bw/object-id'
Conversion from uchar[20] to struct object_id continues. * bw/object-id: (33 commits) diff: rename diff_fill_sha1_info to diff_fill_oid_info diffcore-rename: use is_empty_blob_oid tree-diff: convert path_appendnew to object_id tree-diff: convert diff_tree_paths to struct object_id tree-diff: convert try_to_follow_renames to struct object_id builtin/diff-tree: cleanup references to sha1 diff-tree: convert diff_tree_sha1 to struct object_id notes-merge: convert write_note_to_worktree to struct object_id notes-merge: convert verify_notes_filepair to struct object_id notes-merge: convert find_notes_merge_pair_ps to struct object_id notes-merge: convert merge_from_diffs to struct object_id notes-merge: convert notes_merge* to struct object_id tree-diff: convert diff_root_tree_sha1 to struct object_id combine-diff: convert find_paths_* to struct object_id combine-diff: convert diff_tree_combined to struct object_id diff: convert diff_flush_patch_id to struct object_id patch-ids: convert to struct object_id diff: finish conversion for prepare_temp_file to struct object_id diff: convert reuse_worktree_file to struct object_id diff: convert fill_filespec to struct object_id ...
This commit is contained in:
@ -51,17 +51,17 @@ static void terminate_batch(void)
|
||||
}
|
||||
|
||||
/* NOTE: 'ref' refers to a git reference, while 'rev' refers to a svn revision. */
|
||||
static char *read_ref_note(const unsigned char sha1[20])
|
||||
static char *read_ref_note(const struct object_id *oid)
|
||||
{
|
||||
const unsigned char *note_sha1;
|
||||
const struct object_id *note_oid;
|
||||
char *msg = NULL;
|
||||
unsigned long msglen;
|
||||
enum object_type type;
|
||||
|
||||
init_notes(NULL, notes_ref, NULL, 0);
|
||||
if (!(note_sha1 = get_note(NULL, sha1)))
|
||||
if (!(note_oid = get_note(NULL, oid)))
|
||||
return NULL; /* note tree not found */
|
||||
if (!(msg = read_sha1_file(note_sha1, &type, &msglen)))
|
||||
if (!(msg = read_sha1_file(note_oid->hash, &type, &msglen)))
|
||||
error("Empty notes tree. %s", notes_ref);
|
||||
else if (!msglen || type != OBJ_BLOB) {
|
||||
error("Note contains unusable content. "
|
||||
@ -99,8 +99,8 @@ static int parse_rev_note(const char *msg, struct rev_note *res)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int note2mark_cb(const unsigned char *object_sha1,
|
||||
const unsigned char *note_sha1, char *note_path,
|
||||
static int note2mark_cb(const struct object_id *object_oid,
|
||||
const struct object_id *note_oid, char *note_path,
|
||||
void *cb_data)
|
||||
{
|
||||
FILE *file = (FILE *)cb_data;
|
||||
@ -109,14 +109,14 @@ static int note2mark_cb(const unsigned char *object_sha1,
|
||||
enum object_type type;
|
||||
struct rev_note note;
|
||||
|
||||
if (!(msg = read_sha1_file(note_sha1, &type, &msglen)) ||
|
||||
if (!(msg = read_sha1_file(note_oid->hash, &type, &msglen)) ||
|
||||
!msglen || type != OBJ_BLOB) {
|
||||
free(msg);
|
||||
return 1;
|
||||
}
|
||||
if (parse_rev_note(msg, ¬e))
|
||||
return 2;
|
||||
if (fprintf(file, ":%d %s\n", note.rev_nr, sha1_to_hex(object_sha1)) < 1)
|
||||
if (fprintf(file, ":%d %s\n", note.rev_nr, oid_to_hex(object_oid)) < 1)
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
@ -170,15 +170,15 @@ static int cmd_import(const char *line)
|
||||
int code;
|
||||
int dumpin_fd;
|
||||
char *note_msg;
|
||||
unsigned char head_sha1[20];
|
||||
struct object_id head_oid;
|
||||
unsigned int startrev;
|
||||
struct child_process svndump_proc = CHILD_PROCESS_INIT;
|
||||
const char *command = "svnrdump";
|
||||
|
||||
if (read_ref(private_ref, head_sha1))
|
||||
if (read_ref(private_ref, head_oid.hash))
|
||||
startrev = 0;
|
||||
else {
|
||||
note_msg = read_ref_note(head_sha1);
|
||||
note_msg = read_ref_note(&head_oid);
|
||||
if(note_msg == NULL) {
|
||||
warning("No note found for %s.", private_ref);
|
||||
startrev = 0;
|
||||
|
Reference in New Issue
Block a user