From 912f9980d233961c48a225cce2657f165c98c8ae Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 11 Nov 2008 13:12:17 -0800 Subject: Makefile: help people who run 'make check' by mistake The target to run self test is 'make test', but there are people who try 'make check' and worse yet do not have sparse installed. Suggest 'make test' target when they do not have 'sparse'. Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index becd008..186a8ef 100644 --- a/Makefile +++ b/Makefile @@ -1329,7 +1329,16 @@ check-sha1:: test-sha1$X ./test-sha1.sh check: common-cmds.h - for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done + if sparse; \ + then \ + for i in *.c; \ + do \ + sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ + done; \ + else \ + echo 2>&1 "Did you mean 'make test'?"; \ + exit 1; \ + fi remove-dashes: ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) -- cgit v0.10.2-6-g49f6 From 0a2bb55848c031f431d8507d0083247ece126b8f Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Tue, 11 Nov 2008 16:52:31 +0100 Subject: git ls-remote: make usage string match manpage The usage string of 'git ls-remote' is pretty terse. The manpage however gives the correct 'synopsis'. Signed-off-by: Stefan Naewe Signed-off-by: Junio C Hamano diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c index c21b841..78a88f7 100644 --- a/builtin-ls-remote.c +++ b/builtin-ls-remote.c @@ -4,7 +4,7 @@ #include "remote.h" static const char ls_remote_usage[] = -"git ls-remote [--upload-pack=] [:]"; +"git ls-remote [--heads] [--tags] [-u | --upload-pack ] ..."; /* * Is there one among the list of patterns that match the tail part -- cgit v0.10.2-6-g49f6 From 989206f535dcd0f43356ad38e1d54cb833d96fc2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 11 Nov 2008 22:09:16 +0100 Subject: git-submodule: Avoid printing a spurious message. Fix 'git submodule update' to avoid printing a spurious "Maybe you want to use 'update --init'?" once for every uninitialized submodule it encounters. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano diff --git a/git-submodule.sh b/git-submodule.sh index 5888735..97e4d9a 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -294,7 +294,7 @@ cmd_update() # Only mention uninitialized submodules when its # path have been specified test "$#" != "0" && - say "Submodule path '$path' not initialized" + say "Submodule path '$path' not initialized" && say "Maybe you want to use 'update --init'?" continue fi -- cgit v0.10.2-6-g49f6 From 9db56f71b91153f4076a796c80c61f00edd8b700 Mon Sep 17 00:00:00 2001 From: Daniel Lowe Date: Mon, 10 Nov 2008 16:07:52 -0500 Subject: Fix non-literal format in printf-style calls These were found using gcc 4.3.2-1ubuntu11 with the warning: warning: format not a string literal and no format arguments Incorporated suggestions from Brandon Casey . Signed-off-by: Junio C Hamano diff --git a/builtin-remote.c b/builtin-remote.c index 584280f..5af4e64 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -323,7 +323,7 @@ static int add_branch_for_removal(const char *refname, /* make sure that symrefs are deleted */ if (flags & REF_ISSYMREF) - return unlink(git_path(refname)); + return unlink(git_path("%s", refname)); item = string_list_append(refname, branches->branches); item->util = xmalloc(20); diff --git a/bundle.c b/bundle.c index 7d17a1f..daecd8e 100644 --- a/bundle.c +++ b/bundle.c @@ -114,7 +114,7 @@ int verify_bundle(struct bundle_header *header, int verbose) continue; } if (++ret == 1) - error(message); + error("%s", message); error("%s %s", sha1_to_hex(e->sha1), e->name); } if (revs.pending.nr != p->nr) @@ -139,7 +139,7 @@ int verify_bundle(struct bundle_header *header, int verbose) for (i = 0; i < req_nr; i++) if (!(refs.objects[i].item->flags & SHOWN)) { if (++ret == 1) - error(message); + error("%s", message); error("%s %s", sha1_to_hex(refs.objects[i].item->sha1), refs.objects[i].name); } diff --git a/environment.c b/environment.c index df4f03a..9ebf485 100644 --- a/environment.c +++ b/environment.c @@ -113,7 +113,7 @@ const char *get_git_work_tree(void) work_tree = git_work_tree_cfg; /* make_absolute_path also normalizes the path */ if (work_tree && !is_absolute_path(work_tree)) - work_tree = xstrdup(make_absolute_path(git_path(work_tree))); + work_tree = xstrdup(make_absolute_path(git_path("%s", work_tree))); } else if (work_tree) work_tree = xstrdup(make_absolute_path(work_tree)); git_work_tree_initialized = 1; diff --git a/fsck.c b/fsck.c index 797e317..ab64c18 100644 --- a/fsck.c +++ b/fsck.c @@ -327,7 +327,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...) die("this should not happen, your snprintf is broken"); } - error(sb.buf); + error("%s", sb.buf); strbuf_release(&sb); return 1; } diff --git a/grep.c b/grep.c index 7063511..13c18ff 100644 --- a/grep.c +++ b/grep.c @@ -507,7 +507,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, if (from <= last_shown) from = last_shown + 1; if (last_shown && from != last_shown + 1) - printf(hunk_mark); + fputs(hunk_mark, stdout); while (from < lno) { pcl = &prev[lno-from-1]; show_line(opt, pcl->bol, pcl->eol, @@ -517,7 +517,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, last_shown = lno-1; } if (last_shown && lno != last_shown + 1) - printf(hunk_mark); + fputs(hunk_mark, stdout); if (!opt->count) show_line(opt, bol, eol, name, lno, ':'); last_shown = last_hit = lno; @@ -528,7 +528,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, * we need to show this line. */ if (last_shown && lno != last_shown + 1) - printf(hunk_mark); + fputs(hunk_mark, stdout); show_line(opt, bol, eol, name, lno, '-'); last_shown = lno; } diff --git a/path.c b/path.c index eb24017..a074aea 100644 --- a/path.c +++ b/path.c @@ -41,7 +41,7 @@ char *mksnpath(char *buf, size_t n, const char *fmt, ...) len = vsnprintf(buf, n, fmt, args); va_end(args); if (len >= n) { - snprintf(buf, n, bad_path); + strlcpy(buf, bad_path, n); return buf; } return cleanup_path(buf); @@ -63,7 +63,7 @@ static char *git_vsnpath(char *buf, size_t n, const char *fmt, va_list args) goto bad; return cleanup_path(buf); bad: - snprintf(buf, n, bad_path); + strlcpy(buf, bad_path, n); return buf; } diff --git a/refs.c b/refs.c index 293389e..be095cb 100644 --- a/refs.c +++ b/refs.c @@ -934,7 +934,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt) lock->lk->filename[i] = 0; path = lock->lk->filename; } else { - path = git_path(refname); + path = git_path("%s", refname); } err = unlink(path); if (err && errno != ENOENT) { diff --git a/unpack-trees.c b/unpack-trees.c index e5749ef..54f301d 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -352,7 +352,7 @@ static int unpack_failed(struct unpack_trees_options *o, const char *message) discard_index(&o->result); if (!o->gently) { if (message) - return error(message); + return error("%s", message); return -1; } return -1; -- cgit v0.10.2-6-g49f6