Back to home page

EIC code displayed by LXR

 
 

    


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

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_errors_h__
0008 #define INCLUDE_git_errors_h__
0009 
0010 #include "common.h"
0011 
0012 /**
0013  * @file git2/errors.h
0014  * @brief Git error handling routines and variables
0015  * @ingroup Git
0016  * @{
0017  */
0018 GIT_BEGIN_DECL
0019 
0020 /** Generic return codes */
0021 typedef enum {
0022     GIT_OK              =  0,       /**< No error */
0023 
0024     GIT_ERROR           = -1,       /**< Generic error */
0025     GIT_ENOTFOUND       = -3,       /**< Requested object could not be found */
0026     GIT_EEXISTS         = -4,       /**< Object exists preventing operation */
0027     GIT_EAMBIGUOUS      = -5,       /**< More than one object matches */
0028     GIT_EBUFS           = -6,       /**< Output buffer too short to hold data */
0029 
0030     /**
0031      * GIT_EUSER is a special error that is never generated by libgit2
0032      * code.  You can return it from a callback (e.g to stop an iteration)
0033      * to know that it was generated by the callback and not by libgit2.
0034      */
0035     GIT_EUSER           = -7,
0036 
0037     GIT_EBAREREPO       =  -8,  /**< Operation not allowed on bare repository */
0038     GIT_EUNBORNBRANCH   =  -9,  /**< HEAD refers to branch with no commits */
0039     GIT_EUNMERGED       = -10,  /**< Merge in progress prevented operation */
0040     GIT_ENONFASTFORWARD = -11,  /**< Reference was not fast-forwardable */
0041     GIT_EINVALIDSPEC    = -12,  /**< Name/ref spec was not in a valid format */
0042     GIT_ECONFLICT       = -13,  /**< Checkout conflicts prevented operation */
0043     GIT_ELOCKED         = -14,  /**< Lock file prevented operation */
0044     GIT_EMODIFIED       = -15,  /**< Reference value does not match expected */
0045     GIT_EAUTH           = -16,  /**< Authentication error */
0046     GIT_ECERTIFICATE    = -17,  /**< Server certificate is invalid */
0047     GIT_EAPPLIED        = -18,  /**< Patch/merge has already been applied */
0048     GIT_EPEEL           = -19,  /**< The requested peel operation is not possible */
0049     GIT_EEOF            = -20,  /**< Unexpected EOF */
0050     GIT_EINVALID        = -21,  /**< Invalid operation or input */
0051     GIT_EUNCOMMITTED    = -22,  /**< Uncommitted changes in index prevented operation */
0052     GIT_EDIRECTORY      = -23,  /**< The operation is not valid for a directory */
0053     GIT_EMERGECONFLICT  = -24,  /**< A merge conflict exists and cannot continue */
0054 
0055     GIT_PASSTHROUGH     = -30,  /**< A user-configured callback refused to act */
0056     GIT_ITEROVER        = -31,  /**< Signals end of iteration with iterator */
0057     GIT_RETRY           = -32,  /**< Internal only */
0058     GIT_EMISMATCH       = -33,  /**< Hashsum mismatch in object */
0059     GIT_EINDEXDIRTY     = -34,  /**< Unsaved changes in the index would be overwritten */
0060     GIT_EAPPLYFAIL      = -35,  /**< Patch application failed */
0061     GIT_EOWNER          = -36,  /**< The object is not owned by the current user */
0062     GIT_TIMEOUT         = -37,  /**< The operation timed out */
0063     GIT_EUNCHANGED      = -38,  /**< There were no changes */
0064     GIT_ENOTSUPPORTED   = -39,  /**< An option is not supported */
0065     GIT_EREADONLY       = -40   /**< The subject is read-only */
0066 } git_error_code;
0067 
0068 /**
0069  * Structure to store extra details of the last error that occurred.
0070  *
0071  * This is kept on a per-thread basis if GIT_THREADS was defined when the
0072  * library was build, otherwise one is kept globally for the library
0073  */
0074 typedef struct {
0075     char *message;
0076     int klass;
0077 } git_error;
0078 
0079 /** Error classes */
0080 typedef enum {
0081     GIT_ERROR_NONE = 0,
0082     GIT_ERROR_NOMEMORY,
0083     GIT_ERROR_OS,
0084     GIT_ERROR_INVALID,
0085     GIT_ERROR_REFERENCE,
0086     GIT_ERROR_ZLIB,
0087     GIT_ERROR_REPOSITORY,
0088     GIT_ERROR_CONFIG,
0089     GIT_ERROR_REGEX,
0090     GIT_ERROR_ODB,
0091     GIT_ERROR_INDEX,
0092     GIT_ERROR_OBJECT,
0093     GIT_ERROR_NET,
0094     GIT_ERROR_TAG,
0095     GIT_ERROR_TREE,
0096     GIT_ERROR_INDEXER,
0097     GIT_ERROR_SSL,
0098     GIT_ERROR_SUBMODULE,
0099     GIT_ERROR_THREAD,
0100     GIT_ERROR_STASH,
0101     GIT_ERROR_CHECKOUT,
0102     GIT_ERROR_FETCHHEAD,
0103     GIT_ERROR_MERGE,
0104     GIT_ERROR_SSH,
0105     GIT_ERROR_FILTER,
0106     GIT_ERROR_REVERT,
0107     GIT_ERROR_CALLBACK,
0108     GIT_ERROR_CHERRYPICK,
0109     GIT_ERROR_DESCRIBE,
0110     GIT_ERROR_REBASE,
0111     GIT_ERROR_FILESYSTEM,
0112     GIT_ERROR_PATCH,
0113     GIT_ERROR_WORKTREE,
0114     GIT_ERROR_SHA,
0115     GIT_ERROR_HTTP,
0116     GIT_ERROR_INTERNAL,
0117     GIT_ERROR_GRAFTS
0118 } git_error_t;
0119 
0120 /**
0121  * Return the last `git_error` object that was generated for the
0122  * current thread.
0123  *
0124  * This function will never return NULL.
0125  *
0126  * Callers should not rely on this to determine whether an error has
0127  * occurred. For error checking, callers should examine the return
0128  * codes of libgit2 functions.
0129  *
0130  * This call can only reliably report error messages when an error
0131  * has occurred. (It may contain stale information if it is called
0132  * after a different function that succeeds.)
0133  *
0134  * The memory for this object is managed by libgit2. It should not
0135  * be freed.
0136  *
0137  * @return A git_error object.
0138  */
0139 GIT_EXTERN(const git_error *) git_error_last(void);
0140 
0141 /** @} */
0142 GIT_END_DECL
0143 #endif