Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
63460fe4
Commit
63460fe4
authored
Oct 11, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: deprecate git_reference_is_valid_name
parent
b52bb4d4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
28 deletions
+36
-28
include/git2/deprecated.h
+21
-3
include/git2/refs.h
+0
-16
src/refs.c
+15
-9
No files found.
include/git2/deprecated.h
View file @
63460fe4
...
...
@@ -340,10 +340,11 @@ GIT_EXTERN(size_t) git_object__size(git_object_t type);
/**@}*/
/** @name Deprecated Reference Constants
/** @name Deprecated Reference
Functions and
Constants
*
* These enumeration values are retained for backward compatibility. The
* newer versions of these values should be preferred in all new code.
* These functions and enumeration values are retained for backward
* compatibility. The newer versions of these values should be
* preferred in all new code.
*
* There is no plan to remove these backward compatibility values at
* this time.
...
...
@@ -364,6 +365,23 @@ GIT_EXTERN(size_t) git_object__size(git_object_t type);
#define GIT_REF_FORMAT_REFSPEC_PATTERN GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
#define GIT_REF_FORMAT_REFSPEC_SHORTHAND GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND
/**
* Ensure the reference name is well-formed.
*
* Valid reference names must follow one of two patterns:
*
* 1. Top-level names must contain only capital letters and underscores,
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
* sequences ".." and "@{" which have special meaning to revparse.
*
* @deprecated Use git_reference_name_is_valid
* @param refname name to be checked.
* @return 1 if the reference name is acceptable; 0 if it isn't
*/
GIT_EXTERN
(
int
)
git_reference_is_valid_name
(
const
char
*
refname
);
GIT_EXTERN
(
int
)
git_tag_create_frombuffer
(
git_oid
*
oid
,
git_repository
*
repo
,
...
...
include/git2/refs.h
View file @
63460fe4
...
...
@@ -750,22 +750,6 @@ GIT_EXTERN(int) git_reference_peel(
GIT_EXTERN
(
int
)
git_reference_name_is_valid
(
int
*
valid
,
const
char
*
refname
);
/**
* Ensure the reference name is well-formed.
*
* Valid reference names must follow one of two patterns:
*
* 1. Top-level names must contain only capital letters and underscores,
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
* sequences ".." and "@{" which have special meaning to revparse.
*
* @param refname name to be checked.
* @return 1 if the reference name is acceptable; 0 if it isn't
*/
GIT_EXTERN
(
int
)
git_reference_is_valid_name
(
const
char
*
refname
);
/**
* Get the reference's short name
*
* This will transform the reference name into a name "human-readable"
...
...
src/refs.c
View file @
63460fe4
...
...
@@ -1314,15 +1314,6 @@ int git_reference_name_is_valid(int *valid, const char *refname)
return
git_reference__name_is_valid
(
valid
,
refname
,
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
);
}
int
git_reference_is_valid_name
(
const
char
*
refname
)
{
int
valid
=
0
;
git_reference__name_is_valid
(
&
valid
,
refname
,
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
);
return
valid
;
}
const
char
*
git_reference__shorthand
(
const
char
*
name
)
{
if
(
!
git__prefixcmp
(
name
,
GIT_REFS_HEADS_DIR
))
...
...
@@ -1366,3 +1357,18 @@ int git_reference__is_unborn_head(bool *unborn, const git_reference *ref, git_re
return
0
;
}
/* Deprecated functions */
#ifndef GIT_DEPRECATE_HARD
int
git_reference_is_valid_name
(
const
char
*
refname
)
{
int
valid
=
0
;
git_reference__name_is_valid
(
&
valid
,
refname
,
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL
);
return
valid
;
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment