Bug Summary

File:builtin/write-tree.c
Location:line 37, column 2
Description:Value stored to 'argc' is never read

Annotated Source Code

1/*
2 * GIT - The information manager from hell
3 *
4 * Copyright (C) Linus Torvalds, 2005
5 */
6#include "builtin.h"
7#include "cache.h"
8#include "tree.h"
9#include "cache-tree.h"
10#include "parse-options.h"
11
12static const char * const write_tree_usage[] = {
13 N_("git write-tree [--missing-ok] [--prefix=<prefix>/]")("git write-tree [--missing-ok] [--prefix=<prefix>/]"),
14 NULL((void*)0)
15};
16
17int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
18{
19 int flags = 0, ret;
20 const char *prefix = NULL((void*)0);
21 unsigned char sha1[20];
22 const char *me = "git-write-tree";
23 struct option write_tree_options[] = {
24 OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"),{ OPTION_BIT, (0), ("missing-ok"), (&flags), ((void*)0), (
("allow missing objects")), PARSE_OPT_NOARG, ((void*)0), (1) }
25 WRITE_TREE_MISSING_OK){ OPTION_BIT, (0), ("missing-ok"), (&flags), ((void*)0), (
("allow missing objects")), PARSE_OPT_NOARG, ((void*)0), (1) }
,
26 { OPTION_STRING, 0, "prefix", &prefix, N_("<prefix>/")("<prefix>/"),
27 N_("write tree object for a subdirectory <prefix>")("write tree object for a subdirectory <prefix>") ,
28 PARSE_OPT_LITERAL_ARGHELP },
29 { OPTION_BIT, 0, "ignore-cache-tree", &flags, NULL((void*)0),
30 N_("only useful for debugging")("only useful for debugging"),
31 PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, NULL((void*)0),
32 WRITE_TREE_IGNORE_CACHE_TREE2 },
33 OPT_END(){ OPTION_END }
34 };
35
36 git_config(git_default_config, NULL((void*)0));
37 argc = parse_options(argc, argv, unused_prefix, write_tree_options,
Value stored to 'argc' is never read
38 write_tree_usage, 0);
39
40 ret = write_cache_as_tree(sha1, flags, prefix);
41 switch (ret) {
42 case 0:
43 printf("%s\n", sha1_to_hex(sha1));
44 break;
45 case WRITE_TREE_UNREADABLE_INDEX(-1):
46 die("%s: error reading the index", me);
47 break;
48 case WRITE_TREE_UNMERGED_INDEX(-2):
49 die("%s: error building trees", me);
50 break;
51 case WRITE_TREE_PREFIX_ERROR(-3):
52 die("%s: prefix %s not found", me, prefix);
53 break;
54 }
55 return ret;
56}