projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Teach git push .git/branches shorthand
[git.git]
/
apply.c
diff --git
a/apply.c
b/apply.c
index
630d6bc
..
81607c0
100644
(file)
--- a/
apply.c
+++ b/
apply.c
@@
-563,7
+563,7
@@
static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
struct fragment dummy;
if (parse_fragment_header(line, len, &dummy) < 0)
continue;
struct fragment dummy;
if (parse_fragment_header(line, len, &dummy) < 0)
continue;
- error("patch fragment without header at line %d: %.*s", linenr, len-1, line);
+ error("patch fragment without header at line %d: %.*s", linenr,
(int)
len-1, line);
}
if (size < len + 6)
}
if (size < len + 6)
@@
-737,6
+737,7
@@
static const char minuses[]= "--------------------------------------------------
static void show_stats(struct patch *patch)
{
static void show_stats(struct patch *patch)
{
+ const char *prefix = "";
char *name = patch->new_name;
int len, max, add, del, total;
char *name = patch->new_name;
int len, max, add, del, total;
@@
-750,8
+751,15
@@
static void show_stats(struct patch *patch)
max = max_len;
if (max > 50)
max = 50;
max = max_len;
if (max > 50)
max = 50;
- if (len > max)
+ if (len > max) {
+ char *slash;
+ prefix = "...";
+ max -= 3;
name += len - max;
name += len - max;
+ slash = strchr(name, '/');
+ if (slash)
+ name = slash;
+ }
len = max;
/*
len = max;
/*
@@
-770,7
+778,7
@@
static void show_stats(struct patch *patch)
add = (add * max + max_change / 2) / max_change;
del = total - add;
}
add = (add * max + max_change / 2) / max_change;
del = total - add;
}
- printf(" %
-*s |%5d %.*s%.*s\n"
,
+ printf(" %
s%-*s |%5d %.*s%.*s\n", prefix
,
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);
}
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);
}
@@
-960,7
+968,7
@@
static int apply_fragments(struct buffer_desc *desc, struct patch *patch)
while (frag) {
if (apply_one_fragment(desc, frag) < 0)
while (frag) {
if (apply_one_fragment(desc, frag) < 0)
- return error("patch failed: %s:%d", patch->old_name, frag->oldpos);
+ return error("patch failed: %s:%
l
d", patch->old_name, frag->oldpos);
frag = frag->next;
}
return 0;
frag = frag->next;
}
return 0;