refspec: add direction accessor

This commit is contained in:
Carlos Martín Nieto 2013-04-30 10:55:17 +02:00
parent 4157851076
commit 8d39f2a790
2 changed files with 15 additions and 0 deletions

View File

@ -51,6 +51,14 @@ GIT_EXTERN(const char *) git_refspec_string(const git_refspec *refspec);
*/
GIT_EXTERN(int) git_refspec_force(const git_refspec *refspec);
/**
* Get the refspec's direction.
*
* @param the refspec
* @return GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
*/
GIT_EXTERN(git_direction) git_refspec_direction(const git_refspec *spec);
/**
* Check if a refspec's source descriptor matches a reference
*

View File

@ -274,3 +274,10 @@ int git_refspec_is_wildcard(const git_refspec *spec)
return (spec->src[strlen(spec->src) - 1] == '*');
}
git_direction git_refspec_direction(const git_refspec *spec)
{
assert(spec);
return spec->push;
}