-
Notifications
You must be signed in to change notification settings - Fork 0
/
mikansei.c
71 lines (60 loc) · 1.6 KB
/
mikansei.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
struct que_commit
{
struct commit *commit;
struct que_commit *next;
};
void push_que(struct commit *c,struct que_commit *end){
struct que_commit *n = (struct que_commit*)xmalloc(sizeof(struct commit));
n->commit = c;
n->next = NULL;
end->next =n
end = n;
}
struct commit* pop_que(struct que_commit *head){
struct commit *c = head->commit;
head = head->next;
return c;
}
int breadth_search_commit(struct commit *ci,struct commit *target){
struct que_commit *head,*end;
push_que(ci,end);
head = end;
struct commit_list *list = ci->parents;
struct commit *item,;
while(1){
while((item=list->item)){
push_que(item,end);
list = list->next;
}
if (strcmp(target->object->sha1,ci->object->sha1)==0){
return move;
}
// new_ci = new_ci->parents
}
}
int not_pushed(struct commit *current_head){
struct commit *remote_head;
unsigned char sha1[20];
const struct name_decoration decoration;
int decoration_style=1;
if (decoration_style) {
load_ref_decorations(decoration_style);
}
decoration = get_name_decoration(¤t_head->object);
const char* upstream = (branch_get(NULL)->merge)?branch_get(NULL)->merge[0]->dst : NULL;
if (upstream==NULL)
return (int)true;
if (get_sha1(upstream, sha1))
remote_head = NULL;
else {
remote_head = lookup_commit_or_die(sha1, upstream);
if (parse_commit(remote_head))
die(_("could not parse remote head commit"));
}
struct commit *old_ci=remote_head,*new_ci=current_head;
if (old_ci->date > new_ci->date){
struct commit *tmp = old_ci;
old_ci=new_ci;
new_ci=tmp;
}
}