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
5f4d2f9f
Commit
5f4d2f9f
authored
Jul 31, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkout: fix problem with detached HEAD.
parent
5280f4e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
src/checkout.c
+2
-5
tests-clar/checkout/checkout.c
+5
-0
No files found.
src/checkout.c
View file @
5f4d2f9f
...
@@ -216,15 +216,12 @@ int git_checkout_reference(git_reference *ref,
...
@@ -216,15 +216,12 @@ int git_checkout_reference(git_reference *ref,
git_reference
*
head
=
NULL
;
git_reference
*
head
=
NULL
;
int
retcode
=
GIT_ERROR
;
int
retcode
=
GIT_ERROR
;
if
((
retcode
=
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
))
<
0
)
if
((
retcode
=
git_reference_create_symbolic
(
&
head
,
repo
,
GIT_HEAD_FILE
,
git_reference_name
(
ref
),
true
))
<
0
)
return
retcode
;
return
retcode
;
if
((
retcode
=
git_reference_set_target
(
head
,
git_reference_name
(
ref
)))
<
0
)
goto
gcr_cleanup
;
retcode
=
git_checkout_head
(
git_reference_owner
(
ref
),
opts
,
stats
);
retcode
=
git_checkout_head
(
git_reference_owner
(
ref
),
opts
,
stats
);
gcr_cleanup:
git_reference_free
(
head
);
git_reference_free
(
head
);
return
retcode
;
return
retcode
;
}
}
...
...
tests-clar/checkout/checkout.c
View file @
5f4d2f9f
...
@@ -177,3 +177,8 @@ void test_checkout_checkout__open_flags(void)
...
@@ -177,3 +177,8 @@ void test_checkout_checkout__open_flags(void)
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
,
NULL
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
,
NULL
));
test_file_contents
(
"./testrepo/new.txt"
,
"hi
\n
my new file
\n
"
);
test_file_contents
(
"./testrepo/new.txt"
,
"hi
\n
my new file
\n
"
);
}
}
void
test_checkout_checkout__detached_head
(
void
)
{
/* TODO: write this when git_checkout_commit is implemented. */
}
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