Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:38

0001 /*
0002  * Copyright (C) the libgit2 contributors. All rights reserved.
0003  *
0004  * This file is part of libgit2, distributed under the GNU GPL v2 with
0005  * a Linking Exception. For full terms see the included COPYING file.
0006  */
0007 #ifndef INCLUDE_git_refspec_h__
0008 #define INCLUDE_git_refspec_h__
0009 
0010 #include "common.h"
0011 #include "types.h"
0012 #include "net.h"
0013 #include "buffer.h"
0014 
0015 /**
0016  * @file git2/refspec.h
0017  * @brief Git refspec attributes
0018  * @defgroup git_refspec Git refspec attributes
0019  * @ingroup Git
0020  * @{
0021  */
0022 GIT_BEGIN_DECL
0023 
0024 /**
0025  * Parse a given refspec string
0026  *
0027  * @param refspec a pointer to hold the refspec handle
0028  * @param input the refspec string
0029  * @param is_fetch is this a refspec for a fetch
0030  * @return 0 if the refspec string could be parsed, -1 otherwise
0031  */
0032 GIT_EXTERN(int) git_refspec_parse(git_refspec **refspec, const char *input, int is_fetch);
0033 
0034 /**
0035  * Free a refspec object which has been created by git_refspec_parse
0036  *
0037  * @param refspec the refspec object
0038  */
0039 GIT_EXTERN(void) git_refspec_free(git_refspec *refspec);
0040 
0041 /**
0042  * Get the source specifier
0043  *
0044  * @param refspec the refspec
0045  * @return the refspec's source specifier
0046  */
0047 GIT_EXTERN(const char *) git_refspec_src(const git_refspec *refspec);
0048 
0049 /**
0050  * Get the destination specifier
0051  *
0052  * @param refspec the refspec
0053  * @return the refspec's destination specifier
0054  */
0055 GIT_EXTERN(const char *) git_refspec_dst(const git_refspec *refspec);
0056 
0057 /**
0058  * Get the refspec's string
0059  *
0060  * @param refspec the refspec
0061  * @returns the refspec's original string
0062  */
0063 GIT_EXTERN(const char *) git_refspec_string(const git_refspec *refspec);
0064 
0065 /**
0066  * Get the force update setting
0067  *
0068  * @param refspec the refspec
0069  * @return 1 if force update has been set, 0 otherwise
0070  */
0071 GIT_EXTERN(int) git_refspec_force(const git_refspec *refspec);
0072 
0073 /**
0074  * Get the refspec's direction.
0075  *
0076  * @param spec refspec
0077  * @return GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH
0078  */
0079 GIT_EXTERN(git_direction) git_refspec_direction(const git_refspec *spec);
0080 
0081 /**
0082  * Check if a refspec's source descriptor matches a reference 
0083  *
0084  * @param refspec the refspec
0085  * @param refname the name of the reference to check
0086  * @return 1 if the refspec matches, 0 otherwise
0087  */
0088 GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *refname);
0089 
0090 /**
0091  * Check if a refspec's destination descriptor matches a reference
0092  *
0093  * @param refspec the refspec
0094  * @param refname the name of the reference to check
0095  * @return 1 if the refspec matches, 0 otherwise
0096  */
0097 GIT_EXTERN(int) git_refspec_dst_matches(const git_refspec *refspec, const char *refname);
0098 
0099 /**
0100  * Transform a reference to its target following the refspec's rules
0101  *
0102  * @param out where to store the target name
0103  * @param spec the refspec
0104  * @param name the name of the reference to transform
0105  * @return 0, GIT_EBUFS or another error
0106  */
0107 GIT_EXTERN(int) git_refspec_transform(git_buf *out, const git_refspec *spec, const char *name);
0108 
0109 /**
0110  * Transform a target reference to its source reference following the refspec's rules
0111  *
0112  * @param out where to store the source reference name
0113  * @param spec the refspec
0114  * @param name the name of the reference to transform
0115  * @return 0, GIT_EBUFS or another error
0116  */
0117 GIT_EXTERN(int) git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name);
0118 
0119 GIT_END_DECL
0120 
0121 #endif