@matheusbsbs / matheus-bagliano / commits / 7e44c93558
Fork 0

'git foo' program identifies itself without dash in die() messages

This is a mechanical conversion of all '*.c' files with: s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/; The result was manually inspected and no false positive was found. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 31, 2008 at 09:39 UTC 7e44c93558e7c0b12624d76cf07753d0480ed96a
15 files changed +52 -52
builtin-apply.c
+3 -3
@@ -506,17 +506,17 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
506 name = orig_name;
507 len = strlen(name);
508 if (isnull)
509 - die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
509 + die("git apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
510 another = find_name(line, NULL, p_value, TERM_TAB);
511 if (!another || memcmp(another, name, len))
512 - die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
512 + die("git apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
513 free(another);
514 return orig_name;
515 }
516 else {
517 /* expect "/dev/null" */
518 if (memcmp("/dev/null", line, 9) || line[9] != '\n')
519 - die("git-apply: bad git-diff - expected /dev/null on line %d", linenr);
519 + die("git apply: bad git-diff - expected /dev/null on line %d", linenr);
520 return NULL;
521 }
522 }
builtin-checkout-index.c
+3 -3
@@ -258,9 +258,9 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
258 const char *p;
259
260 if (all)
261 - die("git-checkout-index: don't mix '--all' and explicit filenames");
261 + die("git checkout-index: don't mix '--all' and explicit filenames");
262 if (read_from_stdin)
263 - die("git-checkout-index: don't mix '--stdin' and explicit filenames");
263 + die("git checkout-index: don't mix '--stdin' and explicit filenames");
264 p = prefix_path(prefix, prefix_length, arg);
265 checkout_file(p, prefix_length);
266 if (p < arg || p > arg + strlen(arg))
@@ -271,7 +271,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
271 struct strbuf buf, nbuf;
272
273 if (all)
274 - die("git-checkout-index: don't mix '--all' and '--stdin'");
274 + die("git checkout-index: don't mix '--all' and '--stdin'");
275
276 strbuf_init(&buf, 0);
277 strbuf_init(&nbuf, 0);
builtin-commit-tree.c
+1 -1
@@ -118,7 +118,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
118 }
119
120 if (strbuf_read(&buffer, 0, 0) < 0)
121 - die("git-commit-tree: read returned %s", strerror(errno));
121 + die("git commit-tree: read returned %s", strerror(errno));
122
123 if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1)) {
124 printf("%s\n", sha1_to_hex(commit_sha1));
builtin-fetch-pack.c
+1 -1
@@ -609,7 +609,7 @@ static struct ref *do_fetch_pack(int fd[2],
609 fprintf(stderr, "warning: no common commits\n");
610
611 if (get_pack(fd, pack_lockfile))
612 - die("git-fetch-pack: fetch failed.");
612 + die("git fetch-pack: fetch failed.");
613
614 all_done:
615 return ref;
builtin-grep.c
+1 -1
@@ -774,7 +774,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
774 /* Make sure we do not get outside of paths */
775 for (i = 0; paths[i]; i++)
776 if (strncmp(prefix, paths[i], opt.prefix_length))
777 - die("git-grep: cannot generate relative filenames containing '..'");
777 + die("git grep: cannot generate relative filenames containing '..'");
778 }
779 }
780 else if (prefix) {
builtin-ls-files.c
+3 -3
@@ -78,7 +78,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
78 int offset = prefix_offset;
79
80 if (len >= ent->len)
81 - die("git-ls-files: internal error - directory entry not superset of prefix");
81 + die("git ls-files: internal error - directory entry not superset of prefix");
82
83 if (pathspec && !pathspec_match(pathspec, ps_matched, ent->name, len))
84 return;
@@ -183,7 +183,7 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
183 int offset = prefix_offset;
184
185 if (len >= ce_namelen(ce))
186 - die("git-ls-files: internal error - cache entry not superset of prefix");
186 + die("git ls-files: internal error - cache entry not superset of prefix");
187
188 if (pathspec && !pathspec_match(pathspec, ps_matched, ce->name, len))
189 return;
@@ -319,7 +319,7 @@ static const char *verify_pathspec(const char *prefix)
319 }
320
321 if (prefix_offset > max || memcmp(prev, prefix, prefix_offset))
322 - die("git-ls-files: cannot generate relative filenames containing '..'");
322 + die("git ls-files: cannot generate relative filenames containing '..'");
323
324 prefix_len = max;
325 return max ? xmemdupz(prev, max) : NULL;
builtin-rm.c
+2 -2
@@ -221,7 +221,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
221 printf("rm '%s'\n", path);
222
223 if (remove_file_from_cache(path))
224 - die("git-rm: unable to remove %s", path);
224 + die("git rm: unable to remove %s", path);
225 }
226
227 if (show_only)
@@ -244,7 +244,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
244 continue;
245 }
246 if (!removed)
247 - die("git-rm: %s: %s", path, strerror(errno));
247 + die("git rm: %s: %s", path, strerror(errno));
248 }
249 }
250
builtin-show-ref.c
+3 -3
@@ -62,7 +62,7 @@ match:
62 * ref points at a nonexistent object.
63 */
64 if (!has_sha1_file(sha1))
65 - die("git-show-ref: bad ref %s (%s)", refname,
65 + die("git show-ref: bad ref %s (%s)", refname,
66 sha1_to_hex(sha1));
67
68 if (quiet)
@@ -82,12 +82,12 @@ match:
82 else {
83 obj = parse_object(sha1);
84 if (!obj)
85 - die("git-show-ref: bad ref %s (%s)", refname,
85 + die("git show-ref: bad ref %s (%s)", refname,
86 sha1_to_hex(sha1));
87 if (obj->type == OBJ_TAG) {
88 obj = deref_tag(obj, refname, 0);
89 if (!obj)
90 - die("git-show-ref: bad tag at ref %s (%s)", refname,
90 + die("git show-ref: bad tag at ref %s (%s)", refname,
91 sha1_to_hex(sha1));
92 hex = find_unique_abbrev(obj->sha1, abbrev);
93 printf("%s %s^{}\n", hex, refname);
builtin-tar-tree.c
+2 -2
@@ -76,7 +76,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
76
77 n = read_in_full(0, buffer, HEADERSIZE);
78 if (n < HEADERSIZE)
79 - die("git-get-tar-commit-id: read error");
79 + die("git get-tar-commit-id: read error");
80 if (header->typeflag[0] != 'g')
81 return 1;
82 if (memcmp(content, "52 comment=", 11))
@@ -84,7 +84,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
84
85 n = write_in_full(1, content + 11, 41);
86 if (n < 41)
87 - die("git-get-tar-commit-id: write error");
87 + die("git get-tar-commit-id: write error");
88
89 return 0;
90 }
builtin-update-index.c
+8 -8
@@ -262,7 +262,7 @@ static void chmod_path(int flip, const char *path)
262 report("chmod %cx '%s'", flip, path);
263 return;
264 fail:
265 - die("git-update-index: cannot chmod %cx '%s'", flip, path);
265 + die("git update-index: cannot chmod %cx '%s'", flip, path);
266 }
267
268 static void update_one(const char *path, const char *prefix, int prefix_length)
@@ -280,7 +280,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
280
281 if (force_remove) {
282 if (remove_file_from_cache(p))
283 - die("git-update-index: unable to remove %s", path);
283 + die("git update-index: unable to remove %s", path);
284 report("remove '%s'", path);
285 goto free_return;
286 }
@@ -351,7 +351,7 @@ static void read_index_info(int line_termination)
351 if (line_termination && path_name[0] == '"') {
352 strbuf_reset(&uq);
353 if (unquote_c_style(&uq, path_name, NULL)) {
354 - die("git-update-index: bad quoting of path name");
354 + die("git update-index: bad quoting of path name");
355 }
356 path_name = uq.buf;
357 }
@@ -364,7 +364,7 @@ static void read_index_info(int line_termination)
364 if (!mode) {
365 /* mode == 0 means there is no such path -- remove */
366 if (remove_file_from_cache(path_name))
367 - die("git-update-index: unable to remove %s",
367 + die("git update-index: unable to remove %s",
368 ptr);
369 }
370 else {
@@ -374,7 +374,7 @@ static void read_index_info(int line_termination)
374 */
375 ptr[-42] = ptr[-1] = 0;
376 if (add_cacheinfo(mode, sha1, path_name, stage))
377 - die("git-update-index: unable to update %s",
377 + die("git update-index: unable to update %s",
378 path_name);
379 }
380 continue;
@@ -626,12 +626,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
626 unsigned int mode;
627
628 if (i+3 >= argc)
629 - die("git-update-index: --cacheinfo <mode> <sha1> <path>");
629 + die("git update-index: --cacheinfo <mode> <sha1> <path>");
630
631 if (strtoul_ui(argv[i+1], 8, &mode) ||
632 get_sha1_hex(argv[i+2], sha1) ||
633 add_cacheinfo(mode, sha1, argv[i+3], 0))
634 - die("git-update-index: --cacheinfo"
634 + die("git update-index: --cacheinfo"
635 " cannot add %s", argv[i+3]);
636 i += 3;
637 continue;
@@ -639,7 +639,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
639 if (!strcmp(path, "--chmod=-x") ||
640 !strcmp(path, "--chmod=+x")) {
641 if (argc <= i+1)
642 - die("git-update-index: %s <path>", path);
642 + die("git update-index: %s <path>", path);
643 set_executable_bit = path[8];
644 continue;
645 }
connect.c
+2 -2
@@ -97,7 +97,7 @@ int get_ack(int fd, unsigned char *result_sha1)
97 int len = packet_read_line(fd, line, sizeof(line));
98
99 if (!len)
100 - die("git-fetch-pack: expected ACK/NAK, got EOF");
100 + die("git fetch-pack: expected ACK/NAK, got EOF");
101 if (line[len-1] == '\n')
102 line[--len] = 0;
103 if (!strcmp(line, "NAK"))
@@ -109,7 +109,7 @@ int get_ack(int fd, unsigned char *result_sha1)
109 return 1;
110 }
111 }
112 - die("git-fetch_pack: expected ACK/NAK, got '%s'", line);
112 + die("git fetch_pack: expected ACK/NAK, got '%s'", line);
113 }
114
115 int path_match(const char *path, int nr, char **match)
entry.c
+10 -10
@@ -111,7 +111,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
111 case S_IFREG:
112 new = read_blob_entry(ce, path, &size);
113 if (!new)
114 - return error("git-checkout-index: unable to read sha1 file of %s (%s)",
114 + return error("git checkout-index: unable to read sha1 file of %s (%s)",
115 path, sha1_to_hex(ce->sha1));
116
117 /*
@@ -132,7 +132,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
132 fd = create_file(path, ce->ce_mode);
133 if (fd < 0) {
134 free(new);
135 - return error("git-checkout-index: unable to create file %s (%s)",
135 + return error("git checkout-index: unable to create file %s (%s)",
136 path, strerror(errno));
137 }
138
@@ -140,12 +140,12 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
140 close(fd);
141 free(new);
142 if (wrote != size)
143 - return error("git-checkout-index: unable to write file %s", path);
143 + return error("git checkout-index: unable to write file %s", path);
144 break;
145 case S_IFLNK:
146 new = read_blob_entry(ce, path, &size);
147 if (!new)
148 - return error("git-checkout-index: unable to read sha1 file of %s (%s)",
148 + return error("git checkout-index: unable to read sha1 file of %s (%s)",
149 path, sha1_to_hex(ce->sha1));
150 if (to_tempfile || !has_symlinks) {
151 if (to_tempfile) {
@@ -155,31 +155,31 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
155 fd = create_file(path, 0666);
156 if (fd < 0) {
157 free(new);
158 - return error("git-checkout-index: unable to create "
158 + return error("git checkout-index: unable to create "
159 "file %s (%s)", path, strerror(errno));
160 }
161 wrote = write_in_full(fd, new, size);
162 close(fd);
163 free(new);
164 if (wrote != size)
165 - return error("git-checkout-index: unable to write file %s",
165 + return error("git checkout-index: unable to write file %s",
166 path);
167 } else {
168 wrote = symlink(new, path);
169 free(new);
170 if (wrote)
171 - return error("git-checkout-index: unable to create "
171 + return error("git checkout-index: unable to create "
172 "symlink %s (%s)", path, strerror(errno));
173 }
174 break;
175 case S_IFGITLINK:
176 if (to_tempfile)
177 - return error("git-checkout-index: cannot create temporary subproject %s", path);
177 + return error("git checkout-index: cannot create temporary subproject %s", path);
178 if (mkdir(path, 0777) < 0)
179 - return error("git-checkout-index: cannot create subproject directory %s", path);
179 + return error("git checkout-index: cannot create subproject directory %s", path);
180 break;
181 default:
182 - return error("git-checkout-index: unknown file mode for %s", path);
182 + return error("git checkout-index: unknown file mode for %s", path);
183 }
184
185 if (state->refresh_cache) {
merge-index.c
+3 -3
@@ -27,7 +27,7 @@ static int merge_entry(int pos, const char *path)
27 int found;
28
29 if (pos >= active_nr)
30 - die("git-merge-index: %s not in the cache", path);
30 + die("git merge-index: %s not in the cache", path);
31 arguments[0] = pgm;
32 arguments[1] = "";
33 arguments[2] = "";
@@ -53,7 +53,7 @@ static int merge_entry(int pos, const char *path)
53 arguments[stage + 4] = ownbuf[stage];
54 } while (++pos < active_nr);
55 if (!found)
56 - die("git-merge-index: %s not in the cache", path);
56 + die("git merge-index: %s not in the cache", path);
57 run_program();
58 return found;
59 }
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
117 merge_all();
118 continue;
119 }
120 - die("git-merge-index: unknown option %s", arg);
120 + die("git merge-index: unknown option %s", arg);
121 }
122 merge_file(arg);
123 }
tree-diff.c
+1 -1
@@ -303,7 +303,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru
303 update_tree_entry(t2);
304 continue;
305 }
306 - die("git-diff-tree: internal error");
306 + die("git diff-tree: internal error");
307 }
308 return 0;
309 }
upload-pack.c
+9 -9
@@ -157,7 +157,7 @@ static void create_pack_file(void)
157 /* .data is just a boolean: any non-NULL value will do */
158 rev_list.data = create_full_pack ? &rev_list : NULL;
159 if (start_async(&rev_list))
160 - die("git-upload-pack: unable to fork git-rev-list");
160 + die("git upload-pack: unable to fork git-rev-list");
161
162 argv[arg++] = "pack-objects";
163 argv[arg++] = "--stdout";
@@ -177,7 +177,7 @@ static void create_pack_file(void)
177 pack_objects.argv = argv;
178
179 if (start_command(&pack_objects))
180 - die("git-upload-pack: unable to fork git-pack-objects");
180 + die("git upload-pack: unable to fork git-pack-objects");
181
182 /* We read from pack_objects.err to capture stderr output for
183 * progress bar, and pack_objects.out to capture the pack data.
@@ -271,7 +271,7 @@ static void create_pack_file(void)
271 }
272
273 if (finish_command(&pack_objects)) {
274 - error("git-upload-pack: git-pack-objects died with error.");
274 + error("git upload-pack: git-pack-objects died with error.");
275 goto fail;
276 }
277 if (finish_async(&rev_list))
@@ -291,7 +291,7 @@ static void create_pack_file(void)
291
292 fail:
293 send_client_data(3, abort_msg, sizeof(abort_msg));
294 - die("git-upload-pack: %s", abort_msg);
294 + die("git upload-pack: %s", abort_msg);
295 }
296
297 static int got_sha1(char *hex, unsigned char *sha1)
@@ -300,7 +300,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
300 int we_knew_they_have = 0;
301
302 if (get_sha1_hex(hex, sha1))
303 - die("git-upload-pack: expected SHA1 object, got '%s'", hex);
303 + die("git upload-pack: expected SHA1 object, got '%s'", hex);
304 if (!has_sha1_file(sha1))
305 return -1;
306
@@ -440,7 +440,7 @@ static int get_common_commits(void)
440 packet_write(1, "NAK\n");
441 return -1;
442 }
443 - die("git-upload-pack: expected SHA1 list, got '%s'", line);
443 + die("git upload-pack: expected SHA1 list, got '%s'", line);
444 }
445 }
446
@@ -485,7 +485,7 @@ static void receive_needs(void)
485 }
486 if (prefixcmp(line, "want ") ||
487 get_sha1_hex(line+5, sha1_buf))
488 - die("git-upload-pack: protocol error, "
488 + die("git upload-pack: protocol error, "
489 "expected to get sha, not '%s'", line);
490 if (strstr(line+45, "multi_ack"))
491 multi_ack = 1;
@@ -512,7 +512,7 @@ static void receive_needs(void)
512 */
513 o = lookup_object(sha1_buf);
514 if (!o || !(o->flags & OUR_REF))
515 - die("git-upload-pack: not our ref %s", line+5);
515 + die("git upload-pack: not our ref %s", line+5);
516 if (!(o->flags & WANTED)) {
517 o->flags |= WANTED;
518 add_object_array(o, NULL, &want_obj);
@@ -577,7 +577,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
577 struct object *o = parse_object(sha1);
578
579 if (!o)
580 - die("git-upload-pack: cannot find object %s:", sha1_to_hex(sha1));
580 + die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
581
582 if (capabilities)
583 packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname,