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
7f562f2c
Unverified
Commit
7f562f2c
authored
May 12, 2019
by
Edward Thomson
Committed by
GitHub
May 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5057 from eaigner/merge-rebase-onto-name
rebase: orig_head and onto accessors
parents
604e2811
e215f475
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
include/git2/rebase.h
+28
-0
src/rebase.c
+16
-0
tests/rebase/merge.c
+10
-0
No files found.
include/git2/rebase.h
View file @
7f562f2c
...
...
@@ -200,6 +200,34 @@ GIT_EXTERN(int) git_rebase_open(
const
git_rebase_options
*
opts
);
/**
* Gets the original `HEAD` ref name for merge rebases.
*
* @return The original `HEAD` ref name
*/
GIT_EXTERN
(
const
char
*
)
git_rebase_orig_head_name
(
git_rebase
*
rebase
);
/**
* Gets the original `HEAD` id for merge rebases.
*
* @return The original `HEAD` id
*/
GIT_EXTERN
(
const
git_oid
*
)
git_rebase_orig_head_id
(
git_rebase
*
rebase
);
/**
* Gets the `onto` ref name for merge rebases.
*
* @return The `onto` ref name
*/
GIT_EXTERN
(
const
char
*
)
git_rebase_onto_name
(
git_rebase
*
rebase
);
/**
* Gets the `onto` id for merge rebases.
*
* @return The `onto` id
*/
GIT_EXTERN
(
const
git_oid
*
)
git_rebase_onto_id
(
git_rebase
*
rebase
);
/**
* Gets the count of rebase operations that are to be applied.
*
* @param rebase The in-progress rebase
...
...
src/rebase.c
View file @
7f562f2c
...
...
@@ -1327,6 +1327,22 @@ int git_rebase_finish(
return
error
;
}
const
char
*
git_rebase_orig_head_name
(
git_rebase
*
rebase
)
{
return
rebase
->
orig_head_name
;
}
const
git_oid
*
git_rebase_orig_head_id
(
git_rebase
*
rebase
)
{
return
&
rebase
->
orig_head_id
;
}
const
char
*
git_rebase_onto_name
(
git_rebase
*
rebase
)
{
return
rebase
->
onto_name
;
}
const
git_oid
*
git_rebase_onto_id
(
git_rebase
*
rebase
)
{
return
&
rebase
->
onto_id
;
}
size_t
git_rebase_operation_entrycount
(
git_rebase
*
rebase
)
{
assert
(
rebase
);
...
...
tests/rebase/merge.c
View file @
7f562f2c
...
...
@@ -44,6 +44,10 @@ void test_rebase_merge__next(void)
git_status_list
*
status_list
;
const
git_status_entry
*
status_entry
;
git_oid
pick_id
,
file1_id
;
git_oid
master_id
,
beef_id
;
git_oid_fromstr
(
&
master_id
,
"efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"
);
git_oid_fromstr
(
&
beef_id
,
"b146bd7608eac53d9bf9e1a6963543588b555c64"
);
cl_git_pass
(
git_reference_lookup
(
&
branch_ref
,
repo
,
"refs/heads/beef"
));
cl_git_pass
(
git_reference_lookup
(
&
upstream_ref
,
repo
,
"refs/heads/master"
));
...
...
@@ -53,6 +57,12 @@ void test_rebase_merge__next(void)
cl_git_pass
(
git_rebase_init
(
&
rebase
,
repo
,
branch_head
,
upstream_head
,
NULL
,
NULL
));
cl_assert_equal_s
(
"refs/heads/beef"
,
git_rebase_orig_head_name
(
rebase
));
cl_assert_equal_oid
(
&
beef_id
,
git_rebase_orig_head_id
(
rebase
));
cl_assert_equal_s
(
"master"
,
git_rebase_onto_name
(
rebase
));
cl_assert_equal_oid
(
&
master_id
,
git_rebase_onto_id
(
rebase
));
cl_git_pass
(
git_rebase_next
(
&
rebase_operation
,
rebase
));
git_oid_fromstr
(
&
pick_id
,
"da9c51a23d02d931a486f45ad18cda05cf5d2b94"
);
...
...
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