Merge branch 'maint'

* maint:
  Prepare 1.7.0.1 release notes
  Fix use of mutex in threaded grep
  dwim_ref: fix dangling symref warning
  stash pop: remove 'apply' options during 'drop' invocation
  diff: make sure --output=/bad/path is caught
  Remove hyphen from "git-command" in two error messages
This commit is contained in:
Junio C Hamano 2010-02-16 22:40:45 -08:00
commit 72cd63c008
8 changed files with 56 additions and 16 deletions

View File

@ -4,8 +4,28 @@ Git v1.7.0.1 Release Notes
Fixes since v1.7.0 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 exec >/var/tmp/1
echo O=$(git describe) echo O=$(git describe)
O=v1.7.0 O=v1.7.0-11-g354d9f8
git shortlog $O.. git shortlog $O..

View File

@ -409,15 +409,25 @@ static int pathspec_matches(const char **paths, const char *name, int max_depth)
return 0; 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, static void *load_sha1(const unsigned char *sha1, unsigned long *size,
const char *name) const char *name)
{ {
enum object_type type; enum object_type type;
char *data; void *data = lock_and_read_sha1_file(sha1, &type, size);
read_sha1_lock();
data = read_sha1_file(sha1, &type, size);
read_sha1_unlock();
if (!data) if (!data)
error("'%s': unable to read %s", name, sha1_to_hex(sha1)); error("'%s': unable to read %s", name, sha1_to_hex(sha1));
@ -606,10 +616,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
void *data; void *data;
unsigned long size; unsigned long size;
read_sha1_lock(); data = lock_and_read_sha1_file(entry.sha1, &type, &size);
data = read_sha1_file(entry.sha1, &type, &size);
read_sha1_unlock();
if (!data) if (!data)
die("unable to read tree (%s)", die("unable to read tree (%s)",
sha1_to_hex(entry.sha1)); sha1_to_hex(entry.sha1));

2
diff.c
View File

@ -2893,6 +2893,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
; ;
else if (!prefixcmp(arg, "--output=")) { else if (!prefixcmp(arg, "--output=")) {
options->file = fopen(arg + strlen("--output="), "w"); options->file = fopen(arg + strlen("--output="), "w");
if (!options->file)
die_errno("Could not open '%s'", arg + strlen("--output="));
options->close_file = 1; options->close_file = 1;
} else } else
return 0; return 0;

View File

@ -221,6 +221,7 @@ show_stash () {
} }
apply_stash () { apply_stash () {
applied_stash=
unstash_index= unstash_index=
while test $# != 0 while test $# != 0
@ -242,6 +243,9 @@ apply_stash () {
if test $# = 0 if test $# = 0
then then
have_stash || die 'Nothing to apply' have_stash || die 'Nothing to apply'
applied_stash="$ref_stash@{0}"
else
applied_stash="$*"
fi fi
# stash records the work tree, and is a merge between the # stash records the work tree, and is a merge between the
@ -415,8 +419,7 @@ pop)
shift shift
if apply_stash "$@" if apply_stash "$@"
then then
test -z "$unstash_index" || shift drop_stash "$applied_stash"
drop_stash "$@"
fi fi
;; ;;
branch) branch)

2
git.c
View File

@ -527,7 +527,7 @@ int main(int argc, const char **argv)
break; break;
if (was_alias) { if (was_alias) {
fprintf(stderr, "Expansion of alias '%s' failed; " fprintf(stderr, "Expansion of alias '%s' failed; "
"'%s' is not a git-command\n", "'%s' is not a git command\n",
cmd, argv[0]); cmd, argv[0]);
exit(1); exit(1);
} }

2
help.c
View File

@ -350,7 +350,7 @@ const char *help_unknown_cmd(const char *cmd)
return assumed; 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)) { if (SIMILAR_ENOUGH(best_similarity)) {
fprintf(stderr, "\nDid you mean %s?\n", fprintf(stderr, "\nDid you mean %s?\n",

View File

@ -280,8 +280,7 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
*ref = xstrdup(r); *ref = xstrdup(r);
if (!warn_ambiguous_refs) if (!warn_ambiguous_refs)
break; break;
} else if ((flag & REF_ISSYMREF) && } else if ((flag & REF_ISSYMREF) && strcmp(fullref, "HEAD"))
(len != 4 || strcmp(str, "HEAD")))
warning("ignoring dangling symref %s.", fullref); warning("ignoring dangling symref %s.", fullref);
} }
free(last_branch); free(last_branch);

View File

@ -194,6 +194,15 @@ test_expect_success 'pop -q is quiet' '
test ! -s output.out 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' ' test_expect_success 'drop -q is quiet' '
git stash && git stash &&
git stash drop -q > output.out 2>&1 && git stash drop -q > output.out 2>&1 &&