From 15e593e4d37d1d350fef20ab666d58f6881c7f5f Mon Sep 17 00:00:00 2001 From: Ramsay Allan Jones Date: Thu, 3 Aug 2006 16:38:39 +0100 Subject: [PATCH 1/5] Fixup command names in some usage strings. Most usage strings, such as for command xxx, start with "git-xxx". This updates the rebels to conform to the general pattern. (The git wrapper is an exception to this, of course ...) Signed-off-by: Ramsay Allan Jones Signed-off-by: Junio C Hamano --- blame.c | 2 +- builtin-diff.c | 2 +- builtin-push.c | 2 +- mktag.c | 2 +- mktree.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/blame.c b/blame.c index 76712b5962..7099b53c72 100644 --- a/blame.c +++ b/blame.c @@ -20,7 +20,7 @@ #define DEBUG 0 -static const char blame_usage[] = "[-c] [-l] [-t] [-S ] [--] file [commit]\n" +static const char blame_usage[] = "git-blame [-c] [-l] [-t] [-S ] [--] file [commit]\n" " -c, --compatibility Use the same output mode as git-annotate (Default: off)\n" " -l, --long Show long commit SHA1 (Default: off)\n" " -t, --time Show raw timestamp (Default: off)\n" diff --git a/builtin-diff.c b/builtin-diff.c index cb4216eb8a..1075855102 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -23,7 +23,7 @@ struct blobinfo { }; static const char builtin_diff_usage[] = -"diff {0,2} -- *"; +"git-diff {0,2} -- *"; static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv) diff --git a/builtin-push.c b/builtin-push.c index c39dd1e092..53bc378f73 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -8,7 +8,7 @@ #define MAX_URI (16) -static const char push_usage[] = "git push [--all] [--tags] [-f | --force] [...]"; +static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] [...]"; static int all = 0, tags = 0, force = 0, thin = 1; static const char *execute = NULL; diff --git a/mktag.c b/mktag.c index 09b6e437d4..be23e589fb 100644 --- a/mktag.c +++ b/mktag.c @@ -123,7 +123,7 @@ int main(int argc, char **argv) unsigned char result_sha1[20]; if (argc != 1) - usage("cat | git-mktag"); + usage("git-mktag < signaturefile"); setup_git_directory(); diff --git a/mktree.c b/mktree.c index ab63cd99d4..9a6f0d2f6b 100644 --- a/mktree.c +++ b/mktree.c @@ -71,7 +71,7 @@ static void write_tree(unsigned char *sha1) write_sha1_file(buffer, offset, tree_type, sha1); } -static const char mktree_usage[] = "mktree [-z]"; +static const char mktree_usage[] = "git-mktree [-z]"; int main(int ac, char **av) { From 8cdf33643dc0b21d9ea922a3fdd7f64226c421aa Mon Sep 17 00:00:00 2001 From: Ramsay Allan Jones Date: Thu, 3 Aug 2006 16:48:41 +0100 Subject: [PATCH 2/5] Replace some calls to die(usage_str) with usage(usage_str). The only change in behaviour should be having a "usage: " prefix on the output string rather than "fatal: ", and an exit code of 129 rather than 128. Signed-off-by: Ramsay Allan Jones Signed-off-by: Junio C Hamano --- builtin-add.c | 2 +- builtin-init-db.c | 2 +- builtin-rm.c | 2 +- builtin-write-tree.c | 2 +- hash-object.c | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builtin-add.c b/builtin-add.c index f548b8007d..096b611b5b 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -117,7 +117,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) verbose = 1; continue; } - die(builtin_add_usage); + usage(builtin_add_usage); } pathspec = get_pathspec(prefix, argv + i); diff --git a/builtin-init-db.c b/builtin-init-db.c index 52473edf56..5085018e46 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -267,7 +267,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) else if (!strncmp(arg, "--shared=", 9)) shared_repository = git_config_perm("arg", arg+9); else - die(init_db_usage); + usage(init_db_usage); } /* diff --git a/builtin-rm.c b/builtin-rm.c index 92d205a715..a0882bf1b0 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -80,7 +80,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) force = 1; continue; } - die(builtin_rm_usage); + usage(builtin_rm_usage); } if (argc <= i) usage(builtin_rm_usage); diff --git a/builtin-write-tree.c b/builtin-write-tree.c index 0289f59936..6b62d7dc8c 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -73,7 +73,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix) else if (!strncmp(arg, "--prefix=", 9)) prefix = arg + 9; else - die(write_tree_usage); + usage(write_tree_usage); argc--; argv++; } diff --git a/hash-object.c b/hash-object.c index 43bd93bffb..5f89e64c13 100644 --- a/hash-object.c +++ b/hash-object.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) if (!no_more_flags && argv[i][0] == '-') { if (!strcmp(argv[i], "-t")) { if (argc <= ++i) - die(hash_object_usage); + usage(hash_object_usage); type = argv[i]; } else if (!strcmp(argv[i], "-w")) { @@ -66,8 +66,8 @@ int main(int argc, char **argv) hash_stdin(type, write_object); } else - die(hash_object_usage); - } + usage(hash_object_usage); + } else { const char *arg = argv[i]; if (0 <= prefix_length) From cba05fa840b637db2708014142a753680d930082 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 Aug 2006 21:55:41 -0700 Subject: [PATCH 3/5] Further clean-up: usage() vs die() This hopefully finishes the clean-up Ramsay started with recent commit 15e593e4d37d1d350fef20ab666d58f6881c7f5f and commit 8cdf33643dc0b21d9ea922a3fdd7f64226c421aa. Signed-off-by: Junio C Hamano --- builtin-check-ref-format.c | 2 +- builtin-mv.c | 2 +- builtin-prune.c | 2 +- builtin-rm.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c index 701de439ae..fe04be77a9 100644 --- a/builtin-check-ref-format.c +++ b/builtin-check-ref-format.c @@ -9,6 +9,6 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix) { if (argc != 2) - usage("git check-ref-format refname"); + usage("git-check-ref-format refname"); return !!check_ref_format(argv[1]); } diff --git a/builtin-mv.c b/builtin-mv.c index 62ae937cb1..e47942c135 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -99,7 +99,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) ignore_errors = 1; continue; } - die(builtin_mv_usage); + usage(builtin_mv_usage); } count = argc - i - 1; if (count < 1) diff --git a/builtin-prune.c b/builtin-prune.c index 6a86eb52ae..89ec7f1426 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -10,7 +10,7 @@ #include "builtin.h" #include "cache-tree.h" -static const char prune_usage[] = "git prune [-n]"; +static const char prune_usage[] = "git-prune [-n]"; static int show_only = 0; static struct rev_info revs; diff --git a/builtin-rm.c b/builtin-rm.c index a0882bf1b0..8af3d7eb48 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -115,7 +115,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) printf("rm '%s'\n", path); if (remove_file_from_cache(path)) - die("git rm: unable to remove %s", path); + die("git-rm: unable to remove %s", path); cache_tree_invalidate_path(active_cache_tree, path); } @@ -139,7 +139,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) continue; } if (!removed) - die("git rm: %s: %s", path, strerror(errno)); + die("git-rm: %s: %s", path, strerror(errno)); } } From d249b455475977f305240bb73473f25d040012cf Mon Sep 17 00:00:00 2001 From: Uwe Zeisberger Date: Fri, 4 Aug 2006 10:11:15 +0200 Subject: [PATCH 4/5] Document rev-list's option --merge Signed-off-by: Uwe Zeisberger Signed-off-by: Junio C Hamano --- Documentation/git-rev-list.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index f60eacd93e..dd9fff16d3 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -22,6 +22,7 @@ SYNOPSIS [ [\--objects | \--objects-edge] [ \--unpacked ] ] [ \--pretty | \--header ] [ \--bisect ] + [ \--merge ] ... [ \-- ... ] DESCRIPTION @@ -123,6 +124,10 @@ OPTIONS topological order (i.e. descendant commits are shown before their parents). +--merge:: + After a failed merge, show refs that touch files having a + conflict and don't exist on all heads to merge. + Author ------ Written by Linus Torvalds From 7e18e56920bd38ffc1f2c068d943bfd3f012473d Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Fri, 4 Aug 2006 10:54:08 +0200 Subject: [PATCH 5/5] git-tar-tree: fix minor memory leak Free the root tree object buffer when we're done, plugging a minor leak in generate_tar(). Note: we cannot simply free(tree.buf) because this pointer is modified by tree_entry() calls in traverse_tree(). Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-tar-tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c index 7c48db9ec8..215892b696 100644 --- a/builtin-tar-tree.c +++ b/builtin-tar-tree.c @@ -314,6 +314,7 @@ static int generate_tar(int argc, const char **argv, const char *prefix) struct commit *commit; struct tree_desc tree; struct strbuf current_path; + void *buffer; current_path.buf = xmalloc(PATH_MAX); current_path.alloc = PATH_MAX; @@ -341,8 +342,8 @@ static int generate_tar(int argc, const char **argv, const char *prefix) } else archive_time = time(NULL); - tree.buf = read_object_with_reference(sha1, tree_type, &tree.size, - tree_sha1); + tree.buf = buffer = read_object_with_reference(sha1, tree_type, + &tree.size, tree_sha1); if (!tree.buf) die("not a reference to a tag, commit or tree object: %s", sha1_to_hex(sha1)); @@ -351,6 +352,7 @@ static int generate_tar(int argc, const char **argv, const char *prefix) write_entry(tree_sha1, ¤t_path, 040777, NULL, 0); traverse_tree(&tree, ¤t_path); write_trailer(); + free(buffer); free(current_path.buf); return 0; }