Skip to content

Commit

Permalink
Merge branch 'js/rerere'
Browse files Browse the repository at this point in the history
* js/rerere:
  Make git-rerere a builtin
  Add a test for git-rerere
  move read_mmfile() into xdiff-interface
  • Loading branch information
Junio C Hamano committed Dec 24, 2006
2 parents 9e83266 + 658f365 commit 9def213
Show file tree
Hide file tree
Showing 8 changed files with 585 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ SCRIPT_SH = \

SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \
git-rerere.perl \
git-cvsserver.perl \
git-svnimport.perl git-cvsexportcommit.perl \
git-send-email.perl git-svn.perl
Expand Down Expand Up @@ -288,6 +287,7 @@ BUILTIN_OBJS = \
builtin-push.o \
builtin-read-tree.o \
builtin-repo-config.o \
builtin-rerere.o \
builtin-rev-list.o \
builtin-rev-parse.o \
builtin-rm.o \
Expand Down
20 changes: 2 additions & 18 deletions builtin-merge-file.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#include "cache.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"

static const char merge_file_usage[] =
"git merge-file [-p | --stdout] [-q | --quiet] [-L name1 [-L orig [-L name2]]] file1 orig_file file2";

static int read_file(mmfile_t *ptr, const char *filename)
{
struct stat st;
FILE *f;

if (stat(filename, &st))
return error("Could not stat %s", filename);
if ((f = fopen(filename, "rb")) == NULL)
return error("Could not open %s", filename);
ptr->ptr = xmalloc(st.st_size);
if (fread(ptr->ptr, st.st_size, 1, f) != 1)
return error("Could not read %s", filename);
fclose(f);
ptr->size = st.st_size;
return 0;
}

int cmd_merge_file(int argc, char **argv, char **envp)
{
char *names[3];
Expand Down Expand Up @@ -53,7 +37,7 @@ int cmd_merge_file(int argc, char **argv, char **envp)
names[i] = argv[i + 1];

for (i = 0; i < 3; i++)
if (read_file(mmfs + i, argv[i + 1]))
if (read_mmfile(mmfs + i, argv[i + 1]))
return -1;

ret = xdl_merge(mmfs + 1, mmfs + 0, names[0], mmfs + 2, names[2],
Expand Down
Loading

0 comments on commit 9def213

Please sign in to comment.