mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 20:17:59 +00:00
checkout: create submodule dirs
This commit is contained in:
parent
7cae2bcdf9
commit
dc03369c07
@ -87,8 +87,11 @@ static int checkout_walker(const char *path, const git_tree_entry *entry, void *
|
|||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
tree_walk_data *data = (tree_walk_data*)payload;
|
tree_walk_data *data = (tree_walk_data*)payload;
|
||||||
int attr = git_tree_entry_attributes(entry);
|
int attr = git_tree_entry_attributes(entry);
|
||||||
|
git_buf fnbuf = GIT_BUF_INIT;
|
||||||
/* TODO: handle submodules */
|
git_buf_join_n(&fnbuf, '/', 3,
|
||||||
|
git_repository_workdir(data->repo),
|
||||||
|
path,
|
||||||
|
git_tree_entry_name(entry));
|
||||||
|
|
||||||
switch(git_tree_entry_type(entry))
|
switch(git_tree_entry_type(entry))
|
||||||
{
|
{
|
||||||
@ -96,21 +99,18 @@ static int checkout_walker(const char *path, const git_tree_entry *entry, void *
|
|||||||
/* Nothing to do; the blob handling creates necessary directories. */
|
/* Nothing to do; the blob handling creates necessary directories. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GIT_OBJ_COMMIT:
|
||||||
|
/* Submodule */
|
||||||
|
retcode = p_mkdir(git_buf_cstr(&fnbuf), 0644);
|
||||||
|
break;
|
||||||
|
|
||||||
case GIT_OBJ_BLOB:
|
case GIT_OBJ_BLOB:
|
||||||
{
|
if (S_ISLNK(attr)) {
|
||||||
git_buf fnbuf = GIT_BUF_INIT;
|
retcode = blob_contents_to_link(data, &fnbuf,
|
||||||
git_buf_join_n(&fnbuf, '/', 3,
|
git_tree_entry_id(entry));
|
||||||
git_repository_workdir(data->repo),
|
} else {
|
||||||
path,
|
retcode = blob_contents_to_file(data->repo, &fnbuf,
|
||||||
git_tree_entry_name(entry));
|
git_tree_entry_id(entry), attr);
|
||||||
if (S_ISLNK(attr)) {
|
|
||||||
retcode = blob_contents_to_link(data, &fnbuf,
|
|
||||||
git_tree_entry_id(entry));
|
|
||||||
} else {
|
|
||||||
retcode = blob_contents_to_file(data->repo, &fnbuf,
|
|
||||||
git_tree_entry_id(entry), attr);
|
|
||||||
}
|
|
||||||
git_buf_free(&fnbuf);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -119,6 +119,7 @@ static int checkout_walker(const char *path, const git_tree_entry *entry, void *
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git_buf_free(&fnbuf);
|
||||||
data->stats->processed++;
|
data->stats->processed++;
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user