Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-02 03:20:11 +0400
committerJunio C Hamano <gitster@pobox.com>2011-04-02 03:20:11 +0400
commitb46c9fafcf5450196b003ba63d32bab6c479d23a (patch)
tree6143994b332c0c5f933352a2734970e568dfcc59 /builtin
parent46a1f0728c6b5a886424e74c8bcacedf355eb918 (diff)
parent9d158601b3cb9753825e21441c88d31297b97be5 (diff)
Merge branch 'jc/maint-apply-no-double-patch' into maint
* jc/maint-apply-no-double-patch: apply: do not patch lines that were already patched
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 14951daedf..04f56f850a 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -204,6 +204,7 @@ struct line {
unsigned hash : 24;
unsigned flag : 8;
#define LINE_COMMON 1
+#define LINE_PATCHED 2
};
/*
@@ -2085,7 +2086,8 @@ static int match_fragment(struct image *img,
/* Quick hash check */
for (i = 0; i < preimage_limit; i++)
- if (preimage->line[i].hash != img->line[try_lno + i].hash)
+ if ((img->line[try_lno + i].flag & LINE_PATCHED) ||
+ (preimage->line[i].hash != img->line[try_lno + i].hash))
return 0;
if (preimage_limit == preimage->nr) {
@@ -2428,6 +2430,9 @@ static void update_image(struct image *img,
memcpy(img->line + applied_pos,
postimage->line,
postimage->nr * sizeof(*img->line));
+ for (i = 0; i < postimage->nr; i++)
+ img->line[applied_pos + i].flag |= LINE_PATCHED;
+
img->nr = nr;
}