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>maint
parent
fbe0b24ca5
commit
e2b7008752
|
@ -60,6 +60,7 @@ git-mailsplit
|
||||||
git-merge
|
git-merge
|
||||||
git-merge-base
|
git-merge-base
|
||||||
git-merge-index
|
git-merge-index
|
||||||
|
git-merge-file
|
||||||
git-merge-tree
|
git-merge-tree
|
||||||
git-merge-octopus
|
git-merge-octopus
|
||||||
git-merge-one-file
|
git-merge-one-file
|
||||||
|
|
|
@ -40,8 +40,8 @@ If "git-merge-index" is called with multiple <file>s (or -a) then it
|
||||||
processes them in turn only stopping if merge returns a non-zero exit
|
processes them in turn only stopping if merge returns a non-zero exit
|
||||||
code.
|
code.
|
||||||
|
|
||||||
Typically this is run with the a script calling the merge command from
|
Typically this is run with the a script calling git's imitation of
|
||||||
the RCS package.
|
the merge command from the RCS package.
|
||||||
|
|
||||||
A sample script called "git-merge-one-file" is included in the
|
A sample script called "git-merge-one-file" is included in the
|
||||||
distribution.
|
distribution.
|
||||||
|
|
9
INSTALL
9
INSTALL
|
@ -82,15 +82,6 @@ Issues of note:
|
||||||
do that even if it wasn't for git. There's no point in living
|
do that even if it wasn't for git. There's no point in living
|
||||||
in the dark ages any more.
|
in the dark ages any more.
|
||||||
|
|
||||||
- "merge", the standard UNIX three-way merge program. It usually
|
|
||||||
comes with the "rcs" package on most Linux distributions, so if
|
|
||||||
you have a developer install you probably have it already, but a
|
|
||||||
"graphical user desktop" install might have left it out.
|
|
||||||
|
|
||||||
You'll only need the merge program if you do development using
|
|
||||||
git, and if you only use git to track other peoples work you'll
|
|
||||||
never notice the lack of it.
|
|
||||||
|
|
||||||
- "wish", the Tcl/Tk windowing shell is used in gitk to show the
|
- "wish", the Tcl/Tk windowing shell is used in gitk to show the
|
||||||
history graphically
|
history graphically
|
||||||
|
|
||||||
|
|
|
@ -945,7 +945,7 @@ sub req_update
|
||||||
|
|
||||||
$log->debug("Temporary directory for merge is $dir");
|
$log->debug("Temporary directory for merge is $dir");
|
||||||
|
|
||||||
my $return = system("merge", $file_local, $file_old, $file_new);
|
my $return = system("git merge-file", $file_local, $file_old, $file_new);
|
||||||
$return >>= 8;
|
$return >>= 8;
|
||||||
|
|
||||||
if ( $return == 0 )
|
if ( $return == 0 )
|
||||||
|
|
|
@ -154,7 +154,7 @@ sub find_conflict {
|
||||||
sub merge {
|
sub merge {
|
||||||
my ($name, $path) = @_;
|
my ($name, $path) = @_;
|
||||||
record_preimage($path, "$rr_dir/$name/thisimage");
|
record_preimage($path, "$rr_dir/$name/thisimage");
|
||||||
unless (system('merge', map { "$rr_dir/$name/${_}image" }
|
unless (system('git merge-file', map { "$rr_dir/$name/${_}image" }
|
||||||
qw(this pre post))) {
|
qw(this pre post))) {
|
||||||
my $in;
|
my $in;
|
||||||
open $in, "<$rr_dir/$name/thisimage" or
|
open $in, "<$rr_dir/$name/thisimage" or
|
||||||
|
|
|
@ -24,7 +24,7 @@ This is a dummy package which brings in all subpackages.
|
||||||
%package core
|
%package core
|
||||||
Summary: Core git tools
|
Summary: Core git tools
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
Requires: zlib >= 1.2, rsync, rcs, curl, less, openssh-clients, expat
|
Requires: zlib >= 1.2, rsync, curl, less, openssh-clients, expat
|
||||||
%description core
|
%description core
|
||||||
This is a stupid (but extremely fast) directory content manager. It
|
This is a stupid (but extremely fast) directory content manager. It
|
||||||
doesn't do a whole lot, but what it _does_ do is track directory
|
doesn't do a whole lot, but what it _does_ do is track directory
|
||||||
|
|
73
merge-file.c
73
merge-file.c
|
@ -3,52 +3,6 @@
|
||||||
#include "xdiff-interface.h"
|
#include "xdiff-interface.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
|
|
||||||
static void rm_temp_file(const char *filename)
|
|
||||||
{
|
|
||||||
unlink(filename);
|
|
||||||
free((void *)filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *write_temp_file(mmfile_t *f)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
const char *tmp = getenv("TMPDIR");
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
if (!tmp)
|
|
||||||
tmp = "/tmp";
|
|
||||||
filename = mkpath("%s/%s", tmp, "git-tmp-XXXXXX");
|
|
||||||
fd = mkstemp(filename);
|
|
||||||
if (fd < 0)
|
|
||||||
return NULL;
|
|
||||||
filename = xstrdup(filename);
|
|
||||||
if (f->size != xwrite(fd, f->ptr, f->size)) {
|
|
||||||
rm_temp_file(filename);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *read_temp_file(const char *filename, unsigned long *size)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
char *buf = NULL;
|
|
||||||
int fd = open(filename, O_RDONLY);
|
|
||||||
if (fd < 0)
|
|
||||||
return NULL;
|
|
||||||
if (!fstat(fd, &st)) {
|
|
||||||
*size = st.st_size;
|
|
||||||
buf = xmalloc(st.st_size);
|
|
||||||
if (st.st_size != xread(fd, buf, st.st_size)) {
|
|
||||||
free(buf);
|
|
||||||
buf = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
|
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
|
||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -72,22 +26,19 @@ static void free_mmfile(mmfile_t *f)
|
||||||
|
|
||||||
static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
|
static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
|
||||||
{
|
{
|
||||||
void *res;
|
mmbuffer_t res;
|
||||||
const char *t1, *t2, *t3;
|
xpparam_t xpp;
|
||||||
|
int merge_status;
|
||||||
|
|
||||||
t1 = write_temp_file(base);
|
memset(&xpp, 0, sizeof(xpp));
|
||||||
t2 = write_temp_file(our);
|
merge_status = xdl_merge(base, our, ".our", their, ".their",
|
||||||
t3 = write_temp_file(their);
|
&xpp, XDL_MERGE_ZEALOUS, &res);
|
||||||
res = NULL;
|
|
||||||
if (t1 && t2 && t3) {
|
if (merge_status < 0)
|
||||||
int code = run_command("merge", t2, t1, t3, NULL);
|
return NULL;
|
||||||
if (!code || code == -1)
|
|
||||||
res = read_temp_file(t2, size);
|
*size = res.size;
|
||||||
}
|
return res.ptr;
|
||||||
rm_temp_file(t1);
|
|
||||||
rm_temp_file(t2);
|
|
||||||
rm_temp_file(t3);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int common_outf(void *priv_, mmbuffer_t *mb, int nbuf)
|
static int common_outf(void *priv_, mmbuffer_t *mb, int nbuf)
|
||||||
|
|
|
@ -19,11 +19,7 @@ modification *should* take notice and update the test vectors here.
|
||||||
'
|
'
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# It appears that people are getting bitten by not installing
|
# It appears that people try to run tests without building...
|
||||||
# 'merge' (usually part of RCS package in binary distributions).
|
|
||||||
# Check this and error out before running any tests. Also catch
|
|
||||||
# the bogosity of trying to run tests without building while we
|
|
||||||
# are at it.
|
|
||||||
|
|
||||||
../git >/dev/null
|
../git >/dev/null
|
||||||
if test $? != 1
|
if test $? != 1
|
||||||
|
@ -32,14 +28,6 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
merge >/dev/null 2>/dev/null
|
|
||||||
if test $? = 127
|
|
||||||
then
|
|
||||||
echo >&2 'You do not seem to have "merge" installed.
|
|
||||||
Please check INSTALL document.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
|
Loading…
Reference in New Issue