

/**
 *
 * @file sg_wc_tx__queue__add.c
 *
 * @details Manipulate the LVI/LVD caches to effect an ADD.
 * This is part of the QUEUE phase of the TX where we accumulate
 * the changes and look for problems.
 *
 */

//////////////////////////////////////////////////////////////////

#include <sg.h>

#include "sg_wc__public_typedefs.h"
#include "sg_wc__public_prototypes.h"
#include "sg_wc__private.h"

//////////////////////////////////////////////////////////////////

/**
 * QUEUE an ADD operation.
 *
 * I decided to let this __queue__ api NOT take
 * a repo-path as an argument and let it compute
 * it from the cache.  This saves the caller from
 * having to do pathname juggling in the middle of
 * the recursive ADD code.
 * 
 */
void sg_wc_tx__queue__add(SG_context * pCtx,
						  SG_wc_tx * pWcTx,
						  sg_wc_liveview_item * pLVI)
{
	SG_string * pStringRepoPath = NULL;

	SG_ERR_CHECK(  sg_wc_liveview_item__alter_structure__add(pCtx, pLVI)  );
	SG_ERR_CHECK(  sg_wc_tx__liveview__compute_live_repo_path(pCtx, pWcTx, pLVI, &pStringRepoPath)  );
	SG_ERR_CHECK(  sg_wc_tx__journal__add(pCtx, pWcTx, pLVI->pPcRow_PC, pStringRepoPath)  );

fail:
	SG_STRING_NULLFREE(pCtx, pStringRepoPath);
}
