Skip to content

Commit 72cd63c

Browse files
committed
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
2 parents 7e5eb8f + d3f6976 commit 72cd63c

File tree

8 files changed

+56
-16
lines changed

8 files changed

+56
-16
lines changed

Documentation/RelNotes-1.7.0.1.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@ Git v1.7.0.1 Release Notes
44
Fixes since v1.7.0
55
------------------
66

7+
* In a freshly created repository "rev-parse HEAD^0" complained that
8+
it is dangling symref, even though "rev-parse HEAD" didn't.
9+
10+
* Message from "git cherry-pick" was harder to read and use than necessary
11+
when it stopped due to conflicting changes.
12+
13+
* "git diff --output=/path/that/cannot/be/written" did not correctly
14+
error out.
15+
16+
* "git grep -e -pattern-that-begin-with-dash paths..." could not be
17+
spelled as "git grep -- -pattern-that-begin-with-dash paths..." which
18+
would be a GNU way to use "--" as "end of options".
19+
20+
* "git grep" compiled with threading support tried to access an
21+
uninitialized mutex on boxes with a single CPU.
22+
23+
* "git stash pop -q --index" failed because the unnecessary --index
24+
option was propagated to "git stash drop" that is internally run at the
25+
end.
26+
727
--
828
exec >/var/tmp/1
929
echo O=$(git describe)
10-
O=v1.7.0
30+
O=v1.7.0-11-g354d9f8
1131
git shortlog $O..

builtin-grep.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,25 @@ static int pathspec_matches(const char **paths, const char *name, int max_depth)
409409
return 0;
410410
}
411411

412+
static void *lock_and_read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
413+
{
414+
void *data;
415+
416+
if (use_threads) {
417+
read_sha1_lock();
418+
data = read_sha1_file(sha1, type, size);
419+
read_sha1_unlock();
420+
} else {
421+
data = read_sha1_file(sha1, type, size);
422+
}
423+
return data;
424+
}
425+
412426
static void *load_sha1(const unsigned char *sha1, unsigned long *size,
413427
const char *name)
414428
{
415429
enum object_type type;
416-
char *data;
417-
418-
read_sha1_lock();
419-
data = read_sha1_file(sha1, &type, size);
420-
read_sha1_unlock();
430+
void *data = lock_and_read_sha1_file(sha1, &type, size);
421431

422432
if (!data)
423433
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,
606616
void *data;
607617
unsigned long size;
608618

609-
read_sha1_lock();
610-
data = read_sha1_file(entry.sha1, &type, &size);
611-
read_sha1_unlock();
612-
619+
data = lock_and_read_sha1_file(entry.sha1, &type, &size);
613620
if (!data)
614621
die("unable to read tree (%s)",
615622
sha1_to_hex(entry.sha1));

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
28932893
;
28942894
else if (!prefixcmp(arg, "--output=")) {
28952895
options->file = fopen(arg + strlen("--output="), "w");
2896+
if (!options->file)
2897+
die_errno("Could not open '%s'", arg + strlen("--output="));
28962898
options->close_file = 1;
28972899
} else
28982900
return 0;

git-stash.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ show_stash () {
221221
}
222222

223223
apply_stash () {
224+
applied_stash=
224225
unstash_index=
225226

226227
while test $# != 0
@@ -242,6 +243,9 @@ apply_stash () {
242243
if test $# = 0
243244
then
244245
have_stash || die 'Nothing to apply'
246+
applied_stash="$ref_stash@{0}"
247+
else
248+
applied_stash="$*"
245249
fi
246250

247251
# stash records the work tree, and is a merge between the
@@ -415,8 +419,7 @@ pop)
415419
shift
416420
if apply_stash "$@"
417421
then
418-
test -z "$unstash_index" || shift
419-
drop_stash "$@"
422+
drop_stash "$applied_stash"
420423
fi
421424
;;
422425
branch)

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ int main(int argc, const char **argv)
527527
break;
528528
if (was_alias) {
529529
fprintf(stderr, "Expansion of alias '%s' failed; "
530-
"'%s' is not a git-command\n",
530+
"'%s' is not a git command\n",
531531
cmd, argv[0]);
532532
exit(1);
533533
}

help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ const char *help_unknown_cmd(const char *cmd)
350350
return assumed;
351351
}
352352

353-
fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
353+
fprintf(stderr, "git: '%s' is not a git command. See 'git --help'.\n", cmd);
354354

355355
if (SIMILAR_ENOUGH(best_similarity)) {
356356
fprintf(stderr, "\nDid you mean %s?\n",

sha1_name.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
280280
*ref = xstrdup(r);
281281
if (!warn_ambiguous_refs)
282282
break;
283-
} else if ((flag & REF_ISSYMREF) &&
284-
(len != 4 || strcmp(str, "HEAD")))
283+
} else if ((flag & REF_ISSYMREF) && strcmp(fullref, "HEAD"))
285284
warning("ignoring dangling symref %s.", fullref);
286285
}
287286
free(last_branch);

t/t3903-stash.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ test_expect_success 'pop -q is quiet' '
194194
test ! -s output.out
195195
'
196196

197+
test_expect_success 'pop -q --index works and is quiet' '
198+
echo foo > file &&
199+
git add file &&
200+
git stash save --quiet &&
201+
git stash pop -q --index > output.out 2>&1 &&
202+
test foo = "$(git show :file)" &&
203+
test ! -s output.out
204+
'
205+
197206
test_expect_success 'drop -q is quiet' '
198207
git stash &&
199208
git stash drop -q > output.out 2>&1 &&

0 commit comments

Comments
 (0)