<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/commit.c, branch v2.26.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-02-14T20:54:24Z</updated>
<entry>
<title>Merge branch 'tb/commit-graph-object-dir'</title>
<updated>2020-02-14T20:54:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-14T20:54:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=53c3be2c29b97a68145d42b413df2f8c070a2084'/>
<id>urn:sha1:53c3be2c29b97a68145d42b413df2f8c070a2084</id>
<content type='text'>
The code to compute the commit-graph has been taught to use a more
robust way to tell if two object directories refer to the same
thing.

* tb/commit-graph-object-dir:
  commit-graph.h: use odb in 'load_commit_graph_one_fd_st'
  commit-graph.c: remove path normalization, comparison
  commit-graph.h: store object directory in 'struct commit_graph'
  commit-graph.h: store an odb in 'struct write_commit_graph_context'
  t5318: don't pass non-object directory to '--object-dir'
</content>
</entry>
<entry>
<title>Merge branch 'js/patch-mode-in-others-in-c'</title>
<updated>2020-02-05T22:34:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-05T22:34:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a5315edfdf662c4d9bf444ebc297bc802fa5e04'/>
<id>urn:sha1:9a5315edfdf662c4d9bf444ebc297bc802fa5e04</id>
<content type='text'>
The effort to move "git-add--interactive" to C continues.

* js/patch-mode-in-others-in-c:
  commit --interactive: make it work with the built-in `add -i`
  built-in add -p: implement the "worktree" patch modes
  built-in add -p: implement the "checkout" patch modes
  built-in stash: use the built-in `git add -p` if so configured
  legacy stash -p: respect the add.interactive.usebuiltin setting
  built-in add -p: implement the "stash" and "reset" patch modes
  built-in add -p: prepare for patch modes other than "stage"
</content>
</entry>
<entry>
<title>commit-graph.h: store an odb in 'struct write_commit_graph_context'</title>
<updated>2020-02-04T19:36:37Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-02-04T05:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0bd52e27e315a76d6950fa30ce602eef15d90571'/>
<id>urn:sha1:0bd52e27e315a76d6950fa30ce602eef15d90571</id>
<content type='text'>
There are lots of places in 'commit-graph.h' where a function either has
(or almost has) a full 'struct object_directory *', accesses '-&gt;path',
and then throws away the rest of the struct.

This can cause headaches when comparing the locations of object
directories across alternates (e.g., in the case of deciding if two
commit-graph layers can be merged). These paths are normalized with
'normalize_path_copy()' which mitigates some comparison issues, but not
all [1].

Replace usage of 'char *object_dir' with 'odb-&gt;path' by storing a
'struct object_directory *' in the 'write_commit_graph_context'
structure. This is an intermediate step towards getting rid of all path
normalization in 'commit-graph.c'.

Resolving a user-provided '--object-dir' argument now requires that we
compare it to the known alternates for equality.  Prior to this patch,
an unknown '--object-dir' argument would silently exit with status zero.

This can clearly lead to unintended behavior, such as verifying
commit-graphs that aren't in a repository's own object store (or one of
its alternates), or causing a typo to mask a legitimate commit-graph
verification failure. Make this error non-silent by 'die()'-ing when the
given '--object-dir' does not match any known alternate object store.

[1]: In my testing, for example, I can get one side of the commit-graph
code to fill object_dir with "./objects" and the other with just
"objects".

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hw/commit-advise-while-rejecting'</title>
<updated>2020-01-22T23:07:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-01-22T23:07:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9403e5dcdd50661a31f7d5103c150a95ab9f0529'/>
<id>urn:sha1:9403e5dcdd50661a31f7d5103c150a95ab9f0529</id>
<content type='text'>
"git commit" gives output similar to "git status" when there is
nothing to commit, but without honoring the advise.statusHints
configuration variable, which has been corrected.

* hw/commit-advise-while-rejecting:
  commit: honor advice.statusHints when rejecting an empty commit
</content>
</entry>
<entry>
<title>Merge branch 'am/pathspec-from-file'</title>
<updated>2019-12-25T19:21:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-25T19:21:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ff0cb70d456f586c94f15daa67d2ff1bb8e75fb6'/>
<id>urn:sha1:ff0cb70d456f586c94f15daa67d2ff1bb8e75fb6</id>
<content type='text'>
An earlier series to teach "--pathspec-from-file" to "git commit"
forgot to make the option incompatible with "--all", which has been
corrected.

* am/pathspec-from-file:
  commit: forbid --pathspec-from-file --all
</content>
</entry>
<entry>
<title>commit --interactive: make it work with the built-in `add -i`</title>
<updated>2019-12-22T00:06:22Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-12-21T21:57:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c480eeb574e649a19f27dc09a994e45f9b2c2622'/>
<id>urn:sha1:c480eeb574e649a19f27dc09a994e45f9b2c2622</id>
<content type='text'>
The built-in `git add -i` machinery obviously has its `the_repository`
structure initialized at the point where `cmd_commit()` calls it, and
therefore does not look at the environment variable `GIT_INDEX_FILE`.

But when being called from `commit --interactive`, it has to, because
the index was already locked in that case, and we want to ask the
interactive add machinery to work on the `index.lock` file instead of
the `index` file.

Technically, we could teach `run_add_i()`, or for that matter
`run_add_p()`, to look specifically at that environment variable, but
the entire idea of passing in a parameter of type `struct repository *`
is to allow working on multiple repositories (and their index files)
independently.

So let's instead override the `index_file` field of that structure
temporarily.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: honor advice.statusHints when rejecting an empty commit</title>
<updated>2019-12-19T19:58:08Z</updated>
<author>
<name>Heba Waly</name>
<email>heba.waly@gmail.com</email>
</author>
<published>2019-12-17T09:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5c4f55f1f62b64f530bd135e5b248ceba7b95708'/>
<id>urn:sha1:5c4f55f1f62b64f530bd135e5b248ceba7b95708</id>
<content type='text'>
In ea9882bfc4 (commit: disable status hints when writing to
COMMIT_EDITMSG, 2013-09-12) the intent was to disable status hints
when writing to COMMIT_EDITMSG, because giving the hints in the "git
status" like output in the commit message template are too late to
be useful (they say things like "'git add' to stage", but that is
only possible after aborting the current "git commit" session).

But there is one case that the hints can be useful: When the current
attempt to commit is rejected because no change is recorded in the
index.  The message is given and "git commit" errors out, so the
hints can immediately be followed by the user.  Teach the codepath
to honor the configuration variable.

Signed-off-by: Heba Waly &lt;heba.waly@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: forbid --pathspec-from-file --all</title>
<updated>2019-12-18T22:14:14Z</updated>
<author>
<name>Alexandr Miloslavskiy</name>
<email>alexandr.miloslavskiy@syntevo.com</email>
</author>
<published>2019-12-16T15:47:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=509efef789de51f5d68e5c9799918f9a5ea09670'/>
<id>urn:sha1:509efef789de51f5d68e5c9799918f9a5ea09670</id>
<content type='text'>
I forgot this in my previous patch `--pathspec-from-file` for
`git commit` [1]. When both `--pathspec-from-file` and `--all` were
specified, `--all` took precedence and `--pathspec-from-file` was
ignored. Before `--pathspec-from-file` was implemented, this case was
prevented by this check in `parse_and_validate_options()` :

    die(_("paths '%s ...' with -a does not make sense"), argv[0]);

It is unfortunate that these two cases are disconnected. This came as
result of how the code was laid out before my patches, where `pathspec`
is parsed outside of `parse_and_validate_options()`. This branch is
already full of refactoring patches and I did not dare to go for another
one.

Fix by mirroring `die()` for `--pathspec-from-file` as well.

[1] Commit e440fc58 ("commit: support the --pathspec-from-file option" 2019-11-19)

Reported-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Alexandr Miloslavskiy &lt;alexandr.miloslavskiy@syntevo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/commit-export-env-simplify'</title>
<updated>2019-12-16T21:14:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-16T21:14:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e3b72391d1ab9fb55a8c22a06501d7a8d7c5e02a'/>
<id>urn:sha1:e3b72391d1ab9fb55a8c22a06501d7a8d7c5e02a</id>
<content type='text'>
Code cleanup.

* rs/commit-export-env-simplify:
  commit: use strbuf_add() to add a length-limited string
</content>
</entry>
<entry>
<title>Merge branch 'am/pathspec-from-file'</title>
<updated>2019-12-10T21:11:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-10T21:11:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c58ae96fc4bb11916b62a96940bb70bb85ea5992'/>
<id>urn:sha1:c58ae96fc4bb11916b62a96940bb70bb85ea5992</id>
<content type='text'>
A few commands learned to take the pathspec from the
standard input or a named file, instead of taking it as the command
line arguments.

* am/pathspec-from-file:
  commit: support the --pathspec-from-file option
  doc: commit: synchronize &lt;pathspec&gt; description
  reset: support the `--pathspec-from-file` option
  doc: reset: synchronize &lt;pathspec&gt; description
  pathspec: add new function to parse file
  parse-options.h: add new options `--pathspec-from-file`, `--pathspec-file-nul`
</content>
</entry>
</feed>
