Skip to content

Commit

Permalink
Merge branch 'maint-1.6.5' into maint-1.6.6
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Feb 16, 2010
2 parents 7283bbc + 003c6ab commit eb0bcd0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,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;
Expand Down
7 changes: 5 additions & 2 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ show_stash () {
}

apply_stash () {
applied_stash=
unstash_index=

while test $# != 0
Expand All @@ -242,6 +243,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
Expand Down Expand Up @@ -415,8 +419,7 @@ pop)
shift
if apply_stash "$@"
then
test -z "$unstash_index" || shift
drop_stash "$@"
drop_stash "$applied_stash"
fi
;;
branch)
Expand Down
3 changes: 1 addition & 2 deletions sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions t/t3903-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit eb0bcd0

Please sign in to comment.