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
a01d3a0b
Commit
a01d3a0b
authored
Apr 08, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3033 from pks-t/describe-oid-fallback
Fix describe without refs and OID fallbacks
parents
47f37400
08e1fd65
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
2 deletions
+9
-2
examples/.gitignore
+1
-0
examples/Makefile
+1
-0
src/describe.c
+1
-1
tests/describe/describe.c
+6
-1
No files found.
examples/.gitignore
View file @
a01d3a0b
...
...
@@ -11,4 +11,5 @@ remote
status
tag
for-each-ref
describe
*.dSYM
examples/Makefile
View file @
a01d3a0b
...
...
@@ -5,6 +5,7 @@ CFLAGS = -g -I../include -I../src -Wall -Wextra -Wmissing-prototypes -Wno-missin
LFLAGS
=
-L
../build
-lgit2
-lz
APPS
=
general showindex diff rev-list cat-file status log rev-parse init blame tag remote
APPS
+=
for
-each-ref
APPS
+=
describe
all
:
$(APPS)
...
...
src/describe.c
View file @
a01d3a0b
...
...
@@ -693,7 +693,7 @@ int git_describe_commit(
get_name
,
&
data
))
<
0
)
goto
cleanup
;
if
(
git_oidmap_size
(
data
.
names
)
==
0
)
{
if
(
git_oidmap_size
(
data
.
names
)
==
0
&&
!
opts
->
show_commit_oid_as_fallback
)
{
giterr_set
(
GITERR_DESCRIBE
,
"Cannot describe - "
"No reference found, cannot describe anything."
);
error
=
-
1
;
...
...
tests/describe/describe.c
View file @
a01d3a0b
...
...
@@ -28,7 +28,7 @@ static int delete_cb(git_reference *ref, void *payload)
return
0
;
}
void
test_describe_describe__
cannot_describe_against_a_repo_with_no_ref
(
void
)
void
test_describe_describe__
describe_a_repo_with_no_refs
(
void
)
{
git_repository
*
repo
;
git_describe_options
opts
=
GIT_DESCRIBE_OPTIONS_INIT
;
...
...
@@ -41,8 +41,13 @@ void test_describe_describe__cannot_describe_against_a_repo_with_no_ref(void)
cl_git_pass
(
git_reference_foreach
(
repo
,
delete_cb
,
NULL
));
/* Impossible to describe without falling back to OIDs */
cl_git_fail
(
git_describe_commit
(
&
result
,
object
,
&
opts
));
/* Try again with OID fallbacks */
opts
.
show_commit_oid_as_fallback
=
1
;
cl_git_pass
(
git_describe_commit
(
&
result
,
object
,
&
opts
));
git_describe_result_free
(
result
);
git_object_free
(
object
);
git_buf_free
(
&
buf
);
...
...
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