From: Michael Lukashov <michael.lukashov@gmail.com>
To: git@vger.kernel.org
Cc: Michael Lukashov <michael.lukashov@gmail.com>
Subject: [PATCH v2 4/4] Refactoring: remove duplicated code from builtin-checkout.c and merge-recursive.c
Date: Mon, 15 Feb 2010 23:26:50 +0000 [thread overview]
Message-ID: <1266276411-5796-5-git-send-email-michael.lukashov@gmail.com> (raw)
In-Reply-To: <1266276411-5796-1-git-send-email-michael.lukashov@gmail.com>
The following functions are duplicated:
fill_mm
Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
---
builtin-checkout.c | 18 ------------------
merge-recursive.c | 2 +-
merge-recursive.h | 3 +++
3 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 5277817..e53e857 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -128,24 +128,6 @@ static int checkout_stage(int stage, struct cache_entry *ce, int pos,
(stage == 2) ? "our" : "their");
}
-/* NEEDSWORK: share with merge-recursive */
-static void fill_mm(const unsigned char *sha1, mmfile_t *mm)
-{
- unsigned long size;
- enum object_type type;
-
- if (!hashcmp(sha1, null_sha1)) {
- mm->ptr = xstrdup("");
- mm->size = 0;
- return;
- }
-
- mm->ptr = read_sha1_file(sha1, &type, &size);
- if (!mm->ptr || type != OBJ_BLOB)
- die("unable to read blob object %s", sha1_to_hex(sha1));
- mm->size = size;
-}
-
static int checkout_merged(int pos, struct checkout *state)
{
struct cache_entry *ce = active_cache[pos];
diff --git a/merge-recursive.c b/merge-recursive.c
index cb53b01..5999ae2 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -599,7 +599,7 @@ struct merge_file_info
merge:1;
};
-static void fill_mm(const unsigned char *sha1, mmfile_t *mm)
+void fill_mm(const unsigned char *sha1, mmfile_t *mm)
{
unsigned long size;
enum object_type type;
diff --git a/merge-recursive.h b/merge-recursive.h
index be8410a..ccc4002 100644
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -2,6 +2,7 @@
#define MERGE_RECURSIVE_H
#include "string-list.h"
+#include "xdiff/xdiff.h"
struct merge_options {
const char *branch1;
@@ -53,4 +54,6 @@ int merge_recursive_generic(struct merge_options *o,
void init_merge_options(struct merge_options *o);
struct tree *write_tree_from_memory(struct merge_options *o);
+void fill_mm(const unsigned char *sha1, mmfile_t *mm);
+
#endif
--
1.7.0.1571.g856c2
next prev parent reply other threads:[~2010-02-15 23:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 23:26 [PATCH v2 0/4] Refactoring: remove duplicated code Michael Lukashov
2010-02-15 23:26 ` [PATCH v2 1/4] Refactoring: remove duplicated code from builtin-send-pack.c and transport.c Michael Lukashov
2010-02-16 2:16 ` Tay Ray Chuan
2010-02-16 7:29 ` Jeff King
2010-02-15 23:26 ` [PATCH v2 2/4] Refactoring: connect.c: move duplicated code to get_host_and_port Michael Lukashov
2010-02-16 4:10 ` Larry D'Anna
2010-02-15 23:26 ` [PATCH v2 3/4] Refactoring: move duplicated code from builtin-pack-objects.c and fast-import.c to object.c Michael Lukashov
2010-02-16 19:35 ` Junio C Hamano
2010-02-15 23:26 ` Michael Lukashov [this message]
2010-02-16 19:41 ` [PATCH v2 4/4] Refactoring: remove duplicated code from builtin-checkout.c and merge-recursive.c Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266276411-5796-5-git-send-email-michael.lukashov@gmail.com \
--to=michael.lukashov@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).