Skip to content

Commit 8ff8eea

Browse files
author
Junio C Hamano
committed
Merge branch 'jc/revlist' into next
* jc/revlist: rev-list --timestamp git-apply: do not barf when updating an originally empty file. http-push.c: squelch C90 warnings. fix field width/precision warnings in blame.c
2 parents ac5a851 + dc68c4f commit 8ff8eea

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
834834
patch->new_name = NULL;
835835
}
836836

837-
if (patch->is_new != !oldlines)
837+
if (patch->is_new && oldlines)
838838
return error("new file depends on old contents");
839839
if (patch->is_delete != !newlines) {
840840
if (newlines)

blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ int main(int argc, const char **argv)
748748
struct commit_info ci;
749749
const char *buf;
750750
int max_digits;
751-
size_t longest_file, longest_author;
751+
int longest_file, longest_author;
752752
int found_rename;
753753

754754
const char* prefix = setup_git_directory();

http-push.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,7 @@ static void one_remote_ref(char *refname)
18631863
struct ref *ref;
18641864
unsigned char remote_sha1[20];
18651865
struct object *obj;
1866+
int len = strlen(refname) + 1;
18661867

18671868
if (fetch_ref(refname, remote_sha1) != 0) {
18681869
fprintf(stderr,
@@ -1884,7 +1885,6 @@ static void one_remote_ref(char *refname)
18841885
}
18851886
}
18861887

1887-
int len = strlen(refname) + 1;
18881888
ref = xcalloc(1, sizeof(*ref) + len);
18891889
memcpy(ref->old_sha1, remote_sha1, 20);
18901890
memcpy(ref->name, refname, len);
@@ -2313,6 +2313,8 @@ int main(int argc, char **argv)
23132313
int objects_to_send;
23142314
int rc = 0;
23152315
int i;
2316+
int new_refs;
2317+
struct ref *ref;
23162318

23172319
setup_git_directory();
23182320
setup_ident();
@@ -2347,8 +2349,8 @@ int main(int argc, char **argv)
23472349
}
23482350
}
23492351
if (!remote->url) {
2350-
remote->url = arg;
23512352
char *path = strstr(arg, "//");
2353+
remote->url = arg;
23522354
if (path) {
23532355
path = index(path+2, '/');
23542356
if (path)
@@ -2421,10 +2423,13 @@ int main(int argc, char **argv)
24212423
return 0;
24222424
}
24232425

2424-
int new_refs = 0;
2425-
struct ref *ref;
2426+
new_refs = 0;
24262427
for (ref = remote_refs; ref; ref = ref->next) {
24272428
char old_hex[60], *new_hex;
2429+
const char *commit_argv[4];
2430+
int commit_argc;
2431+
char *new_sha1_hex, *old_sha1_hex;
2432+
24282433
if (!ref->peer_ref)
24292434
continue;
24302435
if (!memcmp(ref->old_sha1, ref->peer_ref->new_sha1, 20)) {
@@ -2482,10 +2487,9 @@ int main(int argc, char **argv)
24822487
}
24832488

24842489
/* Set up revision info for this refspec */
2485-
const char *commit_argv[4];
2486-
int commit_argc = 3;
2487-
char *new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
2488-
char *old_sha1_hex = NULL;
2490+
commit_argc = 3;
2491+
new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
2492+
old_sha1_hex = NULL;
24892493
commit_argv[1] = "--objects";
24902494
commit_argv[2] = new_sha1_hex;
24912495
if (!push_all && !is_zero_sha1(ref->old_sha1)) {

rev-list.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ static int bisect_list = 0;
4040
static int verbose_header = 0;
4141
static int abbrev = DEFAULT_ABBREV;
4242
static int show_parents = 0;
43+
static int show_timestamp = 0;
4344
static int hdr_termination = 0;
4445
static const char *commit_prefix = "";
4546
static enum cmit_fmt commit_format = CMIT_FMT_RAW;
4647

4748
static void show_commit(struct commit *commit)
4849
{
49-
printf("%s%s", commit_prefix, sha1_to_hex(commit->object.sha1));
50+
if (show_timestamp)
51+
printf("%lu ", commit->date);
52+
if (commit_prefix[0])
53+
fputs(commit_prefix, stdout);
54+
fputs(sha1_to_hex(commit->object.sha1), stdout);
5055
if (show_parents) {
5156
struct commit_list *parents = commit->parents;
5257
while (parents) {
@@ -335,6 +340,10 @@ int main(int argc, const char **argv)
335340
show_parents = 1;
336341
continue;
337342
}
343+
if (!strcmp(arg, "--timestamp")) {
344+
show_timestamp = 1;
345+
continue;
346+
}
338347
if (!strcmp(arg, "--bisect")) {
339348
bisect_list = 1;
340349
continue;

0 commit comments

Comments
 (0)