Merge branch 'tb/shallow-cleanup'
Code cleanup.
* tb/shallow-cleanup:
shallow: use struct 'shallow_lock' for additional safety
shallow.h: document '{commit,rollback}_shallow_file'
shallow: extract a header file for shallow-related functions
commit: make 'commit_graft_pos' non-static
This commit is contained in:
16
commit.c
16
commit.c
@ -20,6 +20,7 @@
|
||||
#include "refs.h"
|
||||
#include "commit-reach.h"
|
||||
#include "run-command.h"
|
||||
#include "shallow.h"
|
||||
|
||||
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
|
||||
|
||||
@ -110,7 +111,7 @@ static const unsigned char *commit_graft_sha1_access(size_t index, void *table)
|
||||
return commit_graft_table[index]->oid.hash;
|
||||
}
|
||||
|
||||
static int commit_graft_pos(struct repository *r, const unsigned char *sha1)
|
||||
int commit_graft_pos(struct repository *r, const unsigned char *sha1)
|
||||
{
|
||||
return sha1_pos(sha1, r->parsed_objects->grafts,
|
||||
r->parsed_objects->grafts_nr,
|
||||
@ -245,19 +246,6 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int unregister_shallow(const struct object_id *oid)
|
||||
{
|
||||
int pos = commit_graft_pos(the_repository, oid->hash);
|
||||
if (pos < 0)
|
||||
return -1;
|
||||
if (pos + 1 < the_repository->parsed_objects->grafts_nr)
|
||||
MOVE_ARRAY(the_repository->parsed_objects->grafts + pos,
|
||||
the_repository->parsed_objects->grafts + pos + 1,
|
||||
the_repository->parsed_objects->grafts_nr - pos - 1);
|
||||
the_repository->parsed_objects->grafts_nr--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct commit_buffer {
|
||||
void *buffer;
|
||||
unsigned long size;
|
||||
|
||||
Reference in New Issue
Block a user