From: Junio C Hamano Date: Sat, 19 Jul 2008 18:28:06 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.0-rc0~14 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=679639904da05f7d84e9215960e76dd0f3353328;hp=-c;p=git.git Merge branch 'maint' * maint: GIT 1.5.6.4 builtin-rm: fix index lock file path http-fetch: do not SEGV after fetching a bad pack idx file rev-list: honor --quiet option api-run-command.txt: typofix --- 679639904da05f7d84e9215960e76dd0f3353328 diff --combined builtin-rev-list.c index 8e1720c45,39ec61c42..893762c80 --- a/builtin-rev-list.c +++ b/builtin-rev-list.c @@@ -17,7 -17,7 +17,7 @@@ #define COUNTED (1u<<16) static const char rev_list_usage[] = -"git-rev-list [OPTION] ... [ -- paths... ]\n" +"git rev-list [OPTION] ... [ -- paths... ]\n" " limiting output:\n" " --max-count=nr\n" " --max-age=epoch\n" @@@ -37,7 -37,6 +37,7 @@@ " --reverse\n" " formatting output:\n" " --parents\n" +" --children\n" " --objects | --objects-edge\n" " --unpacked\n" " --header | --pretty\n" @@@ -91,15 -90,6 +91,15 @@@ static void show_commit(struct commit * parents = parents->next; } } + if (revs.children.name) { + struct commit_list *children; + + children = lookup_decoration(&revs.children, &commit->object); + while (children) { + printf(" %s", sha1_to_hex(children->item->object.sha1)); + children = children->next; + } + } show_decorations(commit); if (revs.commit_format == CMIT_FMT_ONELINE) putchar(' '); @@@ -575,6 -565,23 +575,6 @@@ static struct commit_list *find_bisecti return best; } -static void read_revisions_from_stdin(struct rev_info *revs) -{ - char line[1000]; - - while (fgets(line, sizeof(line), stdin) != NULL) { - int len = strlen(line); - if (len && line[len - 1] == '\n') - line[--len] = 0; - if (!len) - break; - if (line[0] == '-') - die("options not supported in --stdin mode"); - if (handle_revision_arg(line, revs, 0, 1)) - die("bad revision '%s'", line); - } -} - int cmd_rev_list(int argc, const char **argv, const char *prefix) { struct commit_list *list; @@@ -590,6 -597,7 +590,7 @@@ revs.commit_format = CMIT_FMT_UNSPECIFIED; argc = setup_revisions(argc, argv, &revs, NULL); + quiet = DIFF_OPT_TST(&revs.diffopt, QUIET); for (i = 1 ; i < argc; i++) { const char *arg = argv[i]; @@@ -621,10 -629,6 +622,6 @@@ read_revisions_from_stdin(&revs); continue; } - if (!strcmp(arg, "--quiet")) { - quiet = 1; - continue; - } usage(rev_list_usage); } diff --combined builtin-rm.c index 56454ec8f,abdab7f00..ee8247b08 --- a/builtin-rm.c +++ b/builtin-rm.c @@@ -11,7 -11,7 +11,7 @@@ #include "parse-options.h" static const char * const builtin_rm_usage[] = { - "git-rm [options] [--] ...", + "git rm [options] [--] ...", NULL }; @@@ -146,11 -146,6 +146,6 @@@ int cmd_rm(int argc, const char **argv git_config(git_default_config, NULL); - newfd = hold_locked_index(&lock_file, 1); - - if (read_cache() < 0) - die("index file corrupt"); - argc = parse_options(argc, argv, builtin_rm_options, builtin_rm_usage, 0); if (!argc) usage_with_options(builtin_rm_usage, builtin_rm_options); @@@ -158,6 -153,11 +153,11 @@@ if (!index_only) setup_work_tree(); + newfd = hold_locked_index(&lock_file, 1); + + if (read_cache() < 0) + die("index file corrupt"); + pathspec = get_pathspec(prefix, argv); seen = NULL; for (i = 0; pathspec[i] ; i++) diff --combined http-walker.c index 51c18f268,74033060c..9dc6b27b4 --- a/http-walker.c +++ b/http-walker.c @@@ -442,6 -442,8 +442,8 @@@ static int setup_index(struct walker *w return -1; new_pack = parse_pack_index(sha1); + if (!new_pack) + return -1; /* parse_pack_index() already issued error message */ new_pack->next = repo->packs; repo->packs = new_pack; return 0; @@@ -795,7 -797,7 +797,7 @@@ static int fetch_pack(struct walker *wa lst = &((*lst)->next); *lst = (*lst)->next; - if (verify_pack(target, 0)) + if (verify_pack(target)) return -1; install_packed_git(target); diff --combined t/t3600-rm.sh index 316775ecd,7893d8c40..79c06adf1 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@@ -67,7 -67,7 +67,7 @@@ test_expect_success echo "other content" > foo git add foo echo "yet another content" > foo - ! git rm --cached foo + test_must_fail git rm --cached foo ' test_expect_success \ @@@ -82,7 -82,7 +82,7 @@@ test_expect_success \ 'Post-check that foo exists but is not in index after git rm foo' \ - '[ -f foo ] && ! git ls-files --error-unmatch foo' + '[ -f foo ] && test_must_fail git ls-files --error-unmatch foo' test_expect_success \ 'Pre-check that bar exists and is in index before "git rm bar"' \ @@@ -94,7 -94,7 +94,7 @@@ test_expect_success test_expect_success \ 'Post-check that bar does not exist and is not in index after "git rm -f bar"' \ - '! [ -f bar ] && ! git ls-files --error-unmatch bar' + '! [ -f bar ] && test_must_fail git ls-files --error-unmatch bar' test_expect_success \ 'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' \ @@@ -109,7 -109,7 +109,7 @@@ if test "$test_failed_remove" = y; the chmod a-w . test_expect_success \ 'Test that "git rm -f" fails if its rm fails' \ - '! git rm -f baz' + 'test_must_fail git rm -f baz' chmod 775 . else test_expect_success 'skipping removal failure (perhaps running as root?)' : @@@ -151,7 -151,7 +151,7 @@@ test_expect_success 'Re-add foo and baz test_expect_success 'Modify foo -- rm should refuse' ' echo >>foo && - ! git rm foo baz && + test_must_fail git rm foo baz && test -f foo && test -f baz && git ls-files --error-unmatch foo baz @@@ -161,8 -161,8 +161,8 @@@ test_expect_success 'Modified foo -- r git rm -f foo baz && test ! -f foo && test ! -f baz && - ! git ls-files --error-unmatch foo && - ! git ls-files --error-unmatch bar + test_must_fail git ls-files --error-unmatch foo && + test_must_fail git ls-files --error-unmatch bar ' test_expect_success 'Re-add foo and baz for HEAD tests' ' @@@ -173,7 -173,7 +173,7 @@@ ' test_expect_success 'foo is different in index from HEAD -- rm should refuse' ' - ! git rm foo baz && + test_must_fail git rm foo baz && test -f foo && test -f baz && git ls-files --error-unmatch foo baz @@@ -183,8 -183,8 +183,8 @@@ test_expect_success 'but with -f it sho git rm -f foo baz && test ! -f foo && test ! -f baz && - ! git ls-files --error-unmatch foo - ! git ls-files --error-unmatch baz + test_must_fail git ls-files --error-unmatch foo + test_must_fail git ls-files --error-unmatch baz ' test_expect_success 'Recursive test setup' ' @@@ -195,14 -195,14 +195,14 @@@ ' test_expect_success 'Recursive without -r fails' ' - ! git rm frotz && + test_must_fail git rm frotz && test -d frotz && test -f frotz/nitfol ' test_expect_success 'Recursive with -r but dirty' ' echo qfwfq >>frotz/nitfol - ! git rm -r frotz && + test_must_fail git rm -r frotz && test -d frotz && test -f frotz/nitfol ' @@@ -214,7 -214,19 +214,19 @@@ test_expect_success 'Recursive with -r ' test_expect_success 'Remove nonexistent file returns nonzero exit status' ' - ! git rm nonexistent + test_must_fail git rm nonexistent ' + test_expect_success 'Call "rm" from outside the work tree' ' + mkdir repo && + cd repo && + git init && + echo something > somefile && + git add somefile && + git commit -m "add a file" && + (cd .. && + git --git-dir=repo/.git --work-tree=repo rm somefile) && + test_must_fail git ls-files --error-unmatch somefile + ' + test_done