forked from enlightenment/edi
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:
parent
9b29a396d9
commit
98af64fd4a
|
@ -722,7 +722,7 @@ _edi_welcome_clone_thread_run_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Edi_Welcome_Data *wd = data;
|
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
|
static void
|
||||||
|
|
|
@ -406,7 +406,7 @@ edi_create_example(const char *example_name, const char *parentdir,
|
||||||
if (ecore_file_exists(examplepath))
|
if (ecore_file_exists(examplepath))
|
||||||
status = edi_scm_git_update(examplepath);
|
status = edi_scm_git_update(examplepath);
|
||||||
else
|
else
|
||||||
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath);
|
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath, EINA_FALSE);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,12 +73,16 @@ edi_scm_git_new(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
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;
|
int code;
|
||||||
Eina_Strbuf *command = eina_strbuf_new();
|
Eina_Strbuf *command = eina_strbuf_new();
|
||||||
|
|
||||||
|
if (history)
|
||||||
eina_strbuf_append_printf(command, "git clone '%s' '%s'", url, dir);
|
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));
|
code = edi_exe_wait(eina_strbuf_string_get(command));
|
||||||
|
|
||||||
eina_strbuf_free(command);
|
eina_strbuf_free(command);
|
||||||
|
|
|
@ -132,11 +132,13 @@ EAPI int edi_scm_git_new(void);
|
||||||
*
|
*
|
||||||
* @param url The URL to clone from.
|
* @param url The URL to clone from.
|
||||||
* @param dir The new directory that will be created to clone into.
|
* @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.
|
* @return The status code of the clone command.
|
||||||
*
|
*
|
||||||
* @ingroup Scm
|
* @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.
|
* Update a local git repository from remote source.
|
||||||
|
|
Loading…
Reference in New Issue