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
979645a7
Commit
979645a7
authored
Oct 04, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebase: updates based on PR comments
parent
18b00406
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
34 deletions
+47
-34
include/git2.h
+1
-0
include/git2/rebase.h
+15
-17
src/rebase.c
+31
-17
No files found.
include/git2.h
View file @
979645a7
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "git2/patch.h"
#include "git2/patch.h"
#include "git2/pathspec.h"
#include "git2/pathspec.h"
#include "git2/push.h"
#include "git2/push.h"
#include "git2/rebase.h"
#include "git2/refdb.h"
#include "git2/refdb.h"
#include "git2/reflog.h"
#include "git2/reflog.h"
#include "git2/refs.h"
#include "git2/refs.h"
...
...
include/git2/rebase.h
View file @
979645a7
...
@@ -84,21 +84,19 @@ typedef enum {
...
@@ -84,21 +84,19 @@ typedef enum {
typedef
struct
{
typedef
struct
{
/** The type of rebase operation. */
/** The type of rebase operation. */
unsigned
in
t
type
;
git_rebase_operation_
t
type
;
union
{
/**
/**
* The commit ID being cherry-picked. This will be populated for
* The commit ID being cherry-picked. This will be populated for
* all operations except those of type `GIT_REBASE_OPERATION_EXEC`.
* all operations except those of type `GIT_REBASE_OPERATION_EXEC`.
*/
*/
const
git_oid
id
;
const
git_oid
id
;
/**
/**
* The executable the user has requested be run. This will only
* The executable the user has requested be run. This will only
* be populated for operations of type `GIT_REBASE_OPERATION_EXEC`.
* be populated for operations of type `GIT_REBASE_OPERATION_EXEC`.
*/
*/
const
char
*
exec
;
const
char
*
exec
;
};
}
git_rebase_operation
;
}
git_rebase_operation
;
/**
/**
...
@@ -115,7 +113,7 @@ GIT_EXTERN(int) git_rebase_init_options(
...
@@ -115,7 +113,7 @@ GIT_EXTERN(int) git_rebase_init_options(
unsigned
int
version
);
unsigned
int
version
);
/**
/**
* Initializes a rebase operation to rebase the changes in `
ours
`
* Initializes a rebase operation to rebase the changes in `
branch
`
* relative to `upstream` onto another branch. To begin the rebase
* relative to `upstream` onto another branch. To begin the rebase
* process, call `git_rebase_next`. When you have finished with this
* process, call `git_rebase_next`. When you have finished with this
* object, call `git_rebase_free`.
* object, call `git_rebase_free`.
...
@@ -127,7 +125,7 @@ GIT_EXTERN(int) git_rebase_init_options(
...
@@ -127,7 +125,7 @@ GIT_EXTERN(int) git_rebase_init_options(
* reachable commits
* reachable commits
* @param onto The branch to rebase onto, or NULL to rebase onto the given
* @param onto The branch to rebase onto, or NULL to rebase onto the given
* upstream
* upstream
* @param signature The signature of the rebaser
* @param signature The signature of the rebaser
(optional)
* @param opts Options to specify how rebase is performed
* @param opts Options to specify how rebase is performed
* @return Zero on success; -1 on failure.
* @return Zero on success; -1 on failure.
*/
*/
...
@@ -242,7 +240,7 @@ GIT_EXTERN(int) git_rebase_abort(
...
@@ -242,7 +240,7 @@ GIT_EXTERN(int) git_rebase_abort(
* been applied.
* been applied.
*
*
* @param rebase The rebase that is in-progress
* @param rebase The rebase that is in-progress
* @param signature The identity that is finishing the rebase
* @param signature The identity that is finishing the rebase
(optional)
* @param opts Options to specify how rebase is finished
* @param opts Options to specify how rebase is finished
* @param Zero on success; -1 on error
* @param Zero on success; -1 on error
*/
*/
...
@@ -254,7 +252,7 @@ GIT_EXTERN(int) git_rebase_finish(
...
@@ -254,7 +252,7 @@ GIT_EXTERN(int) git_rebase_finish(
/**
/**
* Frees the `git_rebase` object.
* Frees the `git_rebase` object.
*
*
* @param rebase The rebase
that is in-progress
* @param rebase The rebase
object
*/
*/
GIT_EXTERN
(
void
)
git_rebase_free
(
git_rebase
*
rebase
);
GIT_EXTERN
(
void
)
git_rebase_free
(
git_rebase
*
rebase
);
...
...
src/rebase.c
View file @
979645a7
...
@@ -23,28 +23,28 @@
...
@@ -23,28 +23,28 @@
#include <git2/revwalk.h>
#include <git2/revwalk.h>
#include <git2/notes.h>
#include <git2/notes.h>
#define REBASE_APPLY_DIR
"rebase-apply"
#define REBASE_APPLY_DIR
"rebase-apply"
#define REBASE_MERGE_DIR
"rebase-merge"
#define REBASE_MERGE_DIR
"rebase-merge"
#define HEAD_NAME_FILE
"head-name"
#define HEAD_NAME_FILE
"head-name"
#define ORIG_HEAD_FILE
"orig-head"
#define ORIG_HEAD_FILE
"orig-head"
#define HEAD_FILE
"head"
#define HEAD_FILE
"head"
#define ONTO_FILE
"onto"
#define ONTO_FILE
"onto"
#define ONTO_NAME_FILE
"onto_name"
#define ONTO_NAME_FILE
"onto_name"
#define QUIET_FILE
"quiet"
#define QUIET_FILE
"quiet"
#define MSGNUM_FILE
"msgnum"
#define MSGNUM_FILE
"msgnum"
#define END_FILE
"end"
#define END_FILE
"end"
#define CMT_FILE_FMT
"cmt.%" PRIuZ
#define CMT_FILE_FMT
"cmt.%" PRIuZ
#define CURRENT_FILE
"current"
#define CURRENT_FILE
"current"
#define REWRITTEN_FILE
"rewritten"
#define REWRITTEN_FILE
"rewritten"
#define ORIG_DETACHED_HEAD
"detached HEAD"
#define ORIG_DETACHED_HEAD
"detached HEAD"
#define NOTES_DEFAULT_REF
NULL
#define NOTES_DEFAULT_REF
NULL
#define REBASE_DIR_MODE
0777
#define REBASE_DIR_MODE
0777
#define REBASE_FILE_MODE
0666
#define REBASE_FILE_MODE
0666
typedef
enum
{
typedef
enum
{
GIT_REBASE_TYPE_NONE
=
0
,
GIT_REBASE_TYPE_NONE
=
0
,
...
@@ -948,6 +948,7 @@ static int rebase_copy_note(
...
@@ -948,6 +948,7 @@ static int rebase_copy_note(
{
{
git_note
*
note
=
NULL
;
git_note
*
note
=
NULL
;
git_oid
note_id
;
git_oid
note_id
;
git_signature
*
who
=
NULL
;
int
error
;
int
error
;
if
((
error
=
git_note_read
(
&
note
,
rebase
->
repo
,
opts
->
rewrite_notes_ref
,
from
))
<
0
)
{
if
((
error
=
git_note_read
(
&
note
,
rebase
->
repo
,
opts
->
rewrite_notes_ref
,
from
))
<
0
)
{
...
@@ -959,11 +960,24 @@ static int rebase_copy_note(
...
@@ -959,11 +960,24 @@ static int rebase_copy_note(
goto
done
;
goto
done
;
}
}
if
(
!
committer
)
{
if
((
error
=
git_signature_default
(
&
who
,
rebase
->
repo
))
<
0
)
{
if
(
error
!=
GIT_ENOTFOUND
||
(
error
=
git_signature_now
(
&
who
,
"unknown"
,
"unknown"
))
<
0
)
goto
done
;
giterr_clear
();
}
committer
=
who
;
}
error
=
git_note_create
(
&
note_id
,
rebase
->
repo
,
git_note_author
(
note
),
error
=
git_note_create
(
&
note_id
,
rebase
->
repo
,
git_note_author
(
note
),
committer
,
opts
->
rewrite_notes_ref
,
to
,
git_note_message
(
note
),
0
);
committer
,
opts
->
rewrite_notes_ref
,
to
,
git_note_message
(
note
),
0
);
done
:
done
:
git_note_free
(
note
);
git_note_free
(
note
);
git_signature_free
(
who
);
return
error
;
return
error
;
}
}
...
...
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