scm: Add clone depth.

It's useful to either clone a full git history or one commit in
depth. One for cloning an existing (welcome screen) and one
shallow clone for our examples repo which is massive now!
This probably could become useful later on. It resolves the issue
of our examples being huge now.
This commit is contained in:
Alastair Poole 2020-03-13 21:51:06 +00:00
parent 9b29a396d9
commit 98af64fd4a
4 changed files with 11 additions and 5 deletions

View File

@ -722,7 +722,7 @@ _edi_welcome_clone_thread_run_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
{
Edi_Welcome_Data *wd = data;
wd->status = edi_scm_git_clone(wd->url, wd->dir);
wd->status = edi_scm_git_clone(wd->url, wd->dir, EINA_TRUE);
}
static void

View File

@ -406,7 +406,7 @@ edi_create_example(const char *example_name, const char *parentdir,
if (ecore_file_exists(examplepath))
status = edi_scm_git_update(examplepath);
else
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath);
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath, EINA_FALSE);
if (status)
{

View File

@ -73,12 +73,16 @@ edi_scm_git_new(void)
}
EAPI int
edi_scm_git_clone(const char *url, const char *dir)
edi_scm_git_clone(const char *url, const char *dir, Eina_Bool history)
{
int code;
Eina_Strbuf *command = eina_strbuf_new();
eina_strbuf_append_printf(command, "git clone '%s' '%s'", url, dir);
if (history)
eina_strbuf_append_printf(command, "git clone '%s' '%s'", url, dir);
else
eina_strbuf_append_printf(command, "git clone --depth 1 '%s' '%s'", url, dir);
code = edi_exe_wait(eina_strbuf_string_get(command));
eina_strbuf_free(command);

View File

@ -132,11 +132,13 @@ EAPI int edi_scm_git_new(void);
*
* @param url The URL to clone from.
* @param dir The new directory that will be created to clone into.
* @param history Whether to clone a full git history or single commit.
*
* @return The status code of the clone command.
*
* @ingroup Scm
*/
EAPI int edi_scm_git_clone(const char *url, const char *dir);
EAPI int edi_scm_git_clone(const char *url, const char *dir, Eina_Bool history);
/**
* Update a local git repository from remote source.