Skip to content

Commit e7b3cea

Browse files
committed
Merge branch 'maint-1.6.6' into maint
* maint-1.6.6: 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 b599672 + eb0bcd0 commit e7b3cea

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

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)