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
efc9e670
Commit
efc9e670
authored
Sep 17, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1856 from libgit2/cmn/no-orphans
No such thing as an orphan branch
parents
38fba837
605da51a
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
59 additions
and
59 deletions
+59
-59
examples/status.c
+1
-1
include/git2/checkout.h
+1
-1
include/git2/errors.h
+1
-1
include/git2/repository.h
+6
-6
src/branch.c
+1
-1
src/checkout.c
+1
-1
src/clone.c
+1
-1
src/remote.c
+1
-1
src/repository.c
+3
-3
src/stash.c
+1
-1
src/status.c
+1
-1
src/submodule.c
+1
-1
tests-clar/checkout/head.c
+3
-3
tests-clar/clone/empty.c
+2
-2
tests-clar/clone/nonetwork.c
+1
-1
tests-clar/online/clone.c
+1
-1
tests-clar/refs/branches/delete.c
+2
-2
tests-clar/refs/branches/ishead.c
+2
-2
tests-clar/repo/head.c
+13
-13
tests-clar/repo/headtree.c
+4
-4
tests-clar/repo/repo_helpers.c
+1
-1
tests-clar/repo/repo_helpers.h
+1
-1
tests-clar/reset/soft.c
+4
-4
tests-clar/stash/save.c
+1
-1
tests-clar/submodule/lookup.c
+5
-5
No files found.
examples/status.c
View file @
efc9e670
...
...
@@ -71,7 +71,7 @@ static void show_branch(git_repository *repo, int format)
error
=
git_repository_head
(
&
head
,
repo
);
if
(
error
==
GIT_E
ORPHANEDHEAD
||
error
==
GIT_ENOTFOUND
)
if
(
error
==
GIT_E
UNBORNBRANCH
||
error
==
GIT_ENOTFOUND
)
branch
=
NULL
;
else
if
(
!
error
)
{
branch
=
git_reference_name
(
head
);
...
...
include/git2/checkout.h
View file @
efc9e670
...
...
@@ -249,7 +249,7 @@ typedef struct git_checkout_opts {
*
* @param repo repository to check out (must be non-bare)
* @param opts specifies checkout options (may be NULL)
* @return 0 on success, GIT_E
ORPHANEDHEAD
when HEAD points to a non existing
* @return 0 on success, GIT_E
UNBORNBRANCH
when HEAD points to a non existing
* branch, GIT_ERROR otherwise (use giterr_last for information
* about the error)
*/
...
...
include/git2/errors.h
View file @
efc9e670
...
...
@@ -27,7 +27,7 @@ typedef enum {
GIT_EBUFS
=
-
6
,
GIT_EUSER
=
-
7
,
GIT_EBAREREPO
=
-
8
,
GIT_E
ORPHANEDHEAD
=
-
9
,
GIT_E
UNBORNBRANCH
=
-
9
,
GIT_EUNMERGED
=
-
10
,
GIT_ENONFASTFORWARD
=
-
11
,
GIT_EINVALIDSPEC
=
-
12
,
...
...
include/git2/repository.h
View file @
efc9e670
...
...
@@ -297,7 +297,7 @@ GIT_EXTERN(int) git_repository_init_ext(
* @param out pointer to the reference which will be retrieved
* @param repo a repository object
*
* @return 0 on success, GIT_E
ORPHANEDHEAD
when HEAD points to a non existing
* @return 0 on success, GIT_E
UNBORNBRANCH
when HEAD points to a non existing
* branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
*/
GIT_EXTERN
(
int
)
git_repository_head
(
git_reference
**
out
,
git_repository
*
repo
);
...
...
@@ -315,16 +315,16 @@ GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
GIT_EXTERN
(
int
)
git_repository_head_detached
(
git_repository
*
repo
);
/**
* Check if the current branch is
an orpha
n
* Check if the current branch is
unbor
n
*
* An
orpha
n branch is one named from HEAD but which doesn't exist in
* An
unbor
n branch is one named from HEAD but which doesn't exist in
* the refs namespace, because it doesn't have any commit to point to.
*
* @param repo Repo to test
* @return 1 if the current branch is
an orpha
n, 0 if it's not; error
* @return 1 if the current branch is
unbor
n, 0 if it's not; error
* code if there was an error
*/
GIT_EXTERN
(
int
)
git_repository_head_
orpha
n
(
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_repository_head_
unbor
n
(
git_repository
*
repo
);
/**
* Check if a repository is empty
...
...
@@ -611,7 +611,7 @@ GIT_EXTERN(int) git_repository_set_head_detached(
* Otherwise, the HEAD will be detached and point to the peeled Commit.
*
* @param repo Repository pointer
* @return 0 on success, GIT_E
ORPHANEDHEAD
when HEAD points to a non existing
* @return 0 on success, GIT_E
UNBORNBRANCH
when HEAD points to a non existing
* branch or an error code
*/
GIT_EXTERN
(
int
)
git_repository_detach_head
(
...
...
src/branch.c
View file @
efc9e670
...
...
@@ -585,7 +585,7 @@ int git_branch_is_head(
error
=
git_repository_head
(
&
head
,
git_reference_owner
(
branch
));
if
(
error
==
GIT_E
ORPHANEDHEAD
||
error
==
GIT_ENOTFOUND
)
if
(
error
==
GIT_E
UNBORNBRANCH
||
error
==
GIT_ENOTFOUND
)
return
false
;
if
(
error
<
0
)
...
...
src/checkout.c
View file @
efc9e670
...
...
@@ -1232,7 +1232,7 @@ static int checkout_data_init(
error
=
checkout_lookup_head_tree
(
&
data
->
opts
.
baseline
,
repo
);
if
(
error
==
GIT_E
ORPHANEDHEAD
)
{
if
(
error
==
GIT_E
UNBORNBRANCH
)
{
error
=
0
;
giterr_clear
();
}
...
...
src/clone.c
View file @
efc9e670
...
...
@@ -415,7 +415,7 @@ static bool should_checkout(
if
(
opts
->
checkout_strategy
==
GIT_CHECKOUT_NONE
)
return
false
;
return
!
git_repository_head_
orpha
n
(
repo
);
return
!
git_repository_head_
unbor
n
(
repo
);
}
static
void
normalize_options
(
git_clone_options
*
dst
,
const
git_clone_options
*
src
,
git_repository_init_options
*
initOptions
)
...
...
src/remote.c
View file @
efc9e670
...
...
@@ -806,7 +806,7 @@ static int remote_head_for_ref(git_remote_head **out, git_refspec *spec, git_vec
(
!
git_reference_is_branch
(
resolved_ref
))
||
(
error
=
git_branch_upstream
(
&
tracking_ref
,
resolved_ref
))
<
0
||
(
error
=
git_refspec_transform_l
(
&
remote_name
,
spec
,
git_reference_name
(
tracking_ref
)))
<
0
)
{
/* Not an error if HEAD is
orphaned
or no tracking branch */
/* Not an error if HEAD is
unborn
or no tracking branch */
if
(
error
==
GIT_ENOTFOUND
)
error
=
0
;
...
...
src/repository.c
View file @
efc9e670
...
...
@@ -1451,10 +1451,10 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
error
=
git_reference_lookup_resolved
(
head_out
,
repo
,
git_reference_symbolic_target
(
head
),
-
1
);
git_reference_free
(
head
);
return
error
==
GIT_ENOTFOUND
?
GIT_E
ORPHANEDHEAD
:
error
;
return
error
==
GIT_ENOTFOUND
?
GIT_E
UNBORNBRANCH
:
error
;
}
int
git_repository_head_
orpha
n
(
git_repository
*
repo
)
int
git_repository_head_
unbor
n
(
git_repository
*
repo
)
{
git_reference
*
ref
=
NULL
;
int
error
;
...
...
@@ -1462,7 +1462,7 @@ int git_repository_head_orphan(git_repository *repo)
error
=
git_repository_head
(
&
ref
,
repo
);
git_reference_free
(
ref
);
if
(
error
==
GIT_E
ORPHANEDHEAD
)
if
(
error
==
GIT_E
UNBORNBRANCH
)
return
1
;
if
(
error
<
0
)
...
...
src/stash.c
View file @
efc9e670
...
...
@@ -27,7 +27,7 @@ static int retrieve_head(git_reference **out, git_repository *repo)
{
int
error
=
git_repository_head
(
out
,
repo
);
if
(
error
==
GIT_E
ORPHANEDHEAD
)
if
(
error
==
GIT_E
UNBORNBRANCH
)
return
create_error
(
error
,
"You do not have the initial commit yet."
);
return
error
;
...
...
src/status.c
View file @
efc9e670
...
...
@@ -252,7 +252,7 @@ int git_status_list_new(
/* if there is no HEAD, that's okay - we'll make an empty iterator */
if
(((
error
=
git_repository_head_tree
(
&
head
,
repo
))
<
0
)
&&
error
!=
GIT_ENOTFOUND
&&
error
!=
GIT_E
ORPHANEDHEAD
)
{
error
!=
GIT_ENOTFOUND
&&
error
!=
GIT_E
UNBORNBRANCH
)
{
git_index_free
(
index
);
/* release index */
return
error
;
}
...
...
src/submodule.c
View file @
efc9e670
...
...
@@ -1557,7 +1557,7 @@ static void submodule_get_wd_status(
if
(
ign
==
GIT_SUBMODULE_IGNORE_NONE
)
opt
.
flags
|=
GIT_DIFF_INCLUDE_UNTRACKED
;
/* if we don't have an
orphaned
head, check diff with index */
/* if we don't have an
unborn
head, check diff with index */
if
(
git_repository_head_tree
(
&
sm_head
,
sm_repo
)
<
0
)
giterr_clear
();
else
{
...
...
tests-clar/checkout/head.c
View file @
efc9e670
...
...
@@ -16,11 +16,11 @@ void test_checkout_head__cleanup(void)
cl_git_sandbox_cleanup
();
}
void
test_checkout_head__
orphaned_head_returns_GIT_EORPHANEDHEAD
(
void
)
void
test_checkout_head__
unborn_head_returns_GIT_EUNBORNBRANCH
(
void
)
{
make_head_
orphaned
(
g_repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
g_repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
git_checkout_head
(
g_repo
,
NULL
));
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_checkout_head
(
g_repo
,
NULL
));
}
void
test_checkout_head__with_index_only_tree
(
void
)
...
...
tests-clar/clone/empty.c
View file @
efc9e670
...
...
@@ -44,7 +44,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
g_options
.
bare
=
true
;
cl_git_pass
(
git_clone
(
&
g_repo_cloned
,
"./empty_bare.git"
,
"./empty"
,
&
g_options
));
/* Although the HEAD is
orphaned
... */
/* Although the HEAD is
unborn
... */
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_reference_lookup
(
&
ref
,
g_repo_cloned
,
local_name
));
/* ...one can still retrieve the name of the remote tracking reference */
...
...
@@ -59,7 +59,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
cl_assert_equal_s
(
expected_remote_name
,
buffer
);
/* ...even when the remote HEAD is
orphaned
as well */
/* ...even when the remote HEAD is
unborn
as well */
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_reference_lookup
(
&
ref
,
g_repo_cloned
,
expected_tracked_branch_name
));
}
...
...
tests-clar/clone/nonetwork.c
View file @
efc9e670
...
...
@@ -228,7 +228,7 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
g_options
.
checkout_branch
=
"test"
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_assert_equal_i
(
0
,
git_repository_head_
orpha
n
(
g_repo
));
cl_assert_equal_i
(
0
,
git_repository_head_
unbor
n
(
g_repo
));
cl_git_pass
(
git_repository_head
(
&
g_ref
,
g_repo
));
cl_assert_equal_s
(
git_reference_name
(
g_ref
),
"refs/heads/test"
);
...
...
tests-clar/online/clone.c
View file @
efc9e670
...
...
@@ -69,7 +69,7 @@ void test_online_clone__empty_repository(void)
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_EMPTYREPO_URL
,
"./foo"
,
&
g_options
));
cl_assert_equal_i
(
true
,
git_repository_is_empty
(
g_repo
));
cl_assert_equal_i
(
true
,
git_repository_head_
orpha
n
(
g_repo
));
cl_assert_equal_i
(
true
,
git_repository_head_
unbor
n
(
g_repo
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
GIT_HEAD_FILE
));
cl_assert_equal_i
(
GIT_REF_SYMBOLIC
,
git_reference_type
(
head
));
...
...
tests-clar/refs/branches/delete.c
View file @
efc9e670
...
...
@@ -57,11 +57,11 @@ void test_refs_branches_delete__can_delete_a_branch_even_if_HEAD_is_missing(void
git_reference_free
(
branch
);
}
void
test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_
orphaned
(
void
)
void
test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_
unborn
(
void
)
{
git_reference
*
branch
;
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_git_pass
(
git_branch_lookup
(
&
branch
,
repo
,
"br2"
,
GIT_BRANCH_LOCAL
));
cl_git_pass
(
git_branch_delete
(
branch
));
...
...
tests-clar/refs/branches/ishead.c
View file @
efc9e670
...
...
@@ -26,13 +26,13 @@ void test_refs_branches_ishead__can_tell_if_a_branch_is_pointed_at_by_HEAD(void)
cl_assert_equal_i
(
true
,
git_branch_is_head
(
branch
));
}
void
test_refs_branches_ishead__can_properly_handle_
orphaned
_HEAD
(
void
)
void
test_refs_branches_ishead__can_properly_handle_
unborn
_HEAD
(
void
)
{
git_repository_free
(
repo
);
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/master"
));
...
...
tests-clar/repo/head.c
View file @
efc9e670
...
...
@@ -32,20 +32,20 @@ void test_repo_head__head_detached(void)
cl_assert_equal_i
(
false
,
git_repository_head_detached
(
repo
));
}
void
test_repo_head__
head_orphan
(
void
)
void
test_repo_head__
unborn_head
(
void
)
{
git_reference
*
ref
;
cl_git_pass
(
git_repository_head_detached
(
repo
));
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert
(
git_repository_head_
orpha
n
(
repo
)
==
1
);
cl_assert
(
git_repository_head_
unbor
n
(
repo
)
==
1
);
/* take the repo back to it's original state */
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_assert
(
git_repository_head_
orpha
n
(
repo
)
==
0
);
cl_assert
(
git_repository_head_
unbor
n
(
repo
)
==
0
);
git_reference_free
(
ref
);
}
...
...
@@ -58,7 +58,7 @@ void test_repo_head__set_head_Attaches_HEAD_to_un_unborn_branch_when_the_branch_
cl_assert_equal_i
(
false
,
git_repository_head_detached
(
repo
));
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
git_repository_head
(
&
head
,
repo
));
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_repository_head
(
&
head
,
repo
));
}
void
test_repo_head__set_head_Returns_ENOTFOUND_when_the_reference_doesnt_exist
(
void
)
...
...
@@ -163,20 +163,20 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
git_reference_free
(
head
);
}
void
test_repo_head__detaching_an_
orphaned_head_returns_GIT_EORPHANEDHEAD
(
void
)
void
test_repo_head__detaching_an_
unborn_branch_returns_GIT_EUNBORNBRANCH
(
void
)
{
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
git_repository_detach_head
(
repo
));
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_repository_detach_head
(
repo
));
}
void
test_repo_head__retrieving_an_
orphaned_head_returns_GIT_EORPHANEDHEAD
(
void
)
void
test_repo_head__retrieving_an_
unborn_branch_returns_GIT_EUNBORNBRANCH
(
void
)
{
git_reference
*
head
;
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
git_repository_head
(
&
head
,
repo
));
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_repository_head
(
&
head
,
repo
));
}
void
test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND
(
void
)
...
...
@@ -188,9 +188,9 @@ void test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND(void)
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_repository_head
(
&
head
,
repo
));
}
void
test_repo_head__can_tell_if_an_
orphaned
_head_is_detached
(
void
)
void
test_repo_head__can_tell_if_an_
unborn
_head_is_detached
(
void
)
{
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
false
,
git_repository_head_detached
(
repo
));
}
tests-clar/repo/headtree.c
View file @
efc9e670
...
...
@@ -36,13 +36,13 @@ void test_repo_headtree__can_retrieve_the_root_tree_from_a_non_detached_head(voi
cl_assert
(
git_oid_streq
(
git_tree_id
(
tree
),
"az"
));
}
void
test_repo_headtree__when_head_is_
orphaned_returns_EORPHANEDHEAD
(
void
)
void
test_repo_headtree__when_head_is_
unborn_returns_EUNBORNBRANCH
(
void
)
{
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
true
,
git_repository_head_
orpha
n
(
repo
));
cl_assert_equal_i
(
true
,
git_repository_head_
unbor
n
(
repo
));
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
git_repository_head_tree
(
&
tree
,
repo
));
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_repository_head_tree
(
&
tree
,
repo
));
}
void
test_repo_headtree__when_head_is_missing_returns_ENOTFOUND
(
void
)
...
...
tests-clar/repo/repo_helpers.c
View file @
efc9e670
...
...
@@ -3,7 +3,7 @@
#include "repo_helpers.h"
#include "posix.h"
void
make_head_
orphaned
(
git_repository
*
repo
,
const
char
*
target
)
void
make_head_
unborn
(
git_repository
*
repo
,
const
char
*
target
)
{
git_reference
*
head
;
...
...
tests-clar/repo/repo_helpers.h
View file @
efc9e670
...
...
@@ -2,5 +2,5 @@
#define NON_EXISTING_HEAD "refs/heads/hide/and/seek"
extern
void
make_head_
orphaned
(
git_repository
*
repo
,
const
char
*
target
);
extern
void
make_head_
unborn
(
git_repository
*
repo
,
const
char
*
target
);
extern
void
delete_head
(
git_repository
*
repo
);
tests-clar/reset/soft.c
View file @
efc9e670
...
...
@@ -95,19 +95,19 @@ void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
cl_git_fail
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
));
}
void
test_reset_soft__resetting_against_an_
orphaned_head_repo_makes_the_head_no_longer_orphaned
(
void
)
void
test_reset_soft__resetting_against_an_
unborn_head_repo_makes_the_head_no_longer_unborn
(
void
)
{
git_reference
*
head
;
retrieve_target_from_oid
(
&
target
,
repo
,
KNOWN_COMMIT_IN_BARE_REPO
);
make_head_
orphaned
(
repo
,
NON_EXISTING_HEAD
);
make_head_
unborn
(
repo
,
NON_EXISTING_HEAD
);
cl_assert_equal_i
(
true
,
git_repository_head_
orpha
n
(
repo
));
cl_assert_equal_i
(
true
,
git_repository_head_
unbor
n
(
repo
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
));
cl_assert_equal_i
(
false
,
git_repository_head_
orpha
n
(
repo
));
cl_assert_equal_i
(
false
,
git_repository_head_
unbor
n
(
repo
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
repo
,
NON_EXISTING_HEAD
));
cl_assert_equal_i
(
0
,
git_oid_streq
(
git_reference_target
(
head
),
KNOWN_COMMIT_IN_BARE_REPO
));
...
...
tests-clar/stash/save.c
View file @
efc9e670
...
...
@@ -194,7 +194,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void)
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
"HEAD"
,
"refs/heads/unborn"
,
1
));
cl_assert_equal_i
(
GIT_E
ORPHANEDHEAD
,
cl_assert_equal_i
(
GIT_E
UNBORNBRANCH
,
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_DEFAULT
));
git_reference_free
(
head
);
...
...
tests-clar/submodule/lookup.c
View file @
efc9e670
...
...
@@ -114,15 +114,15 @@ void test_submodule_lookup__foreach(void)
cl_assert_equal_i
(
8
,
data
.
count
);
}
void
test_submodule_lookup__lookup_even_with_
orphaned
_head
(
void
)
void
test_submodule_lookup__lookup_even_with_
unborn
_head
(
void
)
{
git_reference
*
orphan
;
git_reference
*
head
;
git_submodule
*
sm
;
/*
orphan the head
*/
/*
put us on an unborn branch
*/
cl_git_pass
(
git_reference_symbolic_create
(
&
orphan
,
g_repo
,
"HEAD"
,
"refs/heads/garbage"
,
1
));
git_reference_free
(
orphan
);
&
head
,
g_repo
,
"HEAD"
,
"refs/heads/garbage"
,
1
));
git_reference_free
(
head
);
/* lookup existing */
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_unchanged"
));
...
...
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