Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
merge-recur: Convert variable names to lower_case
author
Johannes Schindelin
<Johannes.Schindelin@gmx.de>
Thu, 27 Jul 2006 17:12:29 +0000
(19:12 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 28 Jul 2006 02:39:15 +0000
(19:39 -0700)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-recursive.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3af244c
)
diff --git
a/merge-recursive.c
b/merge-recursive.c
index d78f58d8d2463c49bf14d3639ec60772b232f7f9..5d20f9efce54224d9461f6451a049066b5d75232 100644
(file)
--- a/
merge-recursive.c
+++ b/
merge-recursive.c
@@
-122,8
+122,8
@@
struct stage_data
unsigned processed:1;
};
unsigned processed:1;
};
-static struct path_list current
FileS
et = {NULL, 0, 0, 1};
-static struct path_list current
DirectoryS
et = {NULL, 0, 0, 1};
+static struct path_list current
_file_s
et = {NULL, 0, 0, 1};
+static struct path_list current
_directory_s
et = {NULL, 0, 0, 1};
static int output_indent = 0;
static int output_indent = 0;
@@
-335,9
+335,9
@@
static int save_files_dirs(const unsigned char *sha1,
newpath[baselen + len] = '\0';
if (S_ISDIR(mode))
newpath[baselen + len] = '\0';
if (S_ISDIR(mode))
- path_list_insert(newpath, ¤t
DirectoryS
et);
+ path_list_insert(newpath, ¤t
_directory_s
et);
else
else
- path_list_insert(newpath, ¤t
FileS
et);
+ path_list_insert(newpath, ¤t
_file_s
et);
free(newpath);
return READ_TREE_RECURSIVE;
free(newpath);
return READ_TREE_RECURSIVE;
@@
-351,7
+351,7
@@
static int get_files_dirs(struct tree *tree)
debug(" get_files_dirs done (0)\n");
return 0;
}
debug(" get_files_dirs done (0)\n");
return 0;
}
- n = current
FileSet.nr + currentDirectoryS
et.nr;
+ n = current
_file_set.nr + current_directory_s
et.nr;
debug(" get_files_dirs done (%d)\n", n);
return n;
}
debug(" get_files_dirs done (%d)\n", n);
return n;
}
@@
-378,7
+378,7
@@
static struct stage_data *insert_stage_data(const char *path,
}
/*
}
/*
- * Create a dictionary mapping file names to
CacheEntry
objects. The
+ * Create a dictionary mapping file names to
stage_data
objects. The
* dictionary contains one entry for every path with a non-zero stage entry.
*/
static struct path_list *get_unmerged(void)
* dictionary contains one entry for every path with a non-zero stage entry.
*/
static struct path_list *get_unmerged(void)
@@
-420,15
+420,15
@@
struct rename
};
/*
};
/*
- * Get information of all renames which occured between 'o
T
ree' and
- * 'tree'. We need the three trees in the merge ('o
Tree', 'aT
ree' and
- * 'b
T
ree') to be able to associate the correct cache entries with
- * the rename information. 'tree' is always equal to either a
Tree or bT
ree.
+ * Get information of all renames which occured between 'o
_t
ree' and
+ * 'tree'. We need the three trees in the merge ('o
_tree', 'a_t
ree' and
+ * 'b
_t
ree') to be able to associate the correct cache entries with
+ * the rename information. 'tree' is always equal to either a
_tree or b_t
ree.
*/
static struct path_list *get_renames(struct tree *tree,
*/
static struct path_list *get_renames(struct tree *tree,
- struct tree *o
T
ree,
- struct tree *a
T
ree,
- struct tree *b
T
ree,
+ struct tree *o
_t
ree,
+ struct tree *a
_t
ree,
+ struct tree *b
_t
ree,
struct path_list *entries)
{
int i;
struct path_list *entries)
{
int i;
@@
-437,7
+437,7
@@
static struct path_list *get_renames(struct tree *tree,
#ifdef DEBUG
time_t t = time(0);
#ifdef DEBUG
time_t t = time(0);
- debug("get
R
enames ...\n");
+ debug("get
_r
enames ...\n");
#endif
renames = xcalloc(1, sizeof(struct path_list));
#endif
renames = xcalloc(1, sizeof(struct path_list));
@@
-447,7
+447,7
@@
static struct path_list *get_renames(struct tree *tree,
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
if (diff_setup_done(&opts) < 0)
die("diff setup failed");
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
if (diff_setup_done(&opts) < 0)
die("diff setup failed");
- diff_tree_sha1(o
T
ree->object.sha1, tree->object.sha1, "", &opts);
+ diff_tree_sha1(o
_t
ree->object.sha1, tree->object.sha1, "", &opts);
diffcore_std(&opts);
for (i = 0; i < diff_queued_diff.nr; ++i) {
struct path_list_item *item;
diffcore_std(&opts);
for (i = 0; i < diff_queued_diff.nr; ++i) {
struct path_list_item *item;
@@
-463,14
+463,14
@@
static struct path_list *get_renames(struct tree *tree,
item = path_list_lookup(re->pair->one->path, entries);
if (!item)
re->src_entry = insert_stage_data(re->pair->one->path,
item = path_list_lookup(re->pair->one->path, entries);
if (!item)
re->src_entry = insert_stage_data(re->pair->one->path,
- o
Tree, aTree, bT
ree, entries);
+ o
_tree, a_tree, b_t
ree, entries);
else
re->src_entry = item->util;
item = path_list_lookup(re->pair->two->path, entries);
if (!item)
re->dst_entry = insert_stage_data(re->pair->two->path,
else
re->src_entry = item->util;
item = path_list_lookup(re->pair->two->path, entries);
if (!item)
re->dst_entry = insert_stage_data(re->pair->two->path,
- o
Tree, aTree, bT
ree, entries);
+ o
_tree, a_tree, b_t
ree, entries);
else
re->dst_entry = item->util;
item = path_list_insert(pair->one->path, renames);
else
re->dst_entry = item->util;
item = path_list_insert(pair->one->path, renames);
@@
-480,7
+480,7
@@
static struct path_list *get_renames(struct tree *tree,
diff_queued_diff.nr = 0;
diff_flush(&opts);
#ifdef DEBUG
diff_queued_diff.nr = 0;
diff_flush(&opts);
#ifdef DEBUG
- debug(" get
R
enames done in %ld\n", time(0)-t);
+ debug(" get
_r
enames done in %ld\n", time(0)-t);
#endif
return renames;
}
#endif
return renames;
}
@@
-526,25
+526,23
@@
static int remove_path(const char *name)
return ret;
}
return ret;
}
-/* General TODO: unC99ify the code: no declaration after code */
-/* General TODO: no javaIfiCation: rename updateCache to update_cache */
/*
* TODO: once we no longer call external programs, we'd probably be better off
* not setting / getting the environment variable GIT_INDEX_FILE all the time.
*/
int remove_file(int clean, const char *path)
{
/*
* TODO: once we no longer call external programs, we'd probably be better off
* not setting / getting the environment variable GIT_INDEX_FILE all the time.
*/
int remove_file(int clean, const char *path)
{
- int update
C
ache = index_only || clean;
- int update
Wd
= !index_only;
+ int update
_c
ache = index_only || clean;
+ int update
_working_directory
= !index_only;
- if (update
C
ache) {
+ if (update
_c
ache) {
if (!cache_dirty)
read_cache_from(getenv("GIT_INDEX_FILE"));
cache_dirty++;
if (remove_file_from_cache(path))
return -1;
}
if (!cache_dirty)
read_cache_from(getenv("GIT_INDEX_FILE"));
cache_dirty++;
if (remove_file_from_cache(path))
return -1;
}
- if (update
Wd
)
+ if (update
_working_directory
)
{
unlink(path);
if (errno != ENOENT || errno != EISDIR)
{
unlink(path);
if (errno != ENOENT || errno != EISDIR)
@@
-566,12
+564,12
@@
static char *unique_path(const char *path, const char *branch)
for (; *p; ++p)
if ('/' == *p)
*p = '_';
for (; *p; ++p)
if ('/' == *p)
*p = '_';
- while (path_list_has_path(¤t
FileS
et, newpath) ||
- path_list_has_path(¤t
DirectoryS
et, newpath) ||
+ while (path_list_has_path(¤t
_file_s
et, newpath) ||
+ path_list_has_path(¤t
_directory_s
et, newpath) ||
lstat(newpath, &st) == 0)
sprintf(p, "_%d", suffix++);
lstat(newpath, &st) == 0)
sprintf(p, "_%d", suffix++);
- path_list_insert(newpath, ¤t
FileS
et);
+ path_list_insert(newpath, ¤t
_file_s
et);
return newpath;
}
return newpath;
}
@@
-784,22
+782,22
@@
static void conflict_rename_rename(struct rename *ren1,
int delp = 0;
const char *ren1_dst = ren1->pair->two->path;
const char *ren2_dst = ren2->pair->two->path;
int delp = 0;
const char *ren1_dst = ren1->pair->two->path;
const char *ren2_dst = ren2->pair->two->path;
- const char *dst
N
ame1 = ren1_dst;
- const char *dst
N
ame2 = ren2_dst;
- if (path_list_has_path(¤t
DirectoryS
et, ren1_dst)) {
- dst
N
ame1 = del[delp++] = unique_path(ren1_dst, branch1);
+ const char *dst
_n
ame1 = ren1_dst;
+ const char *dst
_n
ame2 = ren2_dst;
+ if (path_list_has_path(¤t
_directory_s
et, ren1_dst)) {
+ dst
_n
ame1 = del[delp++] = unique_path(ren1_dst, branch1);
output("%s is a directory in %s adding as %s instead",
output("%s is a directory in %s adding as %s instead",
- ren1_dst, branch2, dst
N
ame1);
+ ren1_dst, branch2, dst
_n
ame1);
remove_file(0, ren1_dst);
}
remove_file(0, ren1_dst);
}
- if (path_list_has_path(¤t
DirectoryS
et, ren2_dst)) {
- dst
N
ame2 = del[delp++] = unique_path(ren2_dst, branch2);
+ if (path_list_has_path(¤t
_directory_s
et, ren2_dst)) {
+ dst
_n
ame2 = del[delp++] = unique_path(ren2_dst, branch2);
output("%s is a directory in %s adding as %s instead",
output("%s is a directory in %s adding as %s instead",
- ren2_dst, branch1, dst
N
ame2);
+ ren2_dst, branch1, dst
_n
ame2);
remove_file(0, ren2_dst);
}
remove_file(0, ren2_dst);
}
- update_stages(dst
N
ame1, NULL, ren1->pair->two, NULL, 1);
- update_stages(dst
N
ame2, NULL, NULL, ren2->pair->two, 1);
+ update_stages(dst
_n
ame1, NULL, ren1->pair->two, NULL, 1);
+ update_stages(dst
_n
ame2, NULL, NULL, ren2->pair->two, 1);
while (delp--)
free(del[delp]);
}
while (delp--)
free(del[delp]);
}
@@
-807,11
+805,11
@@
static void conflict_rename_rename(struct rename *ren1,
static void conflict_rename_dir(struct rename *ren1,
const char *branch1)
{
static void conflict_rename_dir(struct rename *ren1,
const char *branch1)
{
- char *new
P
ath = unique_path(ren1->pair->two->path, branch1);
- output("Renaming %s to %s instead", ren1->pair->one->path, new
P
ath);
+ char *new
_p
ath = unique_path(ren1->pair->two->path, branch1);
+ output("Renaming %s to %s instead", ren1->pair->one->path, new
_p
ath);
remove_file(0, ren1->pair->two->path);
remove_file(0, ren1->pair->two->path);
- update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new
P
ath);
- free(new
P
ath);
+ update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new
_p
ath);
+ free(new
_p
ath);
}
static void conflict_rename_rename_2(struct rename *ren1,
}
static void conflict_rename_rename_2(struct rename *ren1,
@@
-819,74
+817,74
@@
static void conflict_rename_rename_2(struct rename *ren1,
struct rename *ren2,
const char *branch2)
{
struct rename *ren2,
const char *branch2)
{
- char *new
P
ath1 = unique_path(ren1->pair->two->path, branch1);
- char *new
P
ath2 = unique_path(ren2->pair->two->path, branch2);
+ char *new
_p
ath1 = unique_path(ren1->pair->two->path, branch1);
+ char *new
_p
ath2 = unique_path(ren2->pair->two->path, branch2);
output("Renaming %s to %s and %s to %s instead",
output("Renaming %s to %s and %s to %s instead",
- ren1->pair->one->path, new
P
ath1,
- ren2->pair->one->path, new
P
ath2);
+ ren1->pair->one->path, new
_p
ath1,
+ ren2->pair->one->path, new
_p
ath2);
remove_file(0, ren1->pair->two->path);
remove_file(0, ren1->pair->two->path);
- update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new
P
ath1);
- update_file(0, ren2->pair->two->sha1, ren2->pair->two->mode, new
P
ath2);
- free(new
P
ath2);
- free(new
P
ath1);
+ update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new
_p
ath1);
+ update_file(0, ren2->pair->two->sha1, ren2->pair->two->mode, new
_p
ath2);
+ free(new
_p
ath2);
+ free(new
_p
ath1);
}
/* General TODO: get rid of all the debug messages */
}
/* General TODO: get rid of all the debug messages */
-static int process_renames(struct path_list *
renamesA
,
- struct path_list *
renamesB
,
- const char *
branchNameA
,
- const char *b
ranchNameB
)
+static int process_renames(struct path_list *
a_renames
,
+ struct path_list *
b_renames
,
+ const char *
a_branch
,
+ const char *b
_branch
)
{
{
- int clean
M
erge = 1, i, j;
- struct path_list
byDstA = {NULL, 0, 0, 0}, byDstB
= {NULL, 0, 0, 0};
+ int clean
_m
erge = 1, i, j;
+ struct path_list
a_by_dst = {NULL, 0, 0, 0}, b_by_dst
= {NULL, 0, 0, 0};
const struct rename *sre;
const struct rename *sre;
- for (i = 0; i <
renamesA
->nr; i++) {
- sre =
renamesA
->items[i].util;
- path_list_insert(sre->pair->two->path, &
byDstA
)->util
+ for (i = 0; i <
a_renames
->nr; i++) {
+ sre =
a_renames
->items[i].util;
+ path_list_insert(sre->pair->two->path, &
a_by_dst
)->util
= sre->dst_entry;
}
= sre->dst_entry;
}
- for (i = 0; i <
renamesB
->nr; i++) {
- sre =
renamesB
->items[i].util;
- path_list_insert(sre->pair->two->path, &b
yDstB
)->util
+ for (i = 0; i <
b_renames
->nr; i++) {
+ sre =
b_renames
->items[i].util;
+ path_list_insert(sre->pair->two->path, &b
_by_dst
)->util
= sre->dst_entry;
}
= sre->dst_entry;
}
- for (i = 0, j = 0; i <
renamesA->nr || j < renamesB
->nr;) {
+ for (i = 0, j = 0; i <
a_renames->nr || j < b_renames
->nr;) {
int compare;
char *src;
struct path_list *renames1, *renames2, *renames2Dst;
struct rename *ren1 = NULL, *ren2 = NULL;
int compare;
char *src;
struct path_list *renames1, *renames2, *renames2Dst;
struct rename *ren1 = NULL, *ren2 = NULL;
- const char *branch
Name1, *branchName
2;
+ const char *branch
1, *branch
2;
const char *ren1_src, *ren1_dst;
const char *ren1_src, *ren1_dst;
- if (i >=
renamesA
->nr) {
+ if (i >=
a_renames
->nr) {
compare = 1;
compare = 1;
- ren2 =
renamesB
->items[j++].util;
- } else if (j >=
renamesB
->nr) {
+ ren2 =
b_renames
->items[j++].util;
+ } else if (j >=
b_renames
->nr) {
compare = -1;
compare = -1;
- ren1 =
renamesA
->items[i++].util;
+ ren1 =
a_renames
->items[i++].util;
} else {
} else {
- compare = strcmp(
renamesA
->items[i].path,
-
renamesB
->items[j].path);
- ren1 =
renamesA
->items[i++].util;
- ren2 =
renamesB
->items[j++].util;
+ compare = strcmp(
a_renames
->items[i].path,
+
b_renames
->items[j].path);
+ ren1 =
a_renames
->items[i++].util;
+ ren2 =
b_renames
->items[j++].util;
}
/* TODO: refactor, so that 1/2 are not needed */
if (ren1) {
}
/* TODO: refactor, so that 1/2 are not needed */
if (ren1) {
- renames1 =
renamesA
;
- renames2 =
renamesB
;
- renames2Dst = &b
yDstB
;
- branch
Name1 = branchNameA
;
- branch
Name2 = branchNameB
;
+ renames1 =
a_renames
;
+ renames2 =
b_renames
;
+ renames2Dst = &b
_by_dst
;
+ branch
1 = a_branch
;
+ branch
2 = b_branch
;
} else {
struct rename *tmp;
} else {
struct rename *tmp;
- renames1 =
renamesB
;
- renames2 =
renamesA
;
- renames2Dst = &
byDstA
;
- branch
Name1 = branchNameB
;
- branch
Name2 = branchNameA
;
+ renames1 =
b_renames
;
+ renames2 =
a_renames
;
+ renames2Dst = &
a_by_dst
;
+ branch
1 = b_branch
;
+ branch
2 = a_branch
;
tmp = ren2;
ren2 = ren1;
ren1 = tmp;
tmp = ren2;
ren2 = ren1;
ren1 = tmp;
@@
-912,21
+910,21
@@
static int process_renames(struct path_list *renamesA,
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
- clean
M
erge = 0;
+ clean
_m
erge = 0;
output("CONFLICT (rename/rename): "
"Rename %s->%s in branch %s "
"rename %s->%s in %s",
output("CONFLICT (rename/rename): "
"Rename %s->%s in branch %s "
"rename %s->%s in %s",
- src, ren1_dst, branch
Name
1,
- src, ren2_dst, branch
Name
2);
- conflict_rename_rename(ren1, branch
Name1, ren2, branchName
2);
+ src, ren1_dst, branch1,
+ src, ren2_dst, branch2);
+ conflict_rename_rename(ren1, branch
1, ren2, branch
2);
} else {
} else {
- remove_file(1, ren1_src);
struct merge_file_info mfi;
struct merge_file_info mfi;
+ remove_file(1, ren1_src);
mfi = merge_file(ren1->pair->one,
ren1->pair->two,
ren2->pair->two,
mfi = merge_file(ren1->pair->one,
ren1->pair->two,
ren2->pair->two,
- branch
Name
1,
- branch
Name
2);
+ branch1,
+ branch2);
if (mfi.merge || !mfi.clean)
output("Renaming %s->%s", src, ren1_dst);
if (mfi.merge || !mfi.clean)
output("Renaming %s->%s", src, ren1_dst);
@@
-936,7
+934,7
@@
static int process_renames(struct path_list *renamesA,
if (!mfi.clean) {
output("CONFLICT (content): merge conflict in %s",
ren1_dst);
if (!mfi.clean) {
output("CONFLICT (content): merge conflict in %s",
ren1_dst);
- clean
M
erge = 0;
+ clean
_m
erge = 0;
if (!index_only)
update_stages(ren1_dst,
if (!index_only)
update_stages(ren1_dst,
@@
-952,7
+950,7
@@
static int process_renames(struct path_list *renamesA,
struct path_list_item *item;
/* we only use sha1 and mode of these */
struct diff_filespec src_other, dst_other;
struct path_list_item *item;
/* we only use sha1 and mode of these */
struct diff_filespec src_other, dst_other;
- int try
Merge, stage = renamesA
== renames1 ? 3: 2;
+ int try
_merge, stage = a_renames
== renames1 ? 3: 2;
remove_file(1, ren1_src);
remove_file(1, ren1_src);
@@
-963,52
+961,52
@@
static int process_renames(struct path_list *renamesA,
ren1->dst_entry->stages[stage].sha, 20);
dst_other.mode = ren1->dst_entry->stages[stage].mode;
ren1->dst_entry->stages[stage].sha, 20);
dst_other.mode = ren1->dst_entry->stages[stage].mode;
- try
M
erge = 0;
+ try
_m
erge = 0;
- if (path_list_has_path(¤t
DirectoryS
et, ren1_dst)) {
- clean
M
erge = 0;
+ if (path_list_has_path(¤t
_directory_s
et, ren1_dst)) {
+ clean
_m
erge = 0;
output("CONFLICT (rename/directory): Rename %s->%s in %s "
" directory %s added in %s",
output("CONFLICT (rename/directory): Rename %s->%s in %s "
" directory %s added in %s",
- ren1_src, ren1_dst, branch
Name
1,
- ren1_dst, branch
Name
2);
- conflict_rename_dir(ren1, branch
Name
1);
+ ren1_src, ren1_dst, branch1,
+ ren1_dst, branch2);
+ conflict_rename_dir(ren1, branch1);
} else if (sha_eq(src_other.sha1, null_sha1)) {
} else if (sha_eq(src_other.sha1, null_sha1)) {
- clean
M
erge = 0;
+ clean
_m
erge = 0;
output("CONFLICT (rename/delete): Rename %s->%s in %s "
"and deleted in %s",
output("CONFLICT (rename/delete): Rename %s->%s in %s "
"and deleted in %s",
- ren1_src, ren1_dst, branch
Name
1,
- branch
Name
2);
+ ren1_src, ren1_dst, branch1,
+ branch2);
update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);
} else if (!sha_eq(dst_other.sha1, null_sha1)) {
update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);
} else if (!sha_eq(dst_other.sha1, null_sha1)) {
- const char *new
P
ath;
- clean
M
erge = 0;
- try
M
erge = 1;
+ const char *new
_p
ath;
+ clean
_m
erge = 0;
+ try
_m
erge = 1;
output("CONFLICT (rename/add): Rename %s->%s in %s. "
"%s added in %s",
output("CONFLICT (rename/add): Rename %s->%s in %s. "
"%s added in %s",
- ren1_src, ren1_dst, branch
Name
1,
- ren1_dst, branch
Name
2);
- new
Path = unique_path(ren1_dst, branchName
2);
- output("Adding as %s instead", new
P
ath);
- update_file(0, dst_other.sha1, dst_other.mode, new
P
ath);
+ ren1_src, ren1_dst, branch1,
+ ren1_dst, branch2);
+ new
_path = unique_path(ren1_dst, branch
2);
+ output("Adding as %s instead", new
_p
ath);
+ update_file(0, dst_other.sha1, dst_other.mode, new
_p
ath);
} else if ((item = path_list_lookup(ren1_dst, renames2Dst))) {
ren2 = item->util;
} else if ((item = path_list_lookup(ren1_dst, renames2Dst))) {
ren2 = item->util;
- clean
M
erge = 0;
+ clean
_m
erge = 0;
ren2->processed = 1;
output("CONFLICT (rename/rename): Rename %s->%s in %s. "
"Rename %s->%s in %s",
ren2->processed = 1;
output("CONFLICT (rename/rename): Rename %s->%s in %s. "
"Rename %s->%s in %s",
- ren1_src, ren1_dst, branch
Name
1,
- ren2->pair->one->path, ren2->pair->two->path, branch
Name
2);
- conflict_rename_rename_2(ren1, branch
Name1, ren2, branchName
2);
+ ren1_src, ren1_dst, branch1,
+ ren2->pair->one->path, ren2->pair->two->path, branch2);
+ conflict_rename_rename_2(ren1, branch
1, ren2, branch
2);
} else
} else
- try
M
erge = 1;
+ try
_m
erge = 1;
- if (try
M
erge) {
+ if (try
_m
erge) {
struct diff_filespec *o, *a, *b;
struct merge_file_info mfi;
src_other.path = (char *)ren1_src;
o = ren1->pair->one;
struct diff_filespec *o, *a, *b;
struct merge_file_info mfi;
src_other.path = (char *)ren1_src;
o = ren1->pair->one;
- if (
renamesA
== renames1) {
+ if (
a_renames
== renames1) {
a = ren1->pair->two;
b = &src_other;
} else {
a = ren1->pair->two;
b = &src_other;
} else {
@@
-1016,7
+1014,7
@@
static int process_renames(struct path_list *renamesA,
a = &src_other;
}
mfi = merge_file(o, a, b,
a = &src_other;
}
mfi = merge_file(o, a, b,
-
branchNameA, branchNameB
);
+
a_branch, b_branch
);
if (mfi.merge || !mfi.clean)
output("Renaming %s => %s", ren1_src, ren1_dst);
if (mfi.merge || !mfi.clean)
output("Renaming %s => %s", ren1_src, ren1_dst);
@@
-1025,7
+1023,7
@@
static int process_renames(struct path_list *renamesA,
if (!mfi.clean) {
output("CONFLICT (rename/modify): Merge conflict in %s",
ren1_dst);
if (!mfi.clean) {
output("CONFLICT (rename/modify): Merge conflict in %s",
ren1_dst);
- clean
M
erge = 0;
+ clean
_m
erge = 0;
if (!index_only)
update_stages(ren1_dst,
if (!index_only)
update_stages(ren1_dst,
@@
-1035,12
+1033,12
@@
static int process_renames(struct path_list *renamesA,
}
}
}
}
}
}
- path_list_clear(&
byDstA
, 0);
- path_list_clear(&b
yDstB
, 0);
+ path_list_clear(&
a_by_dst
, 0);
+ path_list_clear(&b
_by_dst
, 0);
if (cache_dirty)
flush_cache();
if (cache_dirty)
flush_cache();
- return clean
M
erge;
+ return clean
_m
erge;
}
static unsigned char *has_sha(const unsigned char *sha)
}
static unsigned char *has_sha(const unsigned char *sha)
@@
-1057,116
+1055,116
@@
static int process_entry(const char *path, struct stage_data *entry,
printf("processing entry, clean cache: %s\n", index_only ? "yes": "no");
print_index_entry("\tpath: ", entry);
*/
printf("processing entry, clean cache: %s\n", index_only ? "yes": "no");
print_index_entry("\tpath: ", entry);
*/
- int clean
M
erge = 1;
- unsigned char *o
S
ha = has_sha(entry->stages[1].sha);
- unsigned char *a
S
ha = has_sha(entry->stages[2].sha);
- unsigned char *b
S
ha = has_sha(entry->stages[3].sha);
- unsigned o
M
ode = entry->stages[1].mode;
- unsigned a
M
ode = entry->stages[2].mode;
- unsigned b
M
ode = entry->stages[3].mode;
-
- if (o
Sha && (!aSha || !bS
ha)) {
+ int clean
_m
erge = 1;
+ unsigned char *o
_s
ha = has_sha(entry->stages[1].sha);
+ unsigned char *a
_s
ha = has_sha(entry->stages[2].sha);
+ unsigned char *b
_s
ha = has_sha(entry->stages[3].sha);
+ unsigned o
_m
ode = entry->stages[1].mode;
+ unsigned a
_m
ode = entry->stages[2].mode;
+ unsigned b
_m
ode = entry->stages[3].mode;
+
+ if (o
_sha && (!a_sha || !b_s
ha)) {
/* Case A: Deleted in one */
/* Case A: Deleted in one */
- if ((!a
Sha && !bS
ha) ||
- (sha_eq(a
Sha, oSha) && !bS
ha) ||
- (!a
Sha && sha_eq(bSha, oS
ha))) {
+ if ((!a
_sha && !b_s
ha) ||
+ (sha_eq(a
_sha, o_sha) && !b_s
ha) ||
+ (!a
_sha && sha_eq(b_sha, o_s
ha))) {
/* Deleted in both or deleted in one and
* unchanged in the other */
/* Deleted in both or deleted in one and
* unchanged in the other */
- if (a
S
ha)
+ if (a
_s
ha)
output("Removing %s", path);
remove_file(1, path);
} else {
/* Deleted in one and changed in the other */
output("Removing %s", path);
remove_file(1, path);
} else {
/* Deleted in one and changed in the other */
- clean
M
erge = 0;
- if (!a
S
ha) {
+ clean
_m
erge = 0;
+ if (!a
_s
ha) {
output("CONFLICT (delete/modify): %s deleted in %s "
"and modified in %s. Version %s of %s left in tree.",
path, branch1Name,
branch2Name, branch2Name, path);
output("CONFLICT (delete/modify): %s deleted in %s "
"and modified in %s. Version %s of %s left in tree.",
path, branch1Name,
branch2Name, branch2Name, path);
- update_file(0, b
Sha, bM
ode, path);
+ update_file(0, b
_sha, b_m
ode, path);
} else {
output("CONFLICT (delete/modify): %s deleted in %s "
"and modified in %s. Version %s of %s left in tree.",
path, branch2Name,
branch1Name, branch1Name, path);
} else {
output("CONFLICT (delete/modify): %s deleted in %s "
"and modified in %s. Version %s of %s left in tree.",
path, branch2Name,
branch1Name, branch1Name, path);
- update_file(0, a
Sha, aM
ode, path);
+ update_file(0, a
_sha, a_m
ode, path);
}
}
}
}
- } else if ((!o
Sha && aSha && !bS
ha) ||
- (!o
Sha && !aSha && bS
ha)) {
+ } else if ((!o
_sha && a_sha && !b_s
ha) ||
+ (!o
_sha && !a_sha && b_s
ha)) {
/* Case B: Added in one. */
/* Case B: Added in one. */
- const char *add
B
ranch;
- const char *other
B
ranch;
+ const char *add
_b
ranch;
+ const char *other
_b
ranch;
unsigned mode;
const unsigned char *sha;
const char *conf;
unsigned mode;
const unsigned char *sha;
const char *conf;
- if (a
S
ha) {
- add
B
ranch = branch1Name;
- other
B
ranch = branch2Name;
- mode = a
M
ode;
- sha = a
S
ha;
+ if (a
_s
ha) {
+ add
_b
ranch = branch1Name;
+ other
_b
ranch = branch2Name;
+ mode = a
_m
ode;
+ sha = a
_s
ha;
conf = "file/directory";
} else {
conf = "file/directory";
} else {
- add
B
ranch = branch2Name;
- other
B
ranch = branch1Name;
- mode = b
M
ode;
- sha = b
S
ha;
+ add
_b
ranch = branch2Name;
+ other
_b
ranch = branch1Name;
+ mode = b
_m
ode;
+ sha = b
_s
ha;
conf = "directory/file";
}
conf = "directory/file";
}
- if (path_list_has_path(¤t
DirectoryS
et, path)) {
- const char *new
Path = unique_path(path, addB
ranch);
- clean
M
erge = 0;
+ if (path_list_has_path(¤t
_directory_s
et, path)) {
+ const char *new
_path = unique_path(path, add_b
ranch);
+ clean
_m
erge = 0;
output("CONFLICT (%s): There is a directory with name %s in %s. "
"Adding %s as %s",
output("CONFLICT (%s): There is a directory with name %s in %s. "
"Adding %s as %s",
- conf, path, other
Branch, path, newP
ath);
+ conf, path, other
_branch, path, new_p
ath);
remove_file(0, path);
remove_file(0, path);
- update_file(0, sha, mode, new
P
ath);
+ update_file(0, sha, mode, new
_p
ath);
} else {
output("Adding %s", path);
update_file(1, sha, mode, path);
}
} else {
output("Adding %s", path);
update_file(1, sha, mode, path);
}
- } else if (!o
Sha && aSha && bS
ha) {
+ } else if (!o
_sha && a_sha && b_s
ha) {
/* Case C: Added in both (check for same permissions). */
/* Case C: Added in both (check for same permissions). */
- if (sha_eq(a
Sha, bS
ha)) {
- if (a
Mode != bM
ode) {
- clean
M
erge = 0;
+ if (sha_eq(a
_sha, b_s
ha)) {
+ if (a
_mode != b_m
ode) {
+ clean
_m
erge = 0;
output("CONFLICT: File %s added identically in both branches, "
"but permissions conflict %06o->%06o",
output("CONFLICT: File %s added identically in both branches, "
"but permissions conflict %06o->%06o",
- path, a
Mode, bM
ode);
- output("CONFLICT: adding with permission: %06o", a
M
ode);
- update_file(0, a
Sha, aM
ode, path);
+ path, a
_mode, b_m
ode);
+ output("CONFLICT: adding with permission: %06o", a
_m
ode);
+ update_file(0, a
_sha, a_m
ode, path);
} else {
/* This case is handled by git-read-tree */
assert(0 && "This case must be handled by git-read-tree");
}
} else {
} else {
/* This case is handled by git-read-tree */
assert(0 && "This case must be handled by git-read-tree");
}
} else {
- const char *new
Path1, *newP
ath2;
- clean
M
erge = 0;
- new
P
ath1 = unique_path(path, branch1Name);
- new
P
ath2 = unique_path(path, branch2Name);
+ const char *new
_path1, *new_p
ath2;
+ clean
_m
erge = 0;
+ new
_p
ath1 = unique_path(path, branch1Name);
+ new
_p
ath2 = unique_path(path, branch2Name);
output("CONFLICT (add/add): File %s added non-identically "
"in both branches. Adding as %s and %s instead.",
output("CONFLICT (add/add): File %s added non-identically "
"in both branches. Adding as %s and %s instead.",
- path, new
Path1, newP
ath2);
+ path, new
_path1, new_p
ath2);
remove_file(0, path);
remove_file(0, path);
- update_file(0, a
Sha, aMode, newP
ath1);
- update_file(0, b
Sha, bMode, newP
ath2);
+ update_file(0, a
_sha, a_mode, new_p
ath1);
+ update_file(0, b
_sha, b_mode, new_p
ath2);
}
}
- } else if (o
Sha && aSha && bS
ha) {
+ } else if (o
_sha && a_sha && b_s
ha) {
/* case D: Modified in both, but differently. */
struct merge_file_info mfi;
struct diff_filespec o, a, b;
output("Auto-merging %s", path);
o.path = a.path = b.path = (char *)path;
/* case D: Modified in both, but differently. */
struct merge_file_info mfi;
struct diff_filespec o, a, b;
output("Auto-merging %s", path);
o.path = a.path = b.path = (char *)path;
- memcpy(o.sha1, o
S
ha, 20);
- o.mode = o
M
ode;
- memcpy(a.sha1, a
S
ha, 20);
- a.mode = a
M
ode;
- memcpy(b.sha1, b
S
ha, 20);
- b.mode = b
M
ode;
+ memcpy(o.sha1, o
_s
ha, 20);
+ o.mode = o
_m
ode;
+ memcpy(a.sha1, a
_s
ha, 20);
+ a.mode = a
_m
ode;
+ memcpy(b.sha1, b
_s
ha, 20);
+ b.mode = b
_m
ode;
mfi = merge_file(&o, &a, &b,
branch1Name, branch2Name);
mfi = merge_file(&o, &a, &b,
branch1Name, branch2Name);
@@
-1174,14
+1172,14
@@
static int process_entry(const char *path, struct stage_data *entry,
if (mfi.clean)
update_file(1, mfi.sha, mfi.mode, path);
else {
if (mfi.clean)
update_file(1, mfi.sha, mfi.mode, path);
else {
- clean
M
erge = 0;
+ clean
_m
erge = 0;
output("CONFLICT (content): Merge conflict in %s", path);
if (index_only)
update_file(0, mfi.sha, mfi.mode, path);
else
update_file_flags(mfi.sha, mfi.mode, path,
output("CONFLICT (content): Merge conflict in %s", path);
if (index_only)
update_file(0, mfi.sha, mfi.mode, path);
else
update_file_flags(mfi.sha, mfi.mode, path,
- 0 /* update
Cache */, 1 /* updateWd
*/);
+ 0 /* update
_cache */, 1 /* update_working_directory
*/);
}
} else
die("Fatal merge failure, shouldn't happen.");
}
} else
die("Fatal merge failure, shouldn't happen.");
@@
-1189,7
+1187,7
@@
static int process_entry(const char *path, struct stage_data *entry,
if (cache_dirty)
flush_cache();
if (cache_dirty)
flush_cache();
- return clean
M
erge;
+ return clean
_m
erge;
}
static int merge_trees(struct tree *head,
}
static int merge_trees(struct tree *head,
@@
-1218,8
+1216,8
@@
static int merge_trees(struct tree *head,
if (!*result) {
struct path_list *entries, *re_head, *re_merge;
int i;
if (!*result) {
struct path_list *entries, *re_head, *re_merge;
int i;
- path_list_clear(¤t
FileS
et, 1);
- path_list_clear(¤t
DirectoryS
et, 1);
+ path_list_clear(¤t
_file_s
et, 1);
+ path_list_clear(¤t
_directory_s
et, 1);
get_files_dirs(head);
get_files_dirs(merge);
get_files_dirs(head);
get_files_dirs(merge);
@@
-1265,12
+1263,12
@@
int merge(struct commit *h1,
struct commit *h2,
const char *branch1Name,
const char *branch2Name,
struct commit *h2,
const char *branch1Name,
const char *branch2Name,
- int call
D
epth /* =0 */,
+ int call
_d
epth /* =0 */,
struct commit *ancestor /* =None */,
struct commit **result)
{
struct commit_list *ca = NULL, *iter;
struct commit *ancestor /* =None */,
struct commit **result)
{
struct commit_list *ca = NULL, *iter;
- struct commit *merged
CA
;
+ struct commit *merged
_common_ancestors
;
struct tree *mrtree;
int clean;
struct tree *mrtree;
int clean;
@@
-1287,10
+1285,10
@@
int merge(struct commit *h1,
for (iter = ca; iter; iter = iter->next)
output_commit_title(iter->item);
for (iter = ca; iter; iter = iter->next)
output_commit_title(iter->item);
- merged
CA
= pop_commit(&ca);
+ merged
_common_ancestors
= pop_commit(&ca);
for (iter = ca; iter; iter = iter->next) {
for (iter = ca; iter; iter = iter->next) {
- output_indent = call
D
epth + 1;
+ output_indent = call
_d
epth + 1;
/*
* When the merge fails, the result contains files
* with conflict markers. The cleanness flag is
/*
* When the merge fails, the result contains files
* with conflict markers. The cleanness flag is
@@
-1298,19
+1296,19
@@
int merge(struct commit *h1,
* merge_trees has always overwritten it: the commited
* "conflicts" were already resolved.
*/
* merge_trees has always overwritten it: the commited
* "conflicts" were already resolved.
*/
- merge(merged
CA
, iter->item,
+ merge(merged
_common_ancestors
, iter->item,
"Temporary merge branch 1",
"Temporary merge branch 2",
"Temporary merge branch 1",
"Temporary merge branch 2",
- call
D
epth + 1,
+ call
_d
epth + 1,
NULL,
NULL,
- &merged
CA
);
- output_indent = call
D
epth;
+ &merged
_common_ancestors
);
+ output_indent = call
_d
epth;
- if (!merged
CA
)
+ if (!merged
_common_ancestors
)
die("merge returned no commit");
}
die("merge returned no commit");
}
- if (call
D
epth == 0) {
+ if (call
_d
epth == 0) {
setup_index(0 /* $GIT_DIR/index */);
index_only = 0;
} else {
setup_index(0 /* $GIT_DIR/index */);
index_only = 0;
} else {
@@
-1319,7
+1317,7
@@
int merge(struct commit *h1,
index_only = 1;
}
index_only = 1;
}
- clean = merge_trees(h1->tree, h2->tree, merged
CA
->tree,
+ clean = merge_trees(h1->tree, h2->tree, merged
_common_ancestors
->tree,
branch1Name, branch2Name, &mrtree);
if (!ancestor && (clean || index_only)) {
branch1Name, branch2Name, &mrtree);
if (!ancestor && (clean || index_only)) {