Commit 1686641f by Sascha Cunz

Extract submodule logic out of diff_output.c:get_workdir_content

parent 7e57d250
...@@ -267,18 +267,12 @@ static int get_blob_content( ...@@ -267,18 +267,12 @@ static int get_blob_content(
return diff_delta_is_binary_by_content(ctxt, delta, file, map); return diff_delta_is_binary_by_content(ctxt, delta, file, map);
} }
static int get_workdir_content( static int get_workdir_sm_content(
diff_context *ctxt, diff_context *ctxt,
git_diff_delta *delta,
git_diff_file *file, git_diff_file *file,
git_map *map) git_map *map)
{ {
int error = 0; int error = 0;
git_buf path = GIT_BUF_INIT;
const char *wd = git_repository_workdir(ctxt->repo);
if (file->mode == GIT_FILEMODE_COMMIT)
{
git_buf content = GIT_BUF_INIT; git_buf content = GIT_BUF_INIT;
git_submodule* sm = NULL; git_submodule* sm = NULL;
const git_oid* sm_head = NULL; const git_oid* sm_head = NULL;
...@@ -312,7 +306,20 @@ static int get_workdir_content( ...@@ -312,7 +306,20 @@ static int get_workdir_content(
file->flags |= GIT_DIFF_FILE_FREE_DATA; file->flags |= GIT_DIFF_FILE_FREE_DATA;
return 0; return 0;
} }
static int get_workdir_content(
diff_context *ctxt,
git_diff_delta *delta,
git_diff_file *file,
git_map *map)
{
int error = 0;
git_buf path = GIT_BUF_INIT;
const char *wd = git_repository_workdir(ctxt->repo);
if (file->mode == GIT_FILEMODE_COMMIT)
return get_workdir_sm_content(ctxt, file, map);
if (git_buf_joinpath(&path, wd, file->path) < 0) if (git_buf_joinpath(&path, wd, file->path) < 0)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment