Skip to content

Commit fb674d7

Browse files
committed
Merge branch 'maint'
* maint: git-submodule.sh: separate parens by a space to avoid confusing some shells Documentation/technical/api-diff.txt: correct name of diff_unmerge() read_gitfile_gently: use ssize_t to hold read result remove tests of always-false condition rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
2 parents be653d6 + 5b42477 commit fb674d7

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

Documentation/technical/api-diff.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Calling sequence
3232

3333
* As you find different pairs of files, call `diff_change()` to feed
3434
modified files, `diff_addremove()` to feed created or deleted files,
35-
or `diff_unmerged()` to feed a file whose state is 'unmerged' to the
35+
or `diff_unmerge()` to feed a file whose state is 'unmerged' to the
3636
API. These are thin wrappers to a lower-level `diff_queue()` function
3737
that is flexible enough to record any of these kinds of changes.
3838

@@ -50,7 +50,7 @@ Data structures
5050
This is the internal representation for a single file (blob). It
5151
records the blob object name (if known -- for a work tree file it
5252
typically is a NUL SHA-1), filemode and pathname. This is what the
53-
`diff_addremove()`, `diff_change()` and `diff_unmerged()` synthesize and
53+
`diff_addremove()`, `diff_change()` and `diff_unmerge()` synthesize and
5454
feed `diff_queue()` function with.
5555

5656
* `struct diff_filepair`

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
349349
va_list ap;
350350
struct strbuf sb = STRBUF_INIT;
351351

352-
strbuf_addf(&sb, "object %s:", obj->sha1?sha1_to_hex(obj->sha1):"(null)");
352+
strbuf_addf(&sb, "object %s:", sha1_to_hex(obj->sha1));
353353

354354
va_start(ap, fmt);
355355
strbuf_vaddf(&sb, fmt, ap);

git-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ cmd_update()
495495
# Run fetch only if $sha1 isn't present or it
496496
# is not reachable from a ref.
497497
(clear_local_git_env; cd "$path" &&
498-
((rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
498+
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
499499
test -z "$rev") || git-fetch)) ||
500500
die "Unable to fetch in submodule path '$path'"
501501
fi

rerere.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ static void read_rr(struct string_list *rr)
4747
name = xstrdup(buf);
4848
if (fgetc(in) != '\t')
4949
die("corrupt MERGE_RR");
50-
for (i = 0; i < sizeof(buf) && (buf[i] = fgetc(in)); i++)
51-
; /* do nothing */
50+
for (i = 0; i < sizeof(buf); i++) {
51+
int c = fgetc(in);
52+
if (c < 0)
53+
die("corrupt MERGE_RR");
54+
buf[i] = c;
55+
if (c == 0)
56+
break;
57+
}
5258
if (i == sizeof(buf))
5359
die("filename too long");
5460
string_list_insert(rr, buf)->util = name;

setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ const char *read_gitfile_gently(const char *path)
382382
const char *slash;
383383
struct stat st;
384384
int fd;
385-
size_t len;
385+
ssize_t len;
386386

387387
if (stat(path, &st))
388388
return NULL;

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
156156
continue;
157157
if (!ref->peer_ref)
158158
continue;
159-
if (!ref->new_sha1 || is_null_sha1(ref->new_sha1))
159+
if (is_null_sha1(ref->new_sha1))
160160
continue;
161161

162162
/* Follow symbolic refs (mainly for HEAD). */

0 commit comments

Comments
 (0)