summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-07-30 10:44:35 +0000
committerBaserock Gerrit <gerrit@baserock.org>2015-08-11 13:20:21 +0000
commitc8b6110ec34565dd81413dd7498589c36551b3ec (patch)
tree9d8382b6f141230f2990583ca253df98fb7ecc81
parentb5b0b231a8f3b5b4cd93720d56ec86f8f83101d4 (diff)
downloadmorph-c8b6110ec34565dd81413dd7498589c36551b3ec.tar.gz
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
-rw-r--r--scripts/test-shell.c7
1 files changed, 6 insertions, 1 deletions
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: {