From 7283bbc70a55d7364fbeaefc1009c03fcfc8d929 Mon Sep 17 00:00:00 2001 From: Pete Harlan Date: Mon, 15 Feb 2010 15:33:18 -0800 Subject: Remove hyphen from "git-command" in two error messages Signed-off-by: Pete Harlan Signed-off-by: Junio C Hamano diff --git a/git.c b/git.c index 11544cd..a83cab7 100644 --- a/git.c +++ b/git.c @@ -516,7 +516,7 @@ int main(int argc, const char **argv) break; if (was_alias) { fprintf(stderr, "Expansion of alias '%s' failed; " - "'%s' is not a git-command\n", + "'%s' is not a git command\n", cmd, argv[0]); exit(1); } diff --git a/help.c b/help.c index 9da97d7..7f4928e 100644 --- a/help.c +++ b/help.c @@ -350,7 +350,7 @@ const char *help_unknown_cmd(const char *cmd) return assumed; } - fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd); + fprintf(stderr, "git: '%s' is not a git command. See 'git --help'.\n", cmd); if (SIMILAR_ENOUGH(best_similarity)) { fprintf(stderr, "\nDid you mean %s?\n", -- cgit v0.10.2-6-g49f6 From 8324b977aef3d2301f170e23f498b50e11302575 Mon Sep 17 00:00:00 2001 From: Larry D'Anna Date: Mon, 15 Feb 2010 23:10:45 -0500 Subject: diff: make sure --output=/bad/path is caught The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna Signed-off-by: Junio C Hamano diff --git a/diff.c b/diff.c index 17a2b4d..8d8405a 100644 --- a/diff.c +++ b/diff.c @@ -2799,6 +2799,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) ; else if (!prefixcmp(arg, "--output=")) { options->file = fopen(arg + strlen("--output="), "w"); + if (!options->file) + die_errno("Could not open '%s'", arg + strlen("--output=")); options->close_file = 1; } else return 0; -- cgit v0.10.2-6-g49f6 From 460ccd0e19774fd5e4f69de5a454068c686ac5a6 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 15 Feb 2010 17:05:46 +0100 Subject: stash pop: remove 'apply' options during 'drop' invocation The 'git stash pop' option parsing used to remove the first argument in --index mode. At the time this was implemented, this first argument was always --index. However, since the invention of the -q option in fcdd0e9 (stash: teach quiet option, 2009-06-17) you can cause an internal invocation of git stash drop --index by running git stash pop -q --index which then of course fails because drop doesn't know --index. To handle this, instead let 'git stash apply' decide what the future argument to 'drop' should be. Warning: this means that 'git stash apply' must parse all options that 'drop' can take, and deal with them in the same way. This is currently true for its only option -q. Signed-off-by: Thomas Rast Acked-by: Stephen Boyd Signed-off-by: Junio C Hamano diff --git a/git-stash.sh b/git-stash.sh index 4febbbf..79b2771 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -222,6 +222,7 @@ show_stash () { } apply_stash () { + applied_stash= unstash_index= while test $# != 0 @@ -243,6 +244,9 @@ apply_stash () { if test $# = 0 then have_stash || die 'Nothing to apply' + applied_stash="$ref_stash@{0}" + else + applied_stash="$*" fi # stash records the work tree, and is a merge between the @@ -421,8 +425,7 @@ pop) shift if apply_stash "$@" then - test -z "$unstash_index" || shift - drop_stash "$@" + drop_stash "$applied_stash" fi ;; branch) diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 5514f74..476e5ec 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -194,6 +194,15 @@ test_expect_success 'pop -q is quiet' ' test ! -s output.out ' +test_expect_success 'pop -q --index works and is quiet' ' + echo foo > file && + git add file && + git stash save --quiet && + git stash pop -q --index > output.out 2>&1 && + test foo = "$(git show :file)" && + test ! -s output.out +' + test_expect_success 'drop -q is quiet' ' git stash && git stash drop -q > output.out 2>&1 && -- cgit v0.10.2-6-g49f6 From 003c6abdb27c367747847a76b0a7890d67c794be Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 16 Feb 2010 02:03:16 -0500 Subject: dwim_ref: fix dangling symref warning If we encounter a symref that is dangling, in most cases we will warn about it. The one exception is a dangling HEAD, as that indicates a branch yet to be born. However, the check in dwim_ref was not quite right. If we were fed something like "HEAD^0" we would try to resolve "HEAD", see that it is dangling, and then check whether the _original_ string we got was "HEAD" (which it wasn't in this case). And that makes no sense; the dangling thing we found was not "HEAD^0" but rather "HEAD". Fixing this squelches a scary warning from "submodule summary HEAD" (and consequently "git status" with status.submodulesummary set) in an empty repo, as the submodule script calls "git rev-parse -q --verify HEAD^0". Signed-off-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/sha1_name.c b/sha1_name.c index 44bb62d..9677afd 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -278,8 +278,7 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref) *ref = xstrdup(r); if (!warn_ambiguous_refs) break; - } else if ((flag & REF_ISSYMREF) && - (len != 4 || strcmp(str, "HEAD"))) + } else if ((flag & REF_ISSYMREF) && strcmp(fullref, "HEAD")) warning("ignoring dangling symref %s.", fullref); } free(last_branch); -- cgit v0.10.2-6-g49f6 From 5f02d31597df35ca98e9080e12bfbb18dadadcbe Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 15 Feb 2010 18:34:28 -0800 Subject: Fix use of mutex in threaded grep The program can decide at runtime not to use threading even if the support is compiled in. In such a case, mutexes are not necessary and left uninitialized. But the code incorrectly tried to take and release the read_sha1_mutex unconditionally. Signed-off-by: Junio C Hamano Acked-by: Fredrik Kuivinen diff --git a/builtin-grep.c b/builtin-grep.c index 26d4deb..362122c 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -408,15 +408,25 @@ static int pathspec_matches(const char **paths, const char *name, int max_depth) return 0; } +static void *lock_and_read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size) +{ + void *data; + + if (use_threads) { + read_sha1_lock(); + data = read_sha1_file(sha1, type, size); + read_sha1_unlock(); + } else { + data = read_sha1_file(sha1, type, size); + } + return data; +} + static void *load_sha1(const unsigned char *sha1, unsigned long *size, const char *name) { enum object_type type; - char *data; - - read_sha1_lock(); - data = read_sha1_file(sha1, &type, size); - read_sha1_unlock(); + void *data = lock_and_read_sha1_file(sha1, &type, size); if (!data) error("'%s': unable to read %s", name, sha1_to_hex(sha1)); @@ -605,10 +615,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths, void *data; unsigned long size; - read_sha1_lock(); - data = read_sha1_file(entry.sha1, &type, &size); - read_sha1_unlock(); - + data = lock_and_read_sha1_file(entry.sha1, &type, &size); if (!data) die("unable to read tree (%s)", sha1_to_hex(entry.sha1)); -- cgit v0.10.2-6-g49f6 From d3f69766c431bab6321fed1ce64d914dc44ff87f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 16 Feb 2010 22:25:03 -0800 Subject: Prepare 1.7.0.1 release notes Signed-off-by: Junio C Hamano diff --git a/Documentation/RelNotes-1.7.0.1.txt b/Documentation/RelNotes-1.7.0.1.txt index ab0f976..312a3f5 100644 --- a/Documentation/RelNotes-1.7.0.1.txt +++ b/Documentation/RelNotes-1.7.0.1.txt @@ -4,8 +4,28 @@ Git v1.7.0.1 Release Notes Fixes since v1.7.0 ------------------ + * In a freshly created repository "rev-parse HEAD^0" complained that + it is dangling symref, even though "rev-parse HEAD" didn't. + + * Message from "git cherry-pick" was harder to read and use than necessary + when it stopped due to conflicting changes. + + * "git diff --output=/path/that/cannot/be/written" did not correctly + error out. + + * "git grep -e -pattern-that-begin-with-dash paths..." could not be + spelled as "git grep -- -pattern-that-begin-with-dash paths..." which + would be a GNU way to use "--" as "end of options". + + * "git grep" compiled with threading support tried to access an + uninitialized mutex on boxes with a single CPU. + + * "git stash pop -q --index" failed because the unnecessary --index + option was propagated to "git stash drop" that is internally run at the + end. + -- exec >/var/tmp/1 echo O=$(git describe) -O=v1.7.0 +O=v1.7.0-11-g354d9f8 git shortlog $O.. -- cgit v0.10.2-6-g49f6