From 9a729a8cb2929a5272da6e240c9bd63db198f6c4 Mon Sep 17 00:00:00 2001 From: slioch Date: Wed, 3 Jun 2009 10:40:35 -0700 Subject: added support for first and last sibling environment variable: "ENV_SIBLING_POSITION". This value will either be "FIRST" or "LAST" or undefined. "FIRST" means that the sibling is the first in the list of a common parent, provided that the sibling resides in the same priority group "LAST" means that the sibling is the last in the list of a common parent, provided that the sibling resides in the same priority group --- src/commit2.c | 11 +++++++++++ src/common/defs.h | 2 ++ 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index 70e0e99..6229221 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -377,6 +377,16 @@ process_func(GNode *node, gpointer data) set_in_delete_action(TRUE); } + //do last sibling check + GNode *n = g_node_last_sibling(node); + if (n == node) { + setenv(ENV_SIBLING_POSITION,"LAST",1); + } + n = g_node_first_sibling(node); + if (n == node) { + setenv(ENV_SIBLING_POSITION,"FIRST",1); + } + //do not set for promoted actions if (!IS_ACTIVE(d->_operation)) { if (IS_DELETE(d->_operation)) { @@ -408,6 +418,7 @@ process_func(GNode *node, gpointer data) } unsetenv(ENV_ACTION_NAME); + unsetenv(ENV_SIBLING_POSITION); if (g_coverage) { struct timeval t; diff --git a/src/common/defs.h b/src/common/defs.h index 5e110bc..f8171e4 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -15,6 +15,8 @@ #define ENV_ACTION_DELETE "DELETE" #define ENV_ACTION_SET "SET" #define ENV_ACTION_ACTIVE "ACTIVE" +#define ENV_SIBLING_POSITION "COMMIT_SIBLING_POSITION" + struct Result { -- cgit v1.2.3