aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/deliverable.c7
-rw-r--r--src/utils.c22
2 files changed, 27 insertions, 2 deletions
diff --git a/src/deliverable.c b/src/deliverable.c
index 9b5d94d..e1179a4 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -1302,7 +1302,12 @@ void delivery_tests_run(struct Delivery *ctx) {
}
}
msg(OMC_MSG_L3, "Cloning repository %s\n", ctx->tests[i].repository);
- git_clone(&proc, ctx->tests[i].repository, destdir, ctx->tests[i].version);
+ if (!git_clone(&proc, ctx->tests[i].repository, destdir, ctx->tests[i].version)) {
+ ctx->tests[i].repository_info_tag = strdup(git_describe(destdir));
+ ctx->tests[i].repository_info_ref = strdup(git_rev_parse(destdir, "HEAD"));
+ } else {
+ COE_CHECK_ABORT(!globals.continue_on_error, "Unable to clone repository\n")
+ }
if (pushd(destdir)) {
COE_CHECK_ABORT(!globals.continue_on_error, "Unable to enter repository directory\n")
diff --git a/src/utils.c b/src/utils.c
index 12cf22c..d8cf929 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -377,7 +377,27 @@ char *git_describe(const char *path) {
pushd(path);
static char version[NAME_MAX];
FILE *pp;
- pp = popen("git describe --always --tags", "r");
+ pp = popen("git describe --first-parent --always --tags", "r");
+ memset(version, 0, sizeof(version));
+ fgets(version, sizeof(version) - 1, pp);
+ strip(version);
+ pclose(pp);
+ popd();
+ return version;
+}
+
+char *git_rev_parse(const char *path, char *args) {
+ pushd(path);
+ static char version[NAME_MAX];
+ char cmd[PATH_MAX];
+ FILE *pp;
+
+ if (isempty(args)) {
+ fprintf(stderr, "git_rev_parse args cannot be empty");
+ return NULL;
+ }
+ sprintf(cmd, "git rev-parse %s", args);
+ pp = popen(cmd, "r");
memset(version, 0, sizeof(version));
fgets(version, sizeof(version) - 1, pp);
strip(version);