Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Documentation/RelNotes/2.51.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ UI, Workflows & Features
which is its modern rough equivalent has outlived its usefulness
more than 10 years ago. Plan to deprecate and remove it.

* An interchange format for stash entries is defined, and subcommand
of "git stash" to import/export has been added.

* "git merge/pull" has been taught the "--compact-summary" option to
use the compact-summary format, intead of diffstat, when showing
the summary of the incoming changes.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand All @@ -41,6 +48,9 @@ Performance, Internal Implementation, Development Support etc.
* "Do not explicitly initialize to zero" rule has been clarified in
the CodingGuidelines document.

* A test helper "test_seq" function learned the "-f <fmt>" option,
which allowed us to simplify a lot of test scripts.


Fixes since v2.50
-----------------
Expand Down Expand Up @@ -78,6 +88,11 @@ Fixes since v2.50
has been remedied.
(merge 1b5074e614 ps/maintenance-ref-lock later to maint).

* Avoid regexp_constraint and instead use comparison_constraint when
listing functions to exclude from application of coccinelle rules,
as spatch can be built with different regexp engine X-<.
(merge f2ad545813 jc/cocci-avoid-regexp-constraint later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge b257adb571 lo/my-first-ow-doc-update later to maint).
(merge 8b34b6a220 ly/sequencer-update-squash-is-fixup-only later to maint).
Expand Down
14 changes: 12 additions & 2 deletions Documentation/config/merge.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,18 @@ as `false`. Defaults to `conflict`.
attributes" in linkgit:gitattributes[5].

`merge.stat`::
Whether to print the diffstat between `ORIG_HEAD` and the merge result
at the end of the merge. True by default.
What, if anything, to print between `ORIG_HEAD` and the merge result
at the end of the merge. Possible values are:
+
--
`false`;; Show nothing.
`true`;; Show `git diff --diffstat --summary ORIG_HEAD`.
`compact`;; Show `git diff --compact-summary ORIG_HEAD`.
--
+
but any unrecognised value (e.g., a value added by a future version of
Git) is taken as `true` instead of triggering an error. Defaults to
`true`.

`merge.autoStash`::
When set to `true`, automatically create a temporary stash entry
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-merge.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-merge - Join two or more development histories together
SYNOPSIS
--------
[synopsis]
git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
git merge [-n] [--stat] [--compact-summary] [--no-commit] [--squash] [--[no-]edit]
[--no-verify] [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
[--[no-]allow-unrelated-histories]
[--[no-]rerere-autoupdate] [-m <msg>] [-F <file>]
Expand Down
29 changes: 28 additions & 1 deletion Documentation/git-stash.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ SYNOPSIS
'git stash' clear
'git stash' create [<message>]
'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>
'git stash' export (--print | --to-ref <ref>) [<stash>...]
'git stash' import <commit>

DESCRIPTION
-----------
Expand Down Expand Up @@ -154,6 +156,18 @@ store::
reflog. This is intended to be useful for scripts. It is
probably not the command you want to use; see "push" above.

export ( --print | --to-ref <ref> ) [<stash>...]::

Export the specified stashes, or all of them if none are specified, to
a chain of commits which can be transferred using the normal fetch and
push mechanisms, then imported using the `import` subcommand.

import <commit>::

Import the specified stashes from the specified commit, which must have been
created by `export`, and add them to the list of stashes. To replace the
existing stashes, use `clear` first.

OPTIONS
-------
-a::
Expand Down Expand Up @@ -242,6 +256,19 @@ literally (including newlines and quotes).
+
Quiet, suppress feedback messages.

--print::
This option is only valid for the `export` command.
+
Create the chain of commits representing the exported stashes without
storing it anywhere in the ref namespace and print the object ID to
standard output. This is designed for scripts.

--to-ref::
This option is only valid for the `export` command.
+
Create the chain of commits representing the exported stashes and store
it to the specified ref.

\--::
This option is only valid for `push` command.
+
Expand All @@ -259,7 +286,7 @@ For more details, see the 'pathspec' entry in linkgit:gitglossary[7].

<stash>::
This option is only valid for `apply`, `branch`, `drop`, `pop`,
`show` commands.
`show`, and `export` commands.
+
A reference of the form `stash@{<revision>}`. When no `<stash>` is
given, the latest stash is assumed (that is, `stash@{0}`).
Expand Down
3 changes: 3 additions & 0 deletions Documentation/merge-options.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ include::signoff-option.adoc[]
With `-n` or `--no-stat` do not show a diffstat at the end of the
merge.

`--compact-summary`::
Show a compact-summary at the end of the merge.

`--squash`::
`--no-squash`::
Produce the working tree and index state as if a real merge
Expand Down
66 changes: 62 additions & 4 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ static const char * const builtin_merge_usage[] = {
NULL
};

static int show_diffstat = 1, shortlog_len = -1, squash;
#define MERGE_SHOW_DIFFSTAT 1
#define MERGE_SHOW_COMPACTSUMMARY 2

static int show_diffstat = MERGE_SHOW_DIFFSTAT, shortlog_len = -1, squash;
static int option_commit = -1;
static int option_edit = -1;
static int allow_trivial = 1, have_message, verify_signatures;
Expand Down Expand Up @@ -243,12 +246,28 @@ static int option_parse_strategy(const struct option *opt UNUSED,
return 0;
}

static int option_parse_compact_summary(const struct option *opt,
const char *name UNUSED, int unset)
{
int *setting = opt->value;

if (unset)
*setting = 0;
else
*setting = MERGE_SHOW_COMPACTSUMMARY;
return 0;
}

static struct option builtin_merge_options[] = {
OPT_SET_INT('n', NULL, &show_diffstat,
N_("do not show a diffstat at the end of the merge"), 0),
OPT_BOOL(0, "stat", &show_diffstat,
N_("show a diffstat at the end of the merge")),
OPT_BOOL(0, "summary", &show_diffstat, N_("(synonym to --stat)")),
OPT_CALLBACK_F(0, "compact-summary", &show_diffstat, N_("compact-summary"),
N_("show a compact-summary at the end of the merge"),
PARSE_OPT_NOARG,
option_parse_compact_summary),
{
.type = OPTION_INTEGER,
.long_name = "log",
Expand Down Expand Up @@ -494,8 +513,19 @@ static void finish(struct commit *head_commit,
struct diff_options opts;
repo_diff_setup(the_repository, &opts);
init_diffstat_widths(&opts);
opts.output_format |=
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;

switch (show_diffstat) {
case MERGE_SHOW_DIFFSTAT: /* 1 */
opts.output_format |=
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
break;
case MERGE_SHOW_COMPACTSUMMARY: /* 2 */
opts.output_format |= DIFF_FORMAT_DIFFSTAT;
opts.flags.stat_with_summary = 1;
break;
default:
break;
}
opts.detect_rename = DIFF_DETECT_RENAME;
diff_setup_done(&opts);
diff_tree_oid(head, new_head, "", &opts);
Expand Down Expand Up @@ -643,7 +673,35 @@ static int git_merge_config(const char *k, const char *v,
}

if (!strcmp(k, "merge.diffstat") || !strcmp(k, "merge.stat")) {
show_diffstat = git_config_bool(k, v);
int val = git_parse_maybe_bool_text(v);
switch (val) {
case 0:
show_diffstat = 0;
break;
case 1:
show_diffstat = MERGE_SHOW_DIFFSTAT;
break;
default:
if (!strcmp(v, "compact"))
show_diffstat = MERGE_SHOW_COMPACTSUMMARY;
/*
* We do not need to have an explicit
*
* else if (!strcmp(v, "diffstat"))
* show_diffstat = MERGE_SHOW_DIFFSTAT;
*
* here, because the catch-all uses the
* diffstat style anyway.
*/
else
/*
* A setting from a future? It is not an
* error grave enough to fail the command.
* proceed using the default one.
*/
show_diffstat = MERGE_SHOW_DIFFSTAT;
break;
}
} else if (!strcmp(k, "merge.verifysignatures")) {
verify_signatures = git_config_bool(k, v);
} else if (!strcmp(k, "pull.twohead")) {
Expand Down
3 changes: 3 additions & 0 deletions builtin/pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ static struct option pull_options[] = {
OPT_PASSTHRU(0, "summary", &opt_diffstat, NULL,
N_("(synonym to --stat)"),
PARSE_OPT_NOARG | PARSE_OPT_HIDDEN),
OPT_PASSTHRU(0, "compact-summary", &opt_diffstat, NULL,
N_("show a compact-summary at the end of the merge"),
PARSE_OPT_NOARG),
OPT_PASSTHRU(0, "log", &opt_log, N_("n"),
N_("add (at most <n>) entries from shortlog to merge commit message"),
PARSE_OPT_OPTARG),
Expand Down
Loading