Skip to content

Commit c9c6cc8

Browse files
committed
Merge branch 'maint'
* maint: Update release notes for 1.6.0.3 checkout: Do not show local changes when in quiet mode for-each-ref: Fix --format=%(subject) for log message without newlines git-stash.sh: don't default to refs/stash if invalid ref supplied maint: check return of split_cmdline to avoid bad config strings
2 parents baede9f + 93feb4b commit c9c6cc8

File tree

7 files changed

+49
-6
lines changed

7 files changed

+49
-6
lines changed

Documentation/RelNotes-1.6.0.3.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ Fixes since v1.6.0.2
1616
* Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code"
1717
with the output redirected to /dev/null.
1818

19+
* "git stash apply sash@{1}" was fixed to error out. Prior versions
20+
would have applied stash@{0} incorrectly.
21+
22+
* "git for-each-ref --format=%(subject)" fixed for commits with no
23+
no newline in the message body.
24+
25+
* "git remote" fixed to protect printf from user input.
26+
27+
* "git checkout -q" once again suppresses the locally modified file list.
28+
29+
* Cross-directory renames are no longer used when creating packs. This
30+
allows more graceful behavior on filesystems like sshfs.
31+
32+
* Stale temporary files under $GIT_DIR/objects/pack are now cleaned up
33+
automatically by "git prune".
34+
1935
* "Git.pm" tests relied on unnecessarily more recent version of Perl.
2036

2137
* "gitweb" triggered undef warning on commits without log messages.
@@ -24,6 +40,6 @@ Many other documentation updates.
2440

2541
--
2642
exec >/var/tmp/1
27-
O=v1.6.0.2-32-g8d11fde
43+
O=v1.6.0.2-41-g7fe4a72
2844
echo O=$(git describe maint)
2945
git shortlog --no-merges $O..maint

builtin-checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int merge_working_tree(struct checkout_opts *opts,
328328
commit_locked_index(lock_file))
329329
die("unable to write new index file");
330330

331-
if (!opts->force)
331+
if (!opts->force && !opts->quiet)
332332
show_local_changes(&new->commit->object);
333333

334334
return 0;

builtin-for-each-ref.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
321321
static const char *copy_line(const char *buf)
322322
{
323323
const char *eol = strchr(buf, '\n');
324-
if (!eol)
325-
return "";
324+
if (!eol) // simulate strchrnul()
325+
eol = buf + strlen(buf);
326326
return xmemdupz(buf, eol - buf);
327327
}
328328

builtin-merge.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ static int git_merge_config(const char *k, const char *v, void *cb)
476476

477477
buf = xstrdup(v);
478478
argc = split_cmdline(buf, &argv);
479+
if (argc < 0)
480+
die("Bad branch.%s.mergeoptions string", branch);
479481
argv = xrealloc(argv, sizeof(*argv) * (argc + 2));
480482
memmove(argv + 1, argv, sizeof(*argv) * (argc + 1));
481483
argc++;

git-stash.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ show_stash () {
144144
then
145145
flags=--stat
146146
fi
147-
s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@")
147+
148+
if test $# = 0
149+
then
150+
set x "$ref_stash@{0}"
151+
shift
152+
fi
153+
154+
s=$(git rev-parse --revs-only --no-flags "$@")
148155

149156
w_commit=$(git rev-parse --verify "$s") &&
150157
b_commit=$(git rev-parse --verify "$s^") &&
@@ -163,13 +170,19 @@ apply_stash () {
163170
shift
164171
esac
165172

173+
if test $# = 0
174+
then
175+
set x "$ref_stash@{0}"
176+
shift
177+
fi
178+
166179
# current index state
167180
c_tree=$(git write-tree) ||
168181
die 'Cannot apply a stash in the middle of a merge'
169182

170183
# stash records the work tree, and is a merge between the
171184
# base commit (first parent) and the index tree (second parent).
172-
s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
185+
s=$(git rev-parse --revs-only --no-flags "$@") &&
173186
w_tree=$(git rev-parse --verify "$s:") &&
174187
b_tree=$(git rev-parse --verify "$s^1:") &&
175188
i_tree=$(git rev-parse --verify "$s^2:") ||

git.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ static int handle_alias(int *argcp, const char ***argv)
162162
alias_string + 1, alias_command);
163163
}
164164
count = split_cmdline(alias_string, &new_argv);
165+
if (count < 0)
166+
die("Bad alias.%s string", alias_command);
165167
option_count = handle_options(&new_argv, &count, &envchanged);
166168
if (envchanged)
167169
die("alias '%s' changes environment variables\n"

t/t1300-repo-config.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,4 +741,14 @@ test_expect_success 'symlinked configuration' '
741741
742742
'
743743

744+
test_expect_success 'check split_cmdline return' "
745+
git config alias.split-cmdline-fix 'echo \"' &&
746+
test_must_fail git split-cmdline-fix &&
747+
echo foo > foo &&
748+
git add foo &&
749+
git commit -m 'initial commit' &&
750+
git config branch.master.mergeoptions 'echo \"' &&
751+
test_must_fail git merge master
752+
"
753+
744754
test_done

0 commit comments

Comments
 (0)