Merge branch 'master'
* master: rev-list: default to abbreviate merge parent names under --pretty. delta micro optimization count-delta.c: comment fixes Merge branch 'jc/empty-commit'
This commit is contained in:
commit
b82b0082db
@ -16,11 +16,7 @@
|
|||||||
*
|
*
|
||||||
* Number of bytes that are _not_ copied from the source is deletion,
|
* Number of bytes that are _not_ copied from the source is deletion,
|
||||||
* and number of inserted literal bytes are addition, so sum of them
|
* and number of inserted literal bytes are addition, so sum of them
|
||||||
* is the extent of damage. xdelta can express an edit that copies
|
* is the extent of damage.
|
||||||
* data inside of the destination which originally came from the
|
|
||||||
* source. We do not count that in the following routine, so we are
|
|
||||||
* undercounting the source material that remains in the final output
|
|
||||||
* that way.
|
|
||||||
*/
|
*/
|
||||||
int count_delta(void *delta_buf, unsigned long delta_size,
|
int count_delta(void *delta_buf, unsigned long delta_size,
|
||||||
unsigned long *src_copied, unsigned long *literal_added)
|
unsigned long *src_copied, unsigned long *literal_added)
|
||||||
|
10
delta.h
10
delta.h
@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
|
|||||||
static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
|
static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
|
||||||
{
|
{
|
||||||
const unsigned char *data = *datap;
|
const unsigned char *data = *datap;
|
||||||
unsigned char cmd = *data++;
|
unsigned char cmd;
|
||||||
unsigned long size = cmd & ~0x80;
|
unsigned long size = 0;
|
||||||
int i = 7;
|
int i = 0;
|
||||||
while (cmd & 0x80) {
|
do {
|
||||||
cmd = *data++;
|
cmd = *data++;
|
||||||
size |= (cmd & ~0x80) << i;
|
size |= (cmd & ~0x80) << i;
|
||||||
i += 7;
|
i += 7;
|
||||||
}
|
} while (cmd & 0x80);
|
||||||
*datap = data;
|
*datap = data;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
16
rev-list.c
16
rev-list.c
@ -32,6 +32,7 @@ static const char rev_list_usage[] =
|
|||||||
" --objects\n"
|
" --objects\n"
|
||||||
" --unpacked\n"
|
" --unpacked\n"
|
||||||
" --header | --pretty\n"
|
" --header | --pretty\n"
|
||||||
|
" --abbrev=nr | --no-abbrev\n"
|
||||||
" special purpose:\n"
|
" special purpose:\n"
|
||||||
" --bisect"
|
" --bisect"
|
||||||
;
|
;
|
||||||
@ -43,6 +44,7 @@ static int tag_objects = 0;
|
|||||||
static int tree_objects = 0;
|
static int tree_objects = 0;
|
||||||
static int blob_objects = 0;
|
static int blob_objects = 0;
|
||||||
static int verbose_header = 0;
|
static int verbose_header = 0;
|
||||||
|
static int abbrev = DEFAULT_ABBREV;
|
||||||
static int show_parents = 0;
|
static int show_parents = 0;
|
||||||
static int hdr_termination = 0;
|
static int hdr_termination = 0;
|
||||||
static const char *commit_prefix = "";
|
static const char *commit_prefix = "";
|
||||||
@ -96,7 +98,7 @@ static void show_commit(struct commit *commit)
|
|||||||
|
|
||||||
if (verbose_header) {
|
if (verbose_header) {
|
||||||
static char pretty_header[16384];
|
static char pretty_header[16384];
|
||||||
pretty_print_commit(commit_format, commit, ~0, pretty_header, sizeof(pretty_header), 0);
|
pretty_print_commit(commit_format, commit, ~0, pretty_header, sizeof(pretty_header), abbrev);
|
||||||
printf("%s%c", pretty_header, hdr_termination);
|
printf("%s%c", pretty_header, hdr_termination);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -795,6 +797,18 @@ int main(int argc, const char **argv)
|
|||||||
verbose_header = 1;
|
verbose_header = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--no-abbrev")) {
|
||||||
|
abbrev = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strncmp(arg, "--abbrev=", 9)) {
|
||||||
|
abbrev = strtoul(arg + 9, NULL, 10);
|
||||||
|
if (abbrev && abbrev < MINIMUM_ABBREV)
|
||||||
|
abbrev = MINIMUM_ABBREV;
|
||||||
|
else if (40 < abbrev)
|
||||||
|
abbrev = 40;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strncmp(arg, "--pretty", 8)) {
|
if (!strncmp(arg, "--pretty", 8)) {
|
||||||
commit_format = get_commit_format(arg+8);
|
commit_format = get_commit_format(arg+8);
|
||||||
verbose_header = 1;
|
verbose_header = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user