From c8b6110ec34565dd81413dd7498589c36551b3ec Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 30 Jul 2015 10:44:35 +0000 Subject: Fix Yarn tests to not include .git directory in built artifacts When I spotted that artifacts contained a .git directory I was worried that it might indicate a Morph bug. It turned out to be due to the way the 'test shell' used in the Yarn tests works. This change should save anyone else from similar confusion. Change-Id: I97b57eff7aa947506d4062a76e9803398e46c2b6 --- scripts/test-shell.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/test-shell.c b/scripts/test-shell.c index 1a6f1642..9818fbb4 100644 --- a/scripts/test-shell.c +++ b/scripts/test-shell.c @@ -81,6 +81,10 @@ int copy_entry(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { int ret = 0; char *target_path = NULL; + if (strncmp(fpath, "./.git", 6) == 0) { + /* Skip ./.git directory and its contents. */ + return 0; + } if (asprintf(&target_path, "%s/%s", getenv("DESTDIR"), fpath) == -1) { return -1; } @@ -93,7 +97,7 @@ int copy_entry(const char *fpath, const struct stat *sb, int typeflag, } break; case FTW_D: - case FTW_DNR: + case FTW_DNR: { /* Copy directory */ if (mkdir(target_path, sb->st_mode)) { if (errno != EEXIST) { @@ -102,6 +106,7 @@ int copy_entry(const char *fpath, const struct stat *sb, int typeflag, } } break; + } case FTW_NS: case FTW_SL: case FTW_SLN: { -- cgit v1.2.1