<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.c, branch v2.45.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-04-05T17:49:49Z</updated>
<entry>
<title>Merge branch 'jk/core-comment-string'</title>
<updated>2024-04-05T17:49:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-05T17:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dce1e0b6daaa872a3b88724d9aa1b087c95e8754'/>
<id>urn:sha1:dce1e0b6daaa872a3b88724d9aa1b087c95e8754</id>
<content type='text'>
core.commentChar used to be limited to a single byte, but has been
updated to allow an arbitrary multi-byte sequence.

* jk/core-comment-string:
  config: add core.commentString
  config: allow multi-byte core.commentChar
  environment: drop comment_line_char compatibility macro
  wt-status: drop custom comment-char stringification
  sequencer: handle multi-byte comment characters when writing todo list
  find multi-byte comment chars in unterminated buffers
  find multi-byte comment chars in NUL-terminated strings
  prefer comment_line_str to comment_line_char for printing
  strbuf: accept a comment string for strbuf_add_commented_lines()
  strbuf: accept a comment string for strbuf_commented_addf()
  strbuf: accept a comment string for strbuf_stripspace()
  environment: store comment_line_char as a string
  strbuf: avoid shadowing global comment_line_char name
  commit: refactor base-case of adjust_comment_line_char()
  strbuf: avoid static variables in strbuf_add_commented_lines()
  strbuf: simplify comment-handling in add_lines() helper
  config: forbid newline as core.commentChar
</content>
</entry>
<entry>
<title>Merge branch 'rs/config-comment'</title>
<updated>2024-04-05T17:49:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-05T17:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3256584c36f649abb2af58e7b190d3cf674ba56e'/>
<id>urn:sha1:3256584c36f649abb2af58e7b190d3cf674ba56e</id>
<content type='text'>
"git config" learned "--comment=&lt;message&gt;" option to leave a
comment immediately after the "variable = value" on the same line
in the configuration file.

* rs/config-comment:
  config: allow tweaking whitespace between value and comment
  config: fix --comment formatting
  config: add --comment option to add a comment
</content>
</entry>
<entry>
<title>Merge branch 'bl/cherry-pick-empty'</title>
<updated>2024-04-03T17:56:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-03T17:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=17381ab62a2a4634d79c96ee020dce64c3e516b7'/>
<id>urn:sha1:17381ab62a2a4634d79c96ee020dce64c3e516b7</id>
<content type='text'>
Allow git-cherry-pick(1) to automatically drop redundant commits via
a new `--empty` option, similar to the `--empty` options for
git-rebase(1) and git-am(1). Includes a soft deprecation of
`--keep-redundant-commits` as well as some related docs changes and
sequencer code cleanup.

* bl/cherry-pick-empty:
  cherry-pick: add `--empty` for more robust redundant commit handling
  cherry-pick: enforce `--keep-redundant-commits` incompatibility
  sequencer: do not require `allow_empty` for redundant commit options
  sequencer: handle unborn branch with `--allow-empty`
  rebase: update `--empty=ask` to `--empty=stop`
  docs: clean up `--empty` formatting in git-rebase(1) and git-am(1)
  docs: address inaccurate `--empty` default with `--exec`
</content>
</entry>
<entry>
<title>Merge branch 'pb/advice-merge-conflict'</title>
<updated>2024-04-01T20:21:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-01T20:21:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ac16f55697211ae4ef557706a098b8ed34a7fda6'/>
<id>urn:sha1:ac16f55697211ae4ef557706a098b8ed34a7fda6</id>
<content type='text'>
Hints that suggest what to do after resolving conflicts can now be
squelched by disabling advice.mergeConflict.

Acked-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
cf. &lt;e040c631-42d9-4501-a7b8-046f8dac6309@gmail.com&gt;

* pb/advice-merge-conflict:
  builtin/am: allow disabling conflict advice
  sequencer: allow disabling conflict advice
</content>
</entry>
<entry>
<title>cherry-pick: add `--empty` for more robust redundant commit handling</title>
<updated>2024-03-25T23:45:41Z</updated>
<author>
<name>Brian Lyles</name>
<email>brianmlyles@gmail.com</email>
</author>
<published>2024-03-25T23:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec79d763de617905bd9275de0b5941a160d6159b'/>
<id>urn:sha1:ec79d763de617905bd9275de0b5941a160d6159b</id>
<content type='text'>
As with git-rebase(1) and git-am(1), git-cherry-pick(1) can result in a
commit being made redundant if the content from the picked commit is
already present in the target history. However, git-cherry-pick(1) does
not have the same options available that git-rebase(1) and git-am(1) have.

There are three things that can be done with these redundant commits:
drop them, keep them, or have the cherry-pick stop and wait for the user
to take an action. git-rebase(1) has the `--empty` option added in commit
e98c4269c8 (rebase (interactive-backend): fix handling of commits that
become empty, 2020-02-15), which handles all three of these scenarios.
Similarly, git-am(1) got its own `--empty` in 7c096b8d61 (am: support
--empty=&lt;option&gt; to handle empty patches, 2021-12-09).

git-cherry-pick(1), on the other hand, only supports two of the three
possiblities: Keep the redundant commits via `--keep-redundant-commits`,
or have the cherry-pick fail by not specifying that option. There is no
way to automatically drop redundant commits.

In order to bring git-cherry-pick(1) more in-line with git-rebase(1) and
git-am(1), this commit adds an `--empty` option to git-cherry-pick(1). It
has the same three options (keep, drop, and stop), and largely behaves
the same. The notable difference is that for git-cherry-pick(1), the
default will be `stop`, which maintains the current behavior when the
option is not specified.

Like the existing `--keep-redundant-commits`, `--empty=keep` will imply
`--allow-empty`.

The `--keep-redundant-commits` option will be documented as a deprecated
synonym of `--empty=keep`, and will be supported for backwards
compatibility for the time being.

Signed-off-by: Brian Lyles &lt;brianmlyles@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: do not require `allow_empty` for redundant commit options</title>
<updated>2024-03-25T23:45:40Z</updated>
<author>
<name>Brian Lyles</name>
<email>brianmlyles@gmail.com</email>
</author>
<published>2024-03-25T23:16:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=661b671aec3683718fe58f78f85359a11f57a57a'/>
<id>urn:sha1:661b671aec3683718fe58f78f85359a11f57a57a</id>
<content type='text'>
A consumer of the sequencer that wishes to take advantage of either the
`keep_redundant_commits` or `drop_redundant_commits` feature must also
specify `allow_empty`. However, these refer to two distinct types of
empty commits:

- `allow_empty` refers specifically to commits which start empty
- `keep_redundant_commits` refers specifically to commits that do not
  start empty, but become empty due to the content already existing in
  the target history

Conceptually, there is no reason that the behavior for handling one of
these should be entangled with the other. It is particularly unintuitive
to require `allow_empty` in order for `drop_redundant_commits` to have
an effect: in order to prevent redundant commits automatically,
initially-empty commits would need to be kept automatically as well.

Instead, rewrite the `allow_empty()` logic to remove the over-arching
requirement that `allow_empty` be specified in order to reach any of the
keep/drop behaviors. Only if the commit was originally empty will
`allow_empty` have an effect.

Note that no behavioral changes should result from this commit -- it
merely sets the stage for future commits. In one such future commit, an
`--empty` option will be added to git-cherry-pick(1), meaning that
`drop_redundant_commits` will be used by that command.

Signed-off-by: Brian Lyles &lt;brianmlyles@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: handle unborn branch with `--allow-empty`</title>
<updated>2024-03-25T23:45:40Z</updated>
<author>
<name>Brian Lyles</name>
<email>brianmlyles@gmail.com</email>
</author>
<published>2024-03-25T23:16:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1b90588d620a2970c82025c272e14f32d5e5969d'/>
<id>urn:sha1:1b90588d620a2970c82025c272e14f32d5e5969d</id>
<content type='text'>
When using git-cherry-pick(1) with `--allow-empty` while on an unborn
branch, an error is thrown. This is inconsistent with the same
cherry-pick when `--allow-empty` is not specified.

Detect unborn branches in `is_index_unchanged`. When on an unborn
branch, use the `empty_tree` as the tree to compare against.

Add a new test to cover this scenario. While modelled off of the
existing 'cherry-pick on unborn branch' test, some improvements can be
made:

- Use `git switch --orphan unborn` instead of `git checkout --orphan
  unborn` to avoid the need for a separate `rm -rf *` call
- Avoid using `--quiet` in the `git diff` call to make debugging easier
  in the event of a failure. Use simply `--exit-code` instead.

Make these improvements to the existing test as well as the new test.

Helped-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Brian Lyles &lt;brianmlyles@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pw/rebase-i-ignore-cherry-pick-help-environment'</title>
<updated>2024-03-18T20:04:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-18T20:04:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=184969ce1d7c560e0afeaec388939c11a0a990dc'/>
<id>urn:sha1:184969ce1d7c560e0afeaec388939c11a0a990dc</id>
<content type='text'>
Code simplification by getting rid of code that sets an environment
variable that is no longer used.

* pw/rebase-i-ignore-cherry-pick-help-environment:
  rebase -i: stop setting GIT_CHERRY_PICK_HELP
</content>
</entry>
<entry>
<title>sequencer: allow disabling conflict advice</title>
<updated>2024-03-18T16:28:40Z</updated>
<author>
<name>Philippe Blain</name>
<email>levraiphilippeblain@gmail.com</email>
</author>
<published>2024-03-16T21:16:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec0300914b42277077f51a8c7e3438d7565eb261'/>
<id>urn:sha1:ec0300914b42277077f51a8c7e3438d7565eb261</id>
<content type='text'>
Allow disabling the advice shown when a squencer operation results in a
merge conflict through a new config 'advice.mergeConflict', which is
named generically such that it can be used by other commands eventually.

Remove that final '\n' in the first hunk in sequencer.c to avoid an
otherwise empty 'hint: ' line before the line 'hint: Disable this
message with "git config advice.mergeConflict false"' which is
automatically added by 'advise_if_enabled'.

Note that we use 'advise_if_enabled' for each message in the second hunk
in sequencer.c, instead of using 'if (show_hints &amp;&amp;
advice_enabled(...)', because the former instructs the user how to
disable the advice, which is more user-friendly.

Update the tests accordingly. Note that the body of the second test in
t3507-cherry-pick-conflict.sh is enclosed in double quotes, so we must
escape them in the added line. Note that t5520-pull.sh, which checks
that we display the advice for 'git rebase' (via 'git pull --rebase')
does not have to be updated because it only greps for a specific line in
the advice message.

Signed-off-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: add --comment option to add a comment</title>
<updated>2024-03-15T19:25:35Z</updated>
<author>
<name>Ralph Seichter</name>
<email>github@seichter.de</email>
</author>
<published>2024-03-12T21:47:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=42d5c033945e4fc41d7268bfe4284d37651986b8'/>
<id>urn:sha1:42d5c033945e4fc41d7268bfe4284d37651986b8</id>
<content type='text'>
Introduce the ability to append comments to modifications
made using git-config. Example usage:

  git config --comment "changed via script" \
    --add safe.directory /home/alice/repo.git

based on the proposed patch, the output produced is:

  [safe]
    directory = /home/alice/repo.git #changed via script

Users need to be able to distinguish between config entries made
using automation and entries made by a human. Automation can add
comments containing a URL pointing to explanations for the change
made, avoiding questions from users as to why their config file
was changed by a third party.

The implementation ensures that a # character is unconditionally
prepended to the provided comment string, and that the comment
text is appended as a suffix to the changed key-value-pair in the
same line of text. Multi-line comments (i.e. comments containing
linefeed) are rejected as errors, causing Git to exit without
making changes.

Comments are aimed at humans who inspect or change their Git
config using a pager or editor. Comments are not meant to be
read or displayed by git-config at a later time.

Signed-off-by: Ralph Seichter &lt;github@seichter.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
