builder: Properly check for gitlink trees

Instead of expecting the second word to be "commit", we should do like
git does and check for the file mode, which is 160000 for gitlink trees.

cda1bbd474/cache.h (L96)
This commit is contained in:
Mathieu Bridon
2016-09-12 23:07:07 +02:00
parent 95891501a0
commit 5430d4d40e

View File

@@ -327,7 +327,7 @@ git_mirror_submodules (const char *repo_location,
words = g_strsplit_set (lines[0], " \t", 4);
if (g_strcmp0 (words[1], "commit") != 0)
if (g_strcmp0 (words[0], "160000") != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Not a gitlink tree: %s", path);
return FALSE;
@@ -482,7 +482,7 @@ git_extract_submodule (const char *repo_location,
words = g_strsplit_set (lines[0], " \t", 4);
if (g_strcmp0 (words[1], "commit") != 0)
if (g_strcmp0 (words[0], "160000") != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Not a gitlink tree: %s", path);
return FALSE;