Skip to content

Commit 8bb4646

Browse files
committed
Merge branch 'maint'
* maint: Fix non-literal format in printf-style calls git-submodule: Avoid printing a spurious message. git ls-remote: make usage string match manpage Makefile: help people who run 'make check' by mistake
2 parents a9645b7 + 9db56f7 commit 8bb4646

File tree

11 files changed

+24
-15
lines changed

11 files changed

+24
-15
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,16 @@ check-sha1:: test-sha1$X
13551355
./test-sha1.sh
13561356

13571357
check: common-cmds.h
1358-
for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
1358+
if sparse; \
1359+
then \
1360+
for i in *.c; \
1361+
do \
1362+
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1363+
done; \
1364+
else \
1365+
echo 2>&1 "Did you mean 'make test'?"; \
1366+
exit 1; \
1367+
fi
13591368

13601369
remove-dashes:
13611370
./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)

builtin-ls-remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "remote.h"
55

66
static const char ls_remote_usage[] =
7-
"git ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
7+
"git ls-remote [--heads] [--tags] [-u <exec> | --upload-pack <exec>] <repository> <refs>...";
88

99
/*
1010
* Is there one among the list of patterns that match the tail part

builtin-remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static int add_branch_for_removal(const char *refname,
320320

321321
/* make sure that symrefs are deleted */
322322
if (flags & REF_ISSYMREF)
323-
return unlink(git_path(refname));
323+
return unlink(git_path("%s", refname));
324324

325325
item = string_list_append(refname, branches->branches);
326326
item->util = xmalloc(20);

bundle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
114114
continue;
115115
}
116116
if (++ret == 1)
117-
error(message);
117+
error("%s", message);
118118
error("%s %s", sha1_to_hex(e->sha1), e->name);
119119
}
120120
if (revs.pending.nr != p->nr)
@@ -139,7 +139,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
139139
for (i = 0; i < req_nr; i++)
140140
if (!(refs.objects[i].item->flags & SHOWN)) {
141141
if (++ret == 1)
142-
error(message);
142+
error("%s", message);
143143
error("%s %s", sha1_to_hex(refs.objects[i].item->sha1),
144144
refs.objects[i].name);
145145
}

environment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const char *get_git_work_tree(void)
118118
work_tree = git_work_tree_cfg;
119119
/* make_absolute_path also normalizes the path */
120120
if (work_tree && !is_absolute_path(work_tree))
121-
work_tree = xstrdup(make_absolute_path(git_path(work_tree)));
121+
work_tree = xstrdup(make_absolute_path(git_path("%s", work_tree)));
122122
} else if (work_tree)
123123
work_tree = xstrdup(make_absolute_path(work_tree));
124124
git_work_tree_initialized = 1;

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
326326
die("this should not happen, your snprintf is broken");
327327
}
328328

329-
error(sb.buf);
329+
error("%s", sb.buf);
330330
strbuf_release(&sb);
331331
return 1;
332332
}

git-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ cmd_update()
323323
# Only mention uninitialized submodules when its
324324
# path have been specified
325325
test "$#" != "0" &&
326-
say "Submodule path '$path' not initialized"
326+
say "Submodule path '$path' not initialized" &&
327327
say "Maybe you want to use 'update --init'?"
328328
continue
329329
fi

grep.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
514514
if (from <= last_shown)
515515
from = last_shown + 1;
516516
if (last_shown && from != last_shown + 1)
517-
printf(hunk_mark);
517+
fputs(hunk_mark, stdout);
518518
while (from < lno) {
519519
pcl = &prev[lno-from-1];
520520
show_line(opt, pcl->bol, pcl->eol,
@@ -524,7 +524,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
524524
last_shown = lno-1;
525525
}
526526
if (last_shown && lno != last_shown + 1)
527-
printf(hunk_mark);
527+
fputs(hunk_mark, stdout);
528528
if (!opt->count)
529529
show_line(opt, bol, eol, name, lno, ':');
530530
last_shown = last_hit = lno;
@@ -535,7 +535,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
535535
* we need to show this line.
536536
*/
537537
if (last_shown && lno != last_shown + 1)
538-
printf(hunk_mark);
538+
fputs(hunk_mark, stdout);
539539
show_line(opt, bol, eol, name, lno, '-');
540540
last_shown = lno;
541541
}

path.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ char *mksnpath(char *buf, size_t n, const char *fmt, ...)
4141
len = vsnprintf(buf, n, fmt, args);
4242
va_end(args);
4343
if (len >= n) {
44-
snprintf(buf, n, bad_path);
44+
strlcpy(buf, bad_path, n);
4545
return buf;
4646
}
4747
return cleanup_path(buf);
@@ -63,7 +63,7 @@ static char *git_vsnpath(char *buf, size_t n, const char *fmt, va_list args)
6363
goto bad;
6464
return cleanup_path(buf);
6565
bad:
66-
snprintf(buf, n, bad_path);
66+
strlcpy(buf, bad_path, n);
6767
return buf;
6868
}
6969

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
940940
lock->lk->filename[i] = 0;
941941
path = lock->lk->filename;
942942
} else {
943-
path = git_path(refname);
943+
path = git_path("%s", refname);
944944
}
945945
err = unlink(path);
946946
if (err && errno != ENOENT) {

0 commit comments

Comments
 (0)