1
0
mirror of https://github.com/git/git.git synced 2025-03-15 14:11:54 +00:00

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
This commit is contained in:
Shawn O. Pearce 2008-09-25 08:27:53 -07:00
commit c9c6cc8d7d
7 changed files with 49 additions and 6 deletions

View File

@ -16,6 +16,22 @@ Fixes since v1.6.0.2
* Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code" * Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code"
with the output redirected to /dev/null. with the output redirected to /dev/null.
* "git stash apply sash@{1}" was fixed to error out. Prior versions
would have applied stash@{0} incorrectly.
* "git for-each-ref --format=%(subject)" fixed for commits with no
no newline in the message body.
* "git remote" fixed to protect printf from user input.
* "git checkout -q" once again suppresses the locally modified file list.
* Cross-directory renames are no longer used when creating packs. This
allows more graceful behavior on filesystems like sshfs.
* Stale temporary files under $GIT_DIR/objects/pack are now cleaned up
automatically by "git prune".
* "Git.pm" tests relied on unnecessarily more recent version of Perl. * "Git.pm" tests relied on unnecessarily more recent version of Perl.
* "gitweb" triggered undef warning on commits without log messages. * "gitweb" triggered undef warning on commits without log messages.
@ -24,6 +40,6 @@ Many other documentation updates.
-- --
exec >/var/tmp/1 exec >/var/tmp/1
O=v1.6.0.2-32-g8d11fde O=v1.6.0.2-41-g7fe4a72
echo O=$(git describe maint) echo O=$(git describe maint)
git shortlog --no-merges $O..maint git shortlog --no-merges $O..maint

View File

@ -328,7 +328,7 @@ static int merge_working_tree(struct checkout_opts *opts,
commit_locked_index(lock_file)) commit_locked_index(lock_file))
die("unable to write new index file"); die("unable to write new index file");
if (!opts->force) if (!opts->force && !opts->quiet)
show_local_changes(&new->commit->object); show_local_changes(&new->commit->object);
return 0; return 0;

View File

@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
static const char *copy_line(const char *buf) static const char *copy_line(const char *buf)
{ {
const char *eol = strchr(buf, '\n'); const char *eol = strchr(buf, '\n');
if (!eol) if (!eol) // simulate strchrnul()
return ""; eol = buf + strlen(buf);
return xmemdupz(buf, eol - buf); return xmemdupz(buf, eol - buf);
} }

View File

@ -476,6 +476,8 @@ static int git_merge_config(const char *k, const char *v, void *cb)
buf = xstrdup(v); buf = xstrdup(v);
argc = split_cmdline(buf, &argv); argc = split_cmdline(buf, &argv);
if (argc < 0)
die("Bad branch.%s.mergeoptions string", branch);
argv = xrealloc(argv, sizeof(*argv) * (argc + 2)); argv = xrealloc(argv, sizeof(*argv) * (argc + 2));
memmove(argv + 1, argv, sizeof(*argv) * (argc + 1)); memmove(argv + 1, argv, sizeof(*argv) * (argc + 1));
argc++; argc++;

View File

@ -144,7 +144,14 @@ show_stash () {
then then
flags=--stat flags=--stat
fi fi
s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@")
if test $# = 0
then
set x "$ref_stash@{0}"
shift
fi
s=$(git rev-parse --revs-only --no-flags "$@")
w_commit=$(git rev-parse --verify "$s") && w_commit=$(git rev-parse --verify "$s") &&
b_commit=$(git rev-parse --verify "$s^") && b_commit=$(git rev-parse --verify "$s^") &&
@ -163,13 +170,19 @@ apply_stash () {
shift shift
esac esac
if test $# = 0
then
set x "$ref_stash@{0}"
shift
fi
# current index state # current index state
c_tree=$(git write-tree) || c_tree=$(git write-tree) ||
die 'Cannot apply a stash in the middle of a merge' die 'Cannot apply a stash in the middle of a merge'
# stash records the work tree, and is a merge between the # stash records the work tree, and is a merge between the
# base commit (first parent) and the index tree (second parent). # base commit (first parent) and the index tree (second parent).
s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@") && s=$(git rev-parse --revs-only --no-flags "$@") &&
w_tree=$(git rev-parse --verify "$s:") && w_tree=$(git rev-parse --verify "$s:") &&
b_tree=$(git rev-parse --verify "$s^1:") && b_tree=$(git rev-parse --verify "$s^1:") &&
i_tree=$(git rev-parse --verify "$s^2:") || i_tree=$(git rev-parse --verify "$s^2:") ||

2
git.c
View File

@ -162,6 +162,8 @@ static int handle_alias(int *argcp, const char ***argv)
alias_string + 1, alias_command); alias_string + 1, alias_command);
} }
count = split_cmdline(alias_string, &new_argv); count = split_cmdline(alias_string, &new_argv);
if (count < 0)
die("Bad alias.%s string", alias_command);
option_count = handle_options(&new_argv, &count, &envchanged); option_count = handle_options(&new_argv, &count, &envchanged);
if (envchanged) if (envchanged)
die("alias '%s' changes environment variables\n" die("alias '%s' changes environment variables\n"

View File

@ -741,4 +741,14 @@ test_expect_success 'symlinked configuration' '
' '
test_expect_success 'check split_cmdline return' "
git config alias.split-cmdline-fix 'echo \"' &&
test_must_fail git split-cmdline-fix &&
echo foo > foo &&
git add foo &&
git commit -m 'initial commit' &&
git config branch.master.mergeoptions 'echo \"' &&
test_must_fail git merge master
"
test_done test_done