Skip to content

Commit eb0bcd0

Browse files
committed
Merge branch 'maint-1.6.5' into maint-1.6.6
* maint-1.6.5: dwim_ref: fix dangling symref warning stash pop: remove 'apply' options during 'drop' invocation diff: make sure --output=/bad/path is caught
2 parents 7283bbc + 003c6ab commit eb0bcd0

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,6 +2855,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
28552855
;
28562856
else if (!prefixcmp(arg, "--output=")) {
28572857
options->file = fopen(arg + strlen("--output="), "w");
2858+
if (!options->file)
2859+
die_errno("Could not open '%s'", arg + strlen("--output="));
28582860
options->close_file = 1;
28592861
} else
28602862
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)

sha1_name.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
278278
*ref = xstrdup(r);
279279
if (!warn_ambiguous_refs)
280280
break;
281-
} else if ((flag & REF_ISSYMREF) &&
282-
(len != 4 || strcmp(str, "HEAD")))
281+
} else if ((flag & REF_ISSYMREF) && strcmp(fullref, "HEAD"))
283282
warning("ignoring dangling symref %s.", fullref);
284283
}
285284
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)