Get rid of the dependency on RCS' merge program
Now that we have git-merge-file, an RCS merge lookalike, we no longer need it. So long, merge, and thanks for all the fish! Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Dec 13, 2006 at 00:01 UTC
e2b7008752d85874919ea718d098fec01b4a9019
8 files changed
+20
-89
.gitignore
+1
@@ -60,6 +60,7 @@ git-mailsplit
60
git-merge
61
git-merge-base
62
git-merge-index
63
+git-merge-file
64
git-merge-tree
65
git-merge-octopus
66
git-merge-one-file
Documentation/git-merge-index.txt
+2
-2
@@ -40,8 +40,8 @@ If "git-merge-index" is called with multiple <file>s (or -a) then it
40
processes them in turn only stopping if merge returns a non-zero exit
41
code.
42
43
-Typically this is run with the a script calling the merge command from
44
-the RCS package.
43
+Typically this is run with the a script calling git's imitation of
44
+the merge command from the RCS package.
45
46
A sample script called "git-merge-one-file" is included in the
47
distribution.
INSTALL
-9
@@ -82,15 +82,6 @@ Issues of note:
82
do that even if it wasn't for git. There's no point in living
83
in the dark ages any more.
84
85
- - "merge", the standard UNIX three-way merge program. It usually
86
- comes with the "rcs" package on most Linux distributions, so if
87
- you have a developer install you probably have it already, but a
88
- "graphical user desktop" install might have left it out.
89
-
90
- You'll only need the merge program if you do development using
91
- git, and if you only use git to track other peoples work you'll
92
- never notice the lack of it.
93
-
85
- "wish", the Tcl/Tk windowing shell is used in gitk to show the
86
history graphically
87
git-cvsserver.perl
+1
-1
@@ -945,7 +945,7 @@ sub req_update
945
946
$log->debug("Temporary directory for merge is $dir");
947
948
- my $return = system("merge", $file_local, $file_old, $file_new);
948
+ my $return = system("git merge-file", $file_local, $file_old, $file_new);
949
$return >>= 8;
950
951
if ( $return == 0 )
git-rerere.perl
+1
-1
@@ -154,7 +154,7 @@ sub find_conflict {
154
sub merge {
155
my ($name, $path) = @_;
156
record_preimage($path, "$rr_dir/$name/thisimage");
157
- unless (system('merge', map { "$rr_dir/$name/${_}image" }
157
+ unless (system('git merge-file', map { "$rr_dir/$name/${_}image" }
158
qw(this pre post))) {
159
my $in;
160
open $in, "<$rr_dir/$name/thisimage" or
git.spec.in
+1
-1
@@ -24,7 +24,7 @@ This is a dummy package which brings in all subpackages.
24
%package core
25
Summary: Core git tools
26
Group: Development/Tools
27
-Requires: zlib >= 1.2, rsync, rcs, curl, less, openssh-clients, expat
27
+Requires: zlib >= 1.2, rsync, curl, less, openssh-clients, expat
28
%description core
29
This is a stupid (but extremely fast) directory content manager. It
30
doesn't do a whole lot, but what it _does_ do is track directory
merge-file.c
+13
-62
@@ -3,52 +3,6 @@
3
#include "xdiff-interface.h"
4
#include "blob.h"
5
6
-static void rm_temp_file(const char *filename)
7
-{
8
- unlink(filename);
9
- free((void *)filename);
10
-}
11
-
12
-static const char *write_temp_file(mmfile_t *f)
13
-{
14
- int fd;
15
- const char *tmp = getenv("TMPDIR");
16
- char *filename;
17
-
18
- if (!tmp)
19
- tmp = "/tmp";
20
- filename = mkpath("%s/%s", tmp, "git-tmp-XXXXXX");
21
- fd = mkstemp(filename);
22
- if (fd < 0)
23
- return NULL;
24
- filename = xstrdup(filename);
25
- if (f->size != xwrite(fd, f->ptr, f->size)) {
26
- rm_temp_file(filename);
27
- return NULL;
28
- }
29
- close(fd);
30
- return filename;
31
-}
32
-
33
-static void *read_temp_file(const char *filename, unsigned long *size)
34
-{
35
- struct stat st;
36
- char *buf = NULL;
37
- int fd = open(filename, O_RDONLY);
38
- if (fd < 0)
39
- return NULL;
40
- if (!fstat(fd, &st)) {
41
- *size = st.st_size;
42
- buf = xmalloc(st.st_size);
43
- if (st.st_size != xread(fd, buf, st.st_size)) {
44
- free(buf);
45
- buf = NULL;
46
- }
47
- }
48
- close(fd);
49
- return buf;
50
-}
51
-
6
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
7
{
8
void *buf;
@@ -72,22 +26,19 @@ static void free_mmfile(mmfile_t *f)
26
27
static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
28
{
75
- void *res;
76
- const char *t1, *t2, *t3;
77
-
78
- t1 = write_temp_file(base);
79
- t2 = write_temp_file(our);
80
- t3 = write_temp_file(their);
81
- res = NULL;
82
- if (t1 && t2 && t3) {
83
- int code = run_command("merge", t2, t1, t3, NULL);
84
- if (!code || code == -1)
85
- res = read_temp_file(t2, size);
86
- }
87
- rm_temp_file(t1);
88
- rm_temp_file(t2);
89
- rm_temp_file(t3);
90
- return res;
29
+ mmbuffer_t res;
30
+ xpparam_t xpp;
31
+ int merge_status;
32
+
33
+ memset(&xpp, 0, sizeof(xpp));
34
+ merge_status = xdl_merge(base, our, ".our", their, ".their",
35
+ &xpp, XDL_MERGE_ZEALOUS, &res);
36
+
37
+ if (merge_status < 0)
38
+ return NULL;
39
+
40
+ *size = res.size;
41
+ return res.ptr;
42
}
43
44
static int common_outf(void *priv_, mmbuffer_t *mb, int nbuf)
t/t0000-basic.sh
+1
-13
@@ -19,11 +19,7 @@ modification *should* take notice and update the test vectors here.
19
'
20
21
################################################################
22
-# It appears that people are getting bitten by not installing
23
-# 'merge' (usually part of RCS package in binary distributions).
24
-# Check this and error out before running any tests. Also catch
25
-# the bogosity of trying to run tests without building while we
26
-# are at it.
22
+# It appears that people try to run tests without building...
23
24
../git >/dev/null
25
if test $? != 1
@@ -32,14 +28,6 @@ then
28
exit 1
29
fi
30
35
-merge >/dev/null 2>/dev/null
36
-if test $? = 127
37
-then
38
- echo >&2 'You do not seem to have "merge" installed.
39
-Please check INSTALL document.'
40
- exit 1
41
-fi
42
-
31
. ./test-lib.sh
32
33
################################################################