shallow: extract a header file for shallow-related functions
There are many functions in commit.h that are more related to shallow repositories than they are to any sort of generic commit machinery. Likely this began when there were only a few shallow-related functions, and commit.h seemed a reasonable enough place to put them. But, now there are a good number of shallow-related functions, and placing them all in 'commit.h' doesn't make sense. This patch extracts a 'shallow.h', which takes all of the declarations from 'commit.h' for functions which already exist in 'shallow.c'. We will bring the remaining shallow-related functions defined in 'commit.c' in a subsequent patch. For now, move only the ones that already are implemented in 'shallow.c', and update the necessary includes. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
183df649ca
commit
120ad2b0f1
14
commit.c
14
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 **);
|
||||
|
||||
@ -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