mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Git 2.41-rc0
-----BEGIN PGP SIGNATURE----- iQIyBAABCAAdFiEE4fA2sf7nIh/HeOzvsLXohpav5ssFAmRiqa0ACgkQsLXohpav 5st3eA/3VLq2mCFF4YmnFIENs4N8JHWID4P8oj7qyBUkuu5LsomCJNydDETc4CHs 3ECwSAejL9nCV+GsKDCslWS8MNZMy2NZI4x9CbAMXC0/+COYahtx0Va7g+wFaHcU 5gqBDP8FPPvO+JTzWMYsrtc6na29lfvclJMMWfFXu+IQQfcB+v597sirVeb6cscU BbknKRAIbZwi1kBohnE9CvoN+oJu93DvuplgBsNGzZrX1PCveUYU/ZmnQ16yMyYl s8Je8Bvfah/l/f1rmUoEzNTm2eE3e5bsGxBRzZUMlRP5KzMo1VU8BmNWXtJPpiMx W92Zgp5I2ZSucaGFzkYInyEYAwsUOwZZMySWLDDpd62KzCzfArmTFJNS2Y/XsQuJ khYK/zqX+tJr873smWi2cV6pRkME+hdGllQw0R7mtmqP13If7OaIsLPLYbyp/S+B gxMa7HJE8bgQCuTS3160B+RuKN9zJIt1Vq34FtVaBLknTPqisdD2N9eJkqCIA46f Guide91ZwVBr65yP7KkYVj/rbVY7vPFWsy5YBwuPqphPZ+KdcqOApvXtuLhNQVtX 0Vxy57GjaakPpYy12TmKGASlCdHzk/Ct8MWhItj8v4WxrR5EllqDujz2AF2gWHPM ae7oDPsTb9W/SS5f8bEJ14+wuJhGhMZ49VkvqpUVXZb54QDNeA== =keY2 -----END PGP SIGNATURE----- Merge tag 'v2.41.0-rc0' Git 2.41-rc0 * tag 'v2.41.0-rc0': (508 commits) Git 2.41-rc0 t5583: fix shebang line merge-tree: load default git config fetch: introduce machine-parseable "porcelain" output format fetch: move option related variables into main function fetch: lift up parsing of "fetch.output" config variable fetch: introduce `display_format` enum fetch: refactor calculation of the display table width fetch: print left-hand side when fetching HEAD:foo fetch: add a test to exercise invalid output formats fetch: split out tests for output format fetch: fix `--no-recurse-submodules` with multi-remote fetches The eighteenth batch The seventeenth batch diff-files: integrate with sparse index t1092: add tests for `git diff-files` test: rev-parse-upstream: add missing cmp t: drop "verbose" helper function t7001: use "ls-files --format" instead of "cut" t7001: avoid git on upstream of pipe ...
This commit is contained in:
commit
03d05937a7
1
.mailmap
1
.mailmap
|
@ -65,6 +65,7 @@ Derrick Stolee <derrickstolee@github.com> <dstolee@microsoft.com>
|
|||
Deskin Miller <deskinm@umich.edu>
|
||||
Đoàn Trần Công Danh <congdanhqx@gmail.com> Doan Tran Cong Danh
|
||||
Dirk Süsserott <newsletter@dirk.my1.cc>
|
||||
Emily Shaffer <nasamuffin@google.com> <emilyshaffer@google.com>
|
||||
Eric Blake <eblake@redhat.com> <ebb9@byu.net>
|
||||
Eric Hanchrow <eric.hanchrow@gmail.com> <offby1@blarg.net>
|
||||
Eric S. Raymond <esr@thyrsus.com>
|
||||
|
|
1
Documentation/.gitignore
vendored
1
Documentation/.gitignore
vendored
|
@ -10,7 +10,6 @@ howto-index.txt
|
|||
doc.dep
|
||||
cmds-*.txt
|
||||
mergetools-*.txt
|
||||
manpage-base-url.xsl
|
||||
SubmittingPatches.txt
|
||||
tmp-doc-diff/
|
||||
GIT-ASCIIDOCFLAGS
|
||||
|
|
|
@ -442,8 +442,12 @@ For C programs:
|
|||
detail.
|
||||
|
||||
- The first #include in C files, except in platform specific compat/
|
||||
implementations, must be either "git-compat-util.h", "cache.h" or
|
||||
"builtin.h". You do not have to include more than one of these.
|
||||
implementations and sha1dc/, must be either "git-compat-util.h" or
|
||||
one of the approved headers that includes it first for you. (The
|
||||
approved headers currently include "cache.h", "builtin.h",
|
||||
"t/helper/test-tool.h", "xdiff/xinclude.h", or
|
||||
"reftable/system.h"). You do not have to include more than one of
|
||||
these.
|
||||
|
||||
- A C file must directly include the header files that declare the
|
||||
functions and the types it uses, except for the functions and types
|
||||
|
|
|
@ -144,14 +144,16 @@ man5dir = $(mandir)/man5
|
|||
man7dir = $(mandir)/man7
|
||||
# DESTDIR =
|
||||
|
||||
GIT_DATE := $(shell git show --quiet --pretty='%as')
|
||||
|
||||
ASCIIDOC = asciidoc
|
||||
ASCIIDOC_EXTRA =
|
||||
ASCIIDOC_HTML = xhtml11
|
||||
ASCIIDOC_DOCBOOK = docbook
|
||||
ASCIIDOC_CONF = -f asciidoc.conf
|
||||
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
|
||||
-amanversion=$(GIT_VERSION) \
|
||||
-amanmanual='Git Manual' -amansource='Git'
|
||||
-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
|
||||
-arevdate='$(GIT_DATE)'
|
||||
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
|
||||
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
|
||||
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
|
||||
|
@ -189,15 +191,7 @@ endif
|
|||
ifndef MAN_BASE_URL
|
||||
MAN_BASE_URL = file://$(htmldir)/
|
||||
endif
|
||||
XMLTO_EXTRA += -m manpage-base-url.xsl
|
||||
|
||||
# If your target system uses GNU groff, it may try to render
|
||||
# apostrophes as a "pretty" apostrophe using unicode. This breaks
|
||||
# cut&paste, so you should set GNU_ROFF to force them to be ASCII
|
||||
# apostrophes. Unfortunately does not work with non-GNU roff.
|
||||
ifdef GNU_ROFF
|
||||
XMLTO_EXTRA += -m manpage-quote-apos.xsl
|
||||
endif
|
||||
XMLTO_EXTRA += --stringparam man.base.url.for.relative.links='$(MAN_BASE_URL)'
|
||||
|
||||
ifdef USE_ASCIIDOCTOR
|
||||
ASCIIDOC = asciidoctor
|
||||
|
@ -339,7 +333,6 @@ clean:
|
|||
$(RM) technical/*.html technical/api-index.txt
|
||||
$(RM) SubmittingPatches.txt
|
||||
$(RM) $(cmds_txt) $(mergetools_txt) *.made
|
||||
$(RM) manpage-base-url.xsl
|
||||
$(RM) GIT-ASCIIDOCFLAGS
|
||||
|
||||
$(MAN_HTML): %.html : %.txt $(ASCIIDOC_DEPS)
|
||||
|
@ -348,11 +341,7 @@ $(MAN_HTML): %.html : %.txt $(ASCIIDOC_DEPS)
|
|||
$(OBSOLETE_HTML): %.html : %.txto $(ASCIIDOC_DEPS)
|
||||
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) -o $@ $<
|
||||
|
||||
manpage-base-url.xsl: manpage-base-url.xsl.in
|
||||
$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
|
||||
|
||||
|
||||
manpage-prereqs := manpage-base-url.xsl $(wildcard manpage*.xsl)
|
||||
manpage-prereqs := $(wildcard manpage*.xsl)
|
||||
manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
|
||||
|
||||
%.1 : %.xml $(manpage-prereqs)
|
||||
|
|
|
@ -1164,28 +1164,28 @@ After you run this command, `format-patch` will output the patches to the `psuh/
|
|||
directory, alongside the v1 patches. Using a single directory makes it easy to
|
||||
refer to the old v1 patches while proofreading the v2 patches, but you will need
|
||||
to be careful to send out only the v2 patches. We will use a pattern like
|
||||
"psuh/v2-*.patch" (not "psuh/*.patch", which would match v1 and v2 patches).
|
||||
`psuh/v2-*.patch` (not `psuh/*.patch`, which would match v1 and v2 patches).
|
||||
|
||||
Edit your cover letter again. Now is a good time to mention what's different
|
||||
between your last version and now, if it's something significant. You do not
|
||||
need the exact same body in your second cover letter; focus on explaining to
|
||||
reviewers the changes you've made that may not be as visible.
|
||||
|
||||
You will also need to go and find the Message-Id of your previous cover letter.
|
||||
You will also need to go and find the Message-ID of your previous cover letter.
|
||||
You can either note it when you send the first series, from the output of `git
|
||||
send-email`, or you can look it up on the
|
||||
https://lore.kernel.org/git[mailing list]. Find your cover letter in the
|
||||
archives, click on it, then click "permalink" or "raw" to reveal the Message-Id
|
||||
archives, click on it, then click "permalink" or "raw" to reveal the Message-ID
|
||||
header. It should match:
|
||||
|
||||
----
|
||||
Message-Id: <foo.12345.author@example.com>
|
||||
Message-ID: <foo.12345.author@example.com>
|
||||
----
|
||||
|
||||
Your Message-Id is `<foo.12345.author@example.com>`. This example will be used
|
||||
below as well; make sure to replace it with the correct Message-Id for your
|
||||
**previous cover letter** - that is, if you're sending v2, use the Message-Id
|
||||
from v1; if you're sending v3, use the Message-Id from v2.
|
||||
Your Message-ID is `<foo.12345.author@example.com>`. This example will be used
|
||||
below as well; make sure to replace it with the correct Message-ID for your
|
||||
**previous cover letter** - that is, if you're sending v2, use the Message-ID
|
||||
from v1; if you're sending v3, use the Message-ID from v2.
|
||||
|
||||
While you're looking at the email, you should also note who is CC'd, as it's
|
||||
common practice in the mailing list to keep all CCs on a thread. You can add
|
||||
|
|
43
Documentation/RelNotes/2.30.9.txt
Normal file
43
Documentation/RelNotes/2.30.9.txt
Normal file
|
@ -0,0 +1,43 @@
|
|||
Git v2.30.9 Release Notes
|
||||
=========================
|
||||
|
||||
This release addresses the security issues CVE-2023-25652,
|
||||
CVE-2023-25815, and CVE-2023-29007.
|
||||
|
||||
|
||||
Fixes since v2.30.8
|
||||
-------------------
|
||||
|
||||
* CVE-2023-25652:
|
||||
|
||||
By feeding specially crafted input to `git apply --reject`, a
|
||||
path outside the working tree can be overwritten with partially
|
||||
controlled contents (corresponding to the rejected hunk(s) from
|
||||
the given patch).
|
||||
|
||||
* CVE-2023-25815:
|
||||
|
||||
When Git is compiled with runtime prefix support and runs without
|
||||
translated messages, it still used the gettext machinery to
|
||||
display messages, which subsequently potentially looked for
|
||||
translated messages in unexpected places. This allowed for
|
||||
malicious placement of crafted messages.
|
||||
|
||||
* CVE-2023-29007:
|
||||
|
||||
When renaming or deleting a section from a configuration file,
|
||||
certain malicious configuration values may be misinterpreted as
|
||||
the beginning of a new configuration section, leading to arbitrary
|
||||
configuration injection.
|
||||
|
||||
Credit for finding CVE-2023-25652 goes to Ry0taK, and the fix was
|
||||
developed by Taylor Blau, Junio C Hamano and Johannes Schindelin,
|
||||
with the help of Linus Torvalds.
|
||||
|
||||
Credit for finding CVE-2023-25815 goes to Maxime Escourbiac and
|
||||
Yassine BENGANA of Michelin, and the fix was developed by Johannes
|
||||
Schindelin.
|
||||
|
||||
Credit for finding CVE-2023-29007 goes to André Baptista and Vítor Pinho
|
||||
of Ethiack, and the fix was developed by Taylor Blau, and Johannes
|
||||
Schindelin, with help from Jeff King, and Patrick Steinhardt.
|
6
Documentation/RelNotes/2.31.8.txt
Normal file
6
Documentation/RelNotes/2.31.8.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
Git v2.31.8 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9 to address the
|
||||
security issues CVE-2023-25652, CVE-2023-25815, and CVE-2023-29007;
|
||||
see the release notes for that version for details.
|
7
Documentation/RelNotes/2.32.7.txt
Normal file
7
Documentation/RelNotes/2.32.7.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.32.7 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9 and v2.31.8 to
|
||||
address the security issues CVE-2023-25652, CVE-2023-25815, and
|
||||
CVE-2023-29007; see the release notes for these versions for
|
||||
details.
|
7
Documentation/RelNotes/2.33.8.txt
Normal file
7
Documentation/RelNotes/2.33.8.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.33.8 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9, v2.31.8 and
|
||||
v2.32.7 to address the security issues CVE-2023-25652,
|
||||
CVE-2023-25815, and CVE-2023-29007; see the release notes for these
|
||||
versions for details.
|
7
Documentation/RelNotes/2.34.8.txt
Normal file
7
Documentation/RelNotes/2.34.8.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.34.8 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9, v2.31.8,
|
||||
v2.32.7 and v2.33.8 to address the security issues CVE-2023-25652,
|
||||
CVE-2023-25815, and CVE-2023-29007; see the release notes for these
|
||||
versions for details.
|
7
Documentation/RelNotes/2.35.8.txt
Normal file
7
Documentation/RelNotes/2.35.8.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.35.8 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8 and v2.34.8 to address the security issues
|
||||
CVE-2023-25652, CVE-2023-25815, and CVE-2023-29007; see the release
|
||||
notes for these versions for details.
|
7
Documentation/RelNotes/2.36.6.txt
Normal file
7
Documentation/RelNotes/2.36.6.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.36.6 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges the fixes that appear in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8, v2.34.8 and v2.35.8 to address the security issues
|
||||
CVE-2023-25652, CVS-2023-25815, and CVE-2023-29007; see the release
|
||||
notes for these versions for details.
|
7
Documentation/RelNotes/2.37.7.txt
Normal file
7
Documentation/RelNotes/2.37.7.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Git v2.37.7 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges up the fix that appears in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8, v2.34.8, v2.35.8 and v2.36.6 to address the
|
||||
security issues CVE-2023-25652, CVE-2023-25815, and CVE-2023-29007;
|
||||
see the release notes for these versions for details.
|
8
Documentation/RelNotes/2.38.5.txt
Normal file
8
Documentation/RelNotes/2.38.5.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
Git v2.38.5 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges up the fix that appears in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8, v2.34.8, v2.35.8, v2.36.6 and v2.37.7 to address
|
||||
the security issues CVE-2023-25652, CVE-2023-25815, and
|
||||
CVE-2023-29007; see the release notes for these versions for
|
||||
details.
|
|
@ -1,9 +1,15 @@
|
|||
Git v2.39.3 Release Notes
|
||||
=========================
|
||||
|
||||
This release is primarily to merge fixes accumulated on the 'master'
|
||||
front to prepare for 2.40 release that are still relevant to 2.39.x
|
||||
maintenance track.
|
||||
This release merges up the fix that appears in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8, v2.34.8, v2.35.8, v2.36.6, v2.37.7 and v2.38.5 to
|
||||
address the security issues CVE-2023-25652, CVE-2023-25815, and
|
||||
CVE-2023-29007; see the release notes for these versions for
|
||||
details.
|
||||
|
||||
This release also merges fixes that have accumulated on the 'master'
|
||||
front to prepare for the 2.40 release that are still relevant to
|
||||
2.39.x maintenance track.
|
||||
|
||||
Fixes since v2.39.2
|
||||
-------------------
|
||||
|
|
8
Documentation/RelNotes/2.40.1.txt
Normal file
8
Documentation/RelNotes/2.40.1.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
Git v2.40.1 Release Notes
|
||||
=========================
|
||||
|
||||
This release merges up the fix that appears in v2.30.9, v2.31.8,
|
||||
v2.32.7, v2.33.8, v2.34.8, v2.35.8, v2.36.6, v2.37.7, v2.38.5
|
||||
and v2.39.3 to address the security issues CVE-2023-25652,
|
||||
CVE-2023-25815, and CVE-2023-29007; see the release notes for these
|
||||
versions for details.
|
391
Documentation/RelNotes/2.41.0.txt
Normal file
391
Documentation/RelNotes/2.41.0.txt
Normal file
|
@ -0,0 +1,391 @@
|
|||
Git v2.41 Release Notes
|
||||
=======================
|
||||
|
||||
UI, Workflows & Features
|
||||
|
||||
* Allow information carried on the WWW-AUthenticate header to be
|
||||
passed to the credential helpers.
|
||||
|
||||
* A new "fetch.hideRefs" option can be used to exclude specified refs
|
||||
from "rev-list --objects --stdin --not --all" traversal for
|
||||
checking object connectivity, most useful when there are many
|
||||
unrelated histories in a single repository.
|
||||
|
||||
* "git push" has been taught to allow deletion of refs with one-level
|
||||
names to help repairing a repository who acquired such a ref by
|
||||
mistake. In general, we don't encourage use of such a ref, and
|
||||
creation or update to such a ref is rejected as before.
|
||||
|
||||
* Allow "git bisect reset" to check out the original branch when the
|
||||
branch is already checked out in a different worktree linked to the
|
||||
same repository.
|
||||
|
||||
* A few subcommands have been taught to stop users from working on a
|
||||
branch that is being used in another worktree linked to the same
|
||||
repository.
|
||||
|
||||
* "git format-patch" learned to write a log-message only output file
|
||||
for empty commits.
|
||||
|
||||
* "git format-patch" honors the src/dst prefixes set to nonstandard
|
||||
values with configuration variables like "diff.noprefix", causing
|
||||
receiving end of the patch that expects the standard -p1 format to
|
||||
break. "format-patch" has been taught to ignore end-user configuration
|
||||
and always use the standard prefixes.
|
||||
|
||||
This is a backward compatibility breaking change.
|
||||
|
||||
* Lift the limitation that colored prompts can only be used with
|
||||
PROMPT_COMMAND mode.
|
||||
|
||||
* "git blame --contents=<file> <rev> -- <path>" used to be forbidden,
|
||||
but now it finds the origins of lines starting at <file> contents
|
||||
through the history that leads to <rev>.
|
||||
|
||||
* "git pack-redundant" gave a warning when run, as the command has
|
||||
outlived its usefulness long ago and is nominated for future
|
||||
removal. Now we escalate to give an error.
|
||||
|
||||
* "git clone" from an empty repository learned to propagate the
|
||||
choice of the hash algorithm from the source repository to the
|
||||
newly created repository.
|
||||
|
||||
* "git mergetool" and "git difftool" learns a new configuration
|
||||
guiDefault to optionally favor configured guitool over non-gui-tool
|
||||
automatically when $DISPLAY is set.
|
||||
|
||||
* "git branch -d origin/master" would say "no such branch", but it is
|
||||
likely a missed "-r" if refs/remotes/origin/master exists. The
|
||||
command has been taught to give such a hint in its error message.
|
||||
|
||||
* Clean-up of the code path that deals with merge strategy option
|
||||
handling in "git rebase".
|
||||
|
||||
* "git clone --local" stops copying from an original repository that
|
||||
has symbolic links inside its $GIT_DIR; an error message when that
|
||||
happens has been updated.
|
||||
|
||||
* "git branch --format=..." and "git format-patch --format=..."
|
||||
learns "--omit-empty" to hide refs that whose formatting result
|
||||
becomes an empty string from the output.
|
||||
|
||||
* The sendemail-validate validate hook learned to pass the total
|
||||
number of input files and where in the sequence each invocation is
|
||||
via environment variables.
|
||||
|
||||
* When "gc" needs to retain unreachable objects, packing them into
|
||||
cruft packs (instead of exploding them into loose object files) has
|
||||
been offered as a more efficient option for some time. Now the use
|
||||
of cruft packs has been made the default and no longer considered
|
||||
an experimental feature.
|
||||
|
||||
* The output given by "git blame" that attributes a line to contents
|
||||
taken from the file specified by the "--contents" option shows it
|
||||
differently from a line attributed to the working tree file.
|
||||
|
||||
* "git send-email" learned to give the e-mail headers to the validate
|
||||
hook by passing an extra argument from the command line.
|
||||
|
||||
* The credential subsystem learns to help OAuth framework.
|
||||
|
||||
* The titles of manual pages used to be chomped at an unreasonably
|
||||
short limit, which has been removed.
|
||||
|
||||
* Error messages given when working on an unborn branch that is
|
||||
checked out in another worktree have been improved.
|
||||
|
||||
* The documentation was misleading about the interaction between
|
||||
GIT_DEFAULT_HASH and "git clone", which has been clarified to
|
||||
stress that the variable is to be ignored by the command.
|
||||
|
||||
* "git send-email" learned "--header-cmd=<cmd>" that can inject
|
||||
arbitrary e-mail header lines to the outgoing messages.
|
||||
|
||||
* "git fsck" learned to detect bit-flip breakages in the reachability
|
||||
bitmap files.
|
||||
|
||||
* The "--stdin" option of "git name-rev" has been replaced with
|
||||
the "--annotate-stdin" option more than a year ago. We stop
|
||||
advertising it in the "git name-rev -h" output.
|
||||
|
||||
* "git push --all" gained an alias "git push --branches".
|
||||
|
||||
* "git fetch" learned the "--porcelain" option that emits what it did
|
||||
in a machine-parseable format.
|
||||
|
||||
|
||||
Performance, Internal Implementation, Development Support etc.
|
||||
|
||||
* Code clean-up to clarify directory traversal API.
|
||||
|
||||
* Code clean-up to clarify the rule that "git-compat-util.h" must be
|
||||
the first to be included.
|
||||
|
||||
* More work towards -Wunused.
|
||||
|
||||
* Instead of forcing each command to choose to honor GPG related
|
||||
configuration variables, make the subsystem lazily initialize
|
||||
itself.
|
||||
|
||||
* Remove workaround for ancient versions of DocBook to make it work
|
||||
correctly with groff, which has not been necessary since docbook
|
||||
1.76 from 2010.
|
||||
|
||||
* Code clean-up to include and/or uninclude parse-options.h file as
|
||||
needed.
|
||||
|
||||
* The code path that reports what "git fetch" did to each ref has
|
||||
been cleaned up.
|
||||
|
||||
* Assorted config API updates.
|
||||
|
||||
* A few configuration variables to tell the cURL library that
|
||||
different types of ssl-cert and ssl-key are in use have been added.
|
||||
|
||||
* Split key function and data structure definitions out of cache.h to
|
||||
new header files and adjust the users.
|
||||
|
||||
* "git fetch --all" does not have to download and handle the same
|
||||
bundleURI over and over, which has been corrected.
|
||||
|
||||
* "git sparse-checkout" command learns a debugging aid for the sparse
|
||||
rule definitions.
|
||||
|
||||
* "git write-tree" learns to work better with sparse-index.
|
||||
|
||||
* The on-disk reverse index that allows mapping from the pack offset
|
||||
to the object name for the object stored at the offset has been
|
||||
enabled by default.
|
||||
|
||||
* "git fsck" learned to validate the on-disk pack reverse index files.
|
||||
|
||||
* strtok() and strtok_r() are banned in this codebase.
|
||||
|
||||
* The detect-compilers script to help auto-tweaking the build system
|
||||
had trouble working with compilers whose version number has extra
|
||||
suffixes. The script has been taught that certain suffixes (like
|
||||
"-win32" in "gcc 10-win32") can be safely stripped as they share
|
||||
the same features and bugs with the version without the suffix.
|
||||
|
||||
* ctype tests have been taught to test EOF, too.
|
||||
|
||||
* The implementation of credential helpers used fgets() over fixed
|
||||
size buffers to read protocol messages, causing the remainder of
|
||||
the folded long line to trigger unexpected behaviour, which has
|
||||
been corrected.
|
||||
|
||||
* The implementation of the default "negotiator", used to find common
|
||||
ancestor over the network for object tranfer, used to be recursive;
|
||||
it was updated to be iterative to conserve stackspace usage.
|
||||
|
||||
* Our custom callout formatter is no longer used in the documentation
|
||||
formatting toolchain, as the upstream default ones give better
|
||||
output these days.
|
||||
|
||||
* The tracing mechanism learned to notice and report when
|
||||
auto-discovered bare repositories are being used, as allowing so
|
||||
without explicitly stating the user intends to do so (with setting
|
||||
GIT_DIR for example) can be used with social engineering as an
|
||||
attack vector.
|
||||
|
||||
* "git diff-files" learned not to expand sparse-index unless needed.
|
||||
|
||||
|
||||
Fixes since v2.40
|
||||
-----------------
|
||||
|
||||
* "git fsck" learned to check the index files in other worktrees,
|
||||
just like "git gc" honors them as anchoring points.
|
||||
(merge 8d3e7eac52 jk/fsck-indices-in-worktrees later to maint).
|
||||
|
||||
* Fix a segfaulting loop. The function and its caller may need
|
||||
further clean-up.
|
||||
(merge c5773dc078 ew/commit-reach-clean-up-flags-fix later to maint).
|
||||
|
||||
* "git restore" supports options like "--ours" that are only
|
||||
meaningful during a conflicted merge, but these options are only
|
||||
meaningful when updating the working tree files. These options are
|
||||
marked to be incompatible when both "--staged" and "--worktree" are
|
||||
in effect.
|
||||
(merge ee8a88826a ak/restore-both-incompatible-with-conflicts later to maint).
|
||||
|
||||
* Simplify UI to control progress meter given by "git bundle" command.
|
||||
(merge 8b95521edb jk/bundle-progress later to maint).
|
||||
|
||||
* "git bundle" learned that "-" is a common way to say that the input
|
||||
comes from the standard input and/or the output goes to the
|
||||
standard output. It used to work only for output and only from the
|
||||
root level of the working tree.
|
||||
(merge 0bbe10313e jk/bundle-use-dash-for-stdfiles later to maint).
|
||||
|
||||
* Once we start running, we assumed that the list of alternate object
|
||||
databases would never change. Hook into the machinery used to
|
||||
update the list of packfiles during runtime to update this list as
|
||||
well.
|
||||
(merge e2d003dbed ds/reprepare-alternates-when-repreparing-packfiles later to maint).
|
||||
|
||||
* The code to parse "git rebase -X<opt>" was not prepared to see an
|
||||
unparsable option string, which has been corrected.
|
||||
(merge 15a4cc912e ab/fix-strategy-opts-parsing later to maint).
|
||||
|
||||
* "git add -p" while the index is unmerged sometimes failed to parse
|
||||
the diff output it internally produces and died, which has been
|
||||
corrected.
|
||||
(merge 28d1122f9c jk/add-p-unmerged-fix later to maint).
|
||||
|
||||
* Fix for a "ls-files --format="%(path)" that produced nonsense
|
||||
output, which was a bug in 2.38.
|
||||
(merge cfb62dd006 aj/ls-files-format-fix later to maint).
|
||||
|
||||
* "git receive-pack" that responds to "git push" requests failed to
|
||||
clean a stale lockfile when killed in the middle, which has been
|
||||
corrected.
|
||||
(merge c55c30669c ps/receive-pack-unlock-before-die later to maint).
|
||||
|
||||
* "git rev-parse --quiet foo@{u}", or anything that asks @{u} to be
|
||||
parsed with GET_OID_QUIETLY option, did not quietly fail, which has
|
||||
been corrected.
|
||||
(merge dfbfdc521d fc/oid-quietly-parse-upstream later to maint).
|
||||
|
||||
* Transports that do not support protocol v2 did not correctly fall
|
||||
back to protocol v0 under certain conditions, which has been
|
||||
corrected.
|
||||
(merge eaa0fd6584 jk/fix-proto-downgrade-to-v0 later to maint).
|
||||
|
||||
* time(2) on glib 2.31+, especially on Linux, goes out of sync with
|
||||
higher resolution timers used for gettimeofday(2) and by the
|
||||
filesystem. Replace all calls to it with a git_time() wrapper and
|
||||
(merge 370ddcbc89 pe/time-use-gettimeofday later to maint).
|
||||
|
||||
* Code clean-up to use designated initializers in parse-options API.
|
||||
(merge 353e6d4554 sg/parse-options-h-initializers later to maint).
|
||||
|
||||
* A recent-ish change to allow unicode character classes to be used
|
||||
with "grep -P" triggered a JIT bug in older pcre2 libraries.
|
||||
The problematic change in Git built with these older libraries has
|
||||
been disabled to work around the bug.
|
||||
(merge 14b9a04479 mk/workaround-pcre-jit-ucp-bug later to maint).
|
||||
|
||||
* The wildmatch library code unlearns exponential behaviour it
|
||||
acquired some time ago since it was borrowed from rsync.
|
||||
(merge 3dc0b7f0dc pw/wildmatch-fixes later to maint).
|
||||
|
||||
* The index files can become corrupt under certain conditions when
|
||||
the split-index feature is in use, especially together with
|
||||
fsmonitor, which have been corrected.
|
||||
(merge 061dd722dc js/split-index-fixes later to maint).
|
||||
|
||||
* Document what the pathname-looking strings in "rev-list --object"
|
||||
output are for and what they mean.
|
||||
(merge 15364d2a3c jk/document-rev-list-object-name later to maint).
|
||||
|
||||
* Fix unnecessary truncation of generation numbers used in-core.
|
||||
(merge d3af1c193d ps/ahead-behind-truncation-fix later to maint).
|
||||
|
||||
* Code clean-up around the use of the_repository.
|
||||
(merge 4a93b899c1 ab/remove-implicit-use-of-the-repository later to maint).
|
||||
|
||||
* Consistently spell "Message-ID" as such, not "Message-Id".
|
||||
(merge ba4324c4e1 jc/spell-id-in-both-caps-in-message-id later to maint).
|
||||
|
||||
* Correct use of an uninitialized structure member.
|
||||
(merge dc12ee77ab jx/cap-object-info-uninitialized-fix later to maint).
|
||||
|
||||
* Tests had a few places where we ignored PERL_PATH and blindly used
|
||||
/usr/bin/perl, which have been corrected.
|
||||
(merge c1917156a0 jk/use-perl-path-consistently later to maint).
|
||||
|
||||
* Documentation mark-up fix.
|
||||
(merge 78b6369e67 la/mfc-markup-fix later to maint).
|
||||
|
||||
* Doc toolchain update to remove old workaround for AsciiDoc.
|
||||
(merge 8806120de6 fc/remove-header-workarounds-for-asciidoc later to maint).
|
||||
|
||||
* The userdiff regexp patterns for various filetypes that are built
|
||||
into the system have been updated to avoid triggering regexp errors
|
||||
from UTF-8 aware regex engines.
|
||||
(merge be39144954 rs/userdiff-multibyte-regex later to maint).
|
||||
|
||||
* The approxidate() API has been simplified by losing an extra
|
||||
function that did the same thing as another one.
|
||||
(merge 8a7f0b666f rs/remove-approxidate-relative later to maint).
|
||||
|
||||
* Code clean-up to replace a hardcoded constant with a CPP macro.
|
||||
(merge c870de6502 rs/get-tar-commit-id-use-defined-const later to maint).
|
||||
|
||||
* Doc build simplification.
|
||||
(merge 9a09ed3229 fc/doc-stop-using-manversion later to maint).
|
||||
|
||||
* "git archive" run from a subdirectory mishandled attributes and
|
||||
paths outside the current directory.
|
||||
(merge 92b1dd1b9e rs/archive-from-subdirectory-fixes later to maint).
|
||||
|
||||
* The code to parse capability list for v0 on-wire protocol fell into
|
||||
an infinite loop when a capability appears multiple times, which
|
||||
has been corrected.
|
||||
|
||||
* Geometric repacking ("git repack --geometric=<n>") in a repository
|
||||
that borrows from an alternate object database had various corner
|
||||
case bugs, which have been corrected.
|
||||
(merge d85cd18777 ps/fix-geom-repack-with-alternates later to maint).
|
||||
|
||||
* The "%GT" placeholder for the "--format" option of "git log" and
|
||||
friends caused BUG() to trigger on a commit signed with an unknown
|
||||
key, which has been corrected.
|
||||
(merge 7891e46585 jk/gpg-trust-level-fix later to maint).
|
||||
|
||||
* The completion script used to use bare "read" without the "-r"
|
||||
option to read the contents of various state files, which risked
|
||||
getting confused with backslashes in them. This has been
|
||||
corrected.
|
||||
(merge 197152098a ek/completion-use-read-r-to-read-literally later to maint).
|
||||
|
||||
* A small API fix to the ort merge strategy backend.
|
||||
(merge 000c4ceca7 en/ort-finalize-after-0-merges-fix later to maint).
|
||||
|
||||
* The commit object parser has been taught to be a bit more lenient
|
||||
to parse timestamps on the author/committer line with a malformed
|
||||
author/committer ident.
|
||||
(merge 90ef0f14eb jk/parse-commit-with-malformed-ident later to maint).
|
||||
|
||||
* Retitle a test script with an overly narrow name.
|
||||
(merge 8bb19c14fb ob/t3501-retitle later to maint).
|
||||
|
||||
* Doc update to clarify how text and eol attributes interact to
|
||||
specify the end-of-line conversion.
|
||||
(merge 6696077ace ah/doc-attributes-text later to maint).
|
||||
|
||||
* Gitk updates from GfW project.
|
||||
(merge 99e70f3077 js/gitk-fixes-from-gfw later to maint).
|
||||
|
||||
* "git diff --dirstat" leaked memory, which has been plugged.
|
||||
(merge 83973981eb jc/dirstat-plug-leaks later to maint).
|
||||
|
||||
* "git merge-tree" reads the basic configuration, which can be used
|
||||
by git forges to disable replace-refs feature.
|
||||
(merge b6551feadf ds/merge-tree-use-config later to maint).
|
||||
|
||||
* Other code cleanup, docfix, build fix, etc.
|
||||
(merge f7111175df as/doc-markup-fix later to maint).
|
||||
(merge 90ff7c9898 fc/test-aggregation-clean-up later to maint).
|
||||
(merge 9b0c7f308a jc/am-doc-refer-to-format-patch later to maint).
|
||||
(merge b10cbdac4c bb/unicode-width-table-15 later to maint).
|
||||
(merge 3457b50e8c ab/retire-scripted-add-p later to maint).
|
||||
(merge d52fcf493b ds/p2000-fix-grep-sparse later to maint).
|
||||
(merge ec063d2591 ss/hashmap-typofix later to maint).
|
||||
(merge 1aaed69d11 rs/archive-mtime later to maint).
|
||||
(merge 2da2cc9b28 ob/rollback-after-commit-lock-failure later to maint).
|
||||
(merge 54dbd0933b ob/sequencer-save-head-simplify later to maint).
|
||||
(merge a93cbe8d78 ar/test-cleanup-unused-file-creation later to maint).
|
||||
(merge cc48ddd937 jk/chainlint-fixes later to maint).
|
||||
(merge 4833b08426 ow/ref-format-remove-unused-member later to maint).
|
||||
(merge d0ea2ca1cf dw/doc-submittingpatches-grammofix later to maint).
|
||||
(merge fd72637423 ar/t2024-checkout-output-fix later to maint).
|
||||
(merge d45cbe3fe0 ob/sequencer-i18n-fix later to maint).
|
||||
(merge b734fe49fd ob/messages-capitalize-exception later to maint).
|
||||
(merge ad353d7e77 ma/gittutorial-fixes later to maint).
|
||||
(merge a5855fd8d4 ar/test-cleanup-unused-file-creation-part2 later to maint).
|
||||
(merge 0c5308af30 sd/doc-gitignore-and-rm-cached later to maint).
|
||||
(merge cbb83daeaf kh/doc-interpret-trailers-updates later to maint).
|
||||
(merge 3d77fbb664 ar/config-count-tests-updates later to maint).
|
||||
(merge b7cf25c8f4 jc/t9800-fix-use-of-show-s-raw later to maint).
|
|
@ -543,7 +543,7 @@ trigger a new CI build to ensure all tests pass.
|
|||
[[mua]]
|
||||
== MUA specific hints
|
||||
|
||||
Some of patches I receive or pick up from the list share common
|
||||
Some of the patches I receive or pick up from the list share common
|
||||
patterns of breakage. Please make sure your MUA is set up
|
||||
properly not to corrupt whitespaces.
|
||||
|
||||
|
|
|
@ -51,25 +51,6 @@ ifdef::doctype-manpage[]
|
|||
endif::doctype-manpage[]
|
||||
endif::backend-docbook[]
|
||||
|
||||
ifdef::doctype-manpage[]
|
||||
ifdef::backend-docbook[]
|
||||
[header]
|
||||
template::[header-declarations]
|
||||
<refentry>
|
||||
<refmeta>
|
||||
<refentrytitle>{mantitle}</refentrytitle>
|
||||
<manvolnum>{manvolnum}</manvolnum>
|
||||
<refmiscinfo class="source">{mansource}</refmiscinfo>
|
||||
<refmiscinfo class="version">{manversion}</refmiscinfo>
|
||||
<refmiscinfo class="manual">{manmanual}</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>{manname}</refname>
|
||||
<refpurpose>{manpurpose}</refpurpose>
|
||||
</refnamediv>
|
||||
endif::backend-docbook[]
|
||||
endif::doctype-manpage[]
|
||||
|
||||
ifdef::backend-xhtml11[]
|
||||
[attributes]
|
||||
git-relative-html-prefix=
|
||||
|
|
|
@ -64,11 +64,9 @@ include::line-range-format.txt[]
|
|||
manual page.
|
||||
|
||||
--contents <file>::
|
||||
When <rev> is not specified, the command annotates the
|
||||
changes starting backwards from the working tree copy.
|
||||
This flag makes the command pretend as if the working
|
||||
tree copy has the contents of the named file (specify
|
||||
`-` to make the command read from the standard input).
|
||||
Annotate using the contents from the named file, starting from <rev>
|
||||
if it is specified, and HEAD otherwise. You may specify '-' to make
|
||||
the command read from the standard input for the file contents.
|
||||
|
||||
--date <format>::
|
||||
Specifies the format used to output dates. If --date is not
|
||||
|
|
|
@ -136,4 +136,6 @@ advice.*::
|
|||
Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
|
||||
is asked to update index entries outside the current sparse
|
||||
checkout.
|
||||
diverging::
|
||||
Advice shown when a fast-forward is not possible.
|
||||
--
|
||||
|
|
|
@ -34,3 +34,10 @@ See the `--trust-exit-code` option in linkgit:git-difftool[1] for more details.
|
|||
|
||||
difftool.prompt::
|
||||
Prompt before each invocation of the diff tool.
|
||||
|
||||
difftool.guiDefault::
|
||||
Set `true` to use the `diff.guitool` by default (equivalent to specifying
|
||||
the `--gui` argument), or `auto` to select `diff.guitool` or `diff.tool`
|
||||
depending on the presence of a `DISPLAY` environment variable value. The
|
||||
default is `false`, where the `--gui` argument must be provided
|
||||
explicitly for the `diff.guitool` to be used.
|
||||
|
|
|
@ -14,9 +14,6 @@ feature.experimental::
|
|||
+
|
||||
* `fetch.negotiationAlgorithm=skipping` may improve fetch negotiation times by
|
||||
skipping more commits at a time, reducing the number of round trips.
|
||||
+
|
||||
* `gc.cruftPacks=true` reduces disk space used by unreachable objects during
|
||||
garbage collection, preventing loose object explosions.
|
||||
|
||||
feature.manyFiles::
|
||||
Enable config options that optimize for repos with many files in the
|
||||
|
|
|
@ -144,3 +144,10 @@ will only show notes from `refs/notes/bar`.
|
|||
format.mboxrd::
|
||||
A boolean value which enables the robust "mboxrd" format when
|
||||
`--stdout` is in use to escape "^>+From " lines.
|
||||
|
||||
format.noprefix::
|
||||
If set, do not show any source or destination prefix in patches.
|
||||
This is equivalent to the `diff.noprefix` option used by `git
|
||||
diff` (but which is not respected by `format-patch`). Note that
|
||||
by setting this, the receiver of any patches you generate will
|
||||
have to apply them using the `-p0` option.
|
||||
|
|
|
@ -43,11 +43,11 @@ gc.autoDetach::
|
|||
if the system supports it. Default is true.
|
||||
|
||||
gc.bigPackThreshold::
|
||||
If non-zero, all packs larger than this limit are kept when
|
||||
`git gc` is run. This is very similar to `--keep-largest-pack`
|
||||
except that all packs that meet the threshold are kept, not
|
||||
just the largest pack. Defaults to zero. Common unit suffixes of
|
||||
'k', 'm', or 'g' are supported.
|
||||
If non-zero, all non-cruft packs larger than this limit are kept
|
||||
when `git gc` is run. This is very similar to
|
||||
`--keep-largest-pack` except that all non-cruft packs that meet
|
||||
the threshold are kept, not just the largest pack. Defaults to
|
||||
zero. Common unit suffixes of 'k', 'm', or 'g' are supported.
|
||||
+
|
||||
Note that if the number of kept packs is more than gc.autoPackLimit,
|
||||
this configuration variable is ignored, all packs except the base pack
|
||||
|
@ -84,7 +84,7 @@ gc.packRefs::
|
|||
gc.cruftPacks::
|
||||
Store unreachable objects in a cruft pack (see
|
||||
linkgit:git-repack[1]) instead of as loose objects. The default
|
||||
is `false`.
|
||||
is `true`.
|
||||
|
||||
gc.pruneExpire::
|
||||
When 'git gc' is run, it will call 'prune --expire 2.weeks.ago'
|
||||
|
|
|
@ -85,3 +85,10 @@ mergetool.writeToTemp::
|
|||
|
||||
mergetool.prompt::
|
||||
Prompt before each invocation of the merge resolution program.
|
||||
|
||||
mergetool.guiDefault::
|
||||
Set `true` to use the `merge.guitool` by default (equivalent to
|
||||
specifying the `--gui` argument), or `auto` to select `merge.guitool`
|
||||
or `merge.tool` depending on the presence of a `DISPLAY` environment
|
||||
variable value. The default is `false`, where the `--gui` argument
|
||||
must be provided explicitly for the `merge.guitool` to be used.
|
||||
|
|
|
@ -171,9 +171,15 @@ pack.writeBitmapLookupTable::
|
|||
beneficial in repositories that have relatively large bitmap
|
||||
indexes. Defaults to false.
|
||||
|
||||
pack.readReverseIndex::
|
||||
When true, git will read any .rev file(s) that may be available
|
||||
(see: linkgit:gitformat-pack[5]). When false, the reverse index
|
||||
will be generated from scratch and stored in memory. Defaults to
|
||||
true.
|
||||
|
||||
pack.writeReverseIndex::
|
||||
When true, git will write a corresponding .rev file (see:
|
||||
linkgit:gitformat-pack[5])
|
||||
for each new packfile that it writes in all places except for
|
||||
linkgit:git-fast-import[1] and in the bulk checkin mechanism.
|
||||
Defaults to false.
|
||||
Defaults to true.
|
||||
|
|
|
@ -67,3 +67,13 @@ rebase.rescheduleFailedExec::
|
|||
|
||||
rebase.forkPoint::
|
||||
If set to false set `--no-fork-point` option by default.
|
||||
|
||||
rebase.rebaseMerges::
|
||||
Whether and how to set the `--rebase-merges` option by default. Can
|
||||
be `rebase-cousins`, `no-rebase-cousins`, or a boolean. Setting to
|
||||
true or to `no-rebase-cousins` is equivalent to
|
||||
`--rebase-merges=no-rebase-cousins`, setting to `rebase-cousins` is
|
||||
equivalent to `--rebase-merges=rebase-cousins`, and setting to false is
|
||||
equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
|
||||
command line, with or without an argument, overrides any
|
||||
`rebase.rebaseMerges` configuration.
|
||||
|
|
|
@ -61,6 +61,7 @@ sendemail.ccCmd::
|
|||
sendemail.chainReplyTo::
|
||||
sendemail.envelopeSender::
|
||||
sendemail.from::
|
||||
sendemail.headerCmd::
|
||||
sendemail.signedoffbycc::
|
||||
sendemail.smtpPass::
|
||||
sendemail.suppresscc::
|
||||
|
|
|
@ -852,6 +852,11 @@ endif::git-format-patch[]
|
|||
--no-prefix::
|
||||
Do not show any source or destination prefix.
|
||||
|
||||
--default-prefix::
|
||||
Use the default source and destination prefixes ("a/" and "b/").
|
||||
This is usually the default already, but may be used to override
|
||||
config such as `diff.noprefix`.
|
||||
|
||||
--line-prefix=<prefix>::
|
||||
Prepend an additional prefix to every line of output.
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ render_tree () {
|
|||
make -j$parallel -C "$tmp/worktree" \
|
||||
$makemanflags \
|
||||
GIT_VERSION=omitted \
|
||||
SOURCE_DATE_EPOCH=0 \
|
||||
GIT_DATE=1970-01-01 \
|
||||
DESTDIR="$tmp/installed/$dname+" \
|
||||
install-man &&
|
||||
mv "$tmp/installed/$dname+" "$tmp/installed/$dname"
|
||||
|
|
|
@ -78,6 +78,13 @@ linkgit:git-config[1].
|
|||
--dry-run::
|
||||
Show what would be done, without making any changes.
|
||||
|
||||
--porcelain::
|
||||
Print the output to standard output in an easy-to-parse format for
|
||||
scripts. See section OUTPUT in linkgit:git-fetch[1] for details.
|
||||
+
|
||||
This is incompatible with `--recurse-submodules=[yes|on-demand]` and takes
|
||||
precedence over the `fetch.output` config option.
|
||||
|
||||
ifndef::git-pull[]
|
||||
--[no-]write-fetch-head::
|
||||
Write the list of remote refs fetched in the `FETCH_HEAD`
|
||||
|
|
|
@ -24,7 +24,9 @@ DESCRIPTION
|
|||
-----------
|
||||
Splits mail messages in a mailbox into commit log message,
|
||||
authorship information and patches, and applies them to the
|
||||
current branch.
|
||||
current branch. You could think of it as a reverse operation
|
||||
of linkgit:git-format-patch[1] run on a branch with a straight
|
||||
history without merges.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
@ -273,7 +275,8 @@ include::config/am.txt[]
|
|||
|
||||
SEE ALSO
|
||||
--------
|
||||
linkgit:git-apply[1].
|
||||
linkgit:git-apply[1],
|
||||
linkgit:git-format-patch[1].
|
||||
|
||||
GIT
|
||||
---
|
||||
|
|
|
@ -12,7 +12,7 @@ SYNOPSIS
|
|||
[-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
|
||||
[--ignore-rev <rev>] [--ignore-revs-file <file>]
|
||||
[--color-lines] [--color-by-age] [--progress] [--abbrev=<n>]
|
||||
[<rev> | --contents <file> | --reverse <rev>..<rev>] [--] <file>
|
||||
[ --contents <file> ] [<rev> | --reverse <rev>..<rev>] [--] <file>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
|
|
@ -156,6 +156,10 @@ in another worktree linked to the same repository.
|
|||
--ignore-case::
|
||||
Sorting and filtering branches are case insensitive.
|
||||
|
||||
--omit-empty::
|
||||
Do not print a newline after formatted refs where the format expands
|
||||
to the empty string.
|
||||
|
||||
--column[=<options>]::
|
||||
--no-column::
|
||||
Display branch listing in columns. See configuration variable
|
||||
|
|
|
@ -9,7 +9,7 @@ git-bundle - Move objects and refs by archive
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]
|
||||
'git bundle' create [-q | --quiet | --progress]
|
||||
[--version=<version>] <file> <git-rev-list-args>
|
||||
'git bundle' verify [-q | --quiet] <file>
|
||||
'git bundle' list-heads <file> [<refname>...]
|
||||
|
@ -66,7 +66,7 @@ create [options] <file> <git-rev-list-args>::
|
|||
Used to create a bundle named 'file'. This requires the
|
||||
'<git-rev-list-args>' arguments to define the bundle contents.
|
||||
'options' contains the options specific to the 'git bundle create'
|
||||
subcommand.
|
||||
subcommand. If 'file' is `-`, the bundle is written to stdout.
|
||||
|
||||
verify <file>::
|
||||
Used to check that a bundle file is valid and will apply
|
||||
|
@ -77,12 +77,13 @@ verify <file>::
|
|||
Finally, information about additional capabilities, such as "object
|
||||
filter", is printed. See "Capabilities" in linkgit:gitformat-bundle[5]
|
||||
for more information. The exit code is zero for success, but will
|
||||
be nonzero if the bundle file is invalid.
|
||||
be nonzero if the bundle file is invalid. If 'file' is `-`, the
|
||||
bundle is read from stdin.
|
||||
|
||||
list-heads <file>::
|
||||
Lists the references defined in the bundle. If followed by a
|
||||
list of references, only references matching those given are
|
||||
printed out.
|
||||
printed out. If 'file' is `-`, the bundle is read from stdin.
|
||||
|
||||
unbundle <file>::
|
||||
Passes the objects in the bundle to 'git index-pack'
|
||||
|
@ -90,6 +91,7 @@ unbundle <file>::
|
|||
defined references. If a list of references is given, only
|
||||
references matching those in the list are printed. This command is
|
||||
really plumbing, intended to be called only by 'git fetch'.
|
||||
If 'file' is `-`, the bundle is read from stdin.
|
||||
|
||||
<git-rev-list-args>::
|
||||
A list of arguments, acceptable to 'git rev-parse' and
|
||||
|
@ -115,22 +117,6 @@ unbundle <file>::
|
|||
is specified. This flag forces progress status even if
|
||||
the standard error stream is not directed to a terminal.
|
||||
|
||||
--all-progress::
|
||||
When --stdout is specified then progress report is
|
||||
displayed during the object count and compression phases
|
||||
but inhibited during the write-out phase. The reason is
|
||||
that in some cases the output stream is directly linked
|
||||
to another command which may wish to display progress
|
||||
status of its own as it processes incoming pack data.
|
||||
This flag is like --progress except that it forces progress
|
||||
report for the write-out phase as well even if --stdout is
|
||||
used.
|
||||
|
||||
--all-progress-implied::
|
||||
This is used to imply --all-progress whenever progress display
|
||||
is activated. Unlike --all-progress this flag doesn't actually
|
||||
force any progress display by itself.
|
||||
|
||||
--version=<version>::
|
||||
Specify the bundle version. Version 2 is the older format and can only be
|
||||
used with SHA-1 repositories; the newer version 3 contains capabilities that
|
||||
|
|
|
@ -483,14 +483,11 @@ $ git checkout -b foo # or "git switch -c foo" <1>
|
|||
$ git branch foo <2>
|
||||
$ git tag foo <3>
|
||||
------------
|
||||
|
||||
<1> creates a new branch `foo`, which refers to commit `f`, and then
|
||||
updates `HEAD` to refer to branch `foo`. In other words, we'll no longer
|
||||
be in detached `HEAD` state after this command.
|
||||
|
||||
<2> similarly creates a new branch `foo`, which refers to commit `f`,
|
||||
but leaves `HEAD` detached.
|
||||
|
||||
<3> creates a new tag `foo`, which refers to commit `f`,
|
||||
leaving `HEAD` detached.
|
||||
|
||||
|
@ -519,84 +516,89 @@ to checkout these paths out of the index.
|
|||
EXAMPLES
|
||||
--------
|
||||
|
||||
. The following sequence checks out the `master` branch, reverts
|
||||
the `Makefile` to two revisions back, deletes `hello.c` by
|
||||
mistake, and gets it back from the index.
|
||||
+
|
||||
=== 1. Paths
|
||||
|
||||
The following sequence checks out the `master` branch, reverts
|
||||
the `Makefile` to two revisions back, deletes `hello.c` by
|
||||
mistake, and gets it back from the index.
|
||||
|
||||
------------
|
||||
$ git checkout master <1>
|
||||
$ git checkout master~2 Makefile <2>
|
||||
$ rm -f hello.c
|
||||
$ git checkout hello.c <3>
|
||||
------------
|
||||
+
|
||||
<1> switch branch
|
||||
<2> take a file out of another commit
|
||||
<3> restore `hello.c` from the index
|
||||
+
|
||||
|
||||
If you want to check out _all_ C source files out of the index,
|
||||
you can say
|
||||
+
|
||||
|
||||
------------
|
||||
$ git checkout -- '*.c'
|
||||
------------
|
||||
+
|
||||
|
||||
Note the quotes around `*.c`. The file `hello.c` will also be
|
||||
checked out, even though it is no longer in the working tree,
|
||||
because the file globbing is used to match entries in the index
|
||||
(not in the working tree by the shell).
|
||||
+
|
||||
|
||||
If you have an unfortunate branch that is named `hello.c`, this
|
||||
step would be confused as an instruction to switch to that branch.
|
||||
You should instead write:
|
||||
+
|
||||
|
||||
------------
|
||||
$ git checkout -- hello.c
|
||||
------------
|
||||
|
||||
. After working in the wrong branch, switching to the correct
|
||||
branch would be done using:
|
||||
+
|
||||
=== 2. Merge
|
||||
|
||||
After working in the wrong branch, switching to the correct
|
||||
branch would be done using:
|
||||
|
||||
------------
|
||||
$ git checkout mytopic
|
||||
------------
|
||||
+
|
||||
|
||||
However, your "wrong" branch and correct `mytopic` branch may
|
||||
differ in files that you have modified locally, in which case
|
||||
the above checkout would fail like this:
|
||||
+
|
||||
|
||||
------------
|
||||
$ git checkout mytopic
|
||||
error: You have local changes to 'frotz'; not switching branches.
|
||||
------------
|
||||
+
|
||||
|
||||
You can give the `-m` flag to the command, which would try a
|
||||
three-way merge:
|
||||
+
|
||||
|
||||
------------
|
||||
$ git checkout -m mytopic
|
||||
Auto-merging frotz
|
||||
------------
|
||||
+
|
||||
|
||||
After this three-way merge, the local modifications are _not_
|
||||
registered in your index file, so `git diff` would show you what
|
||||
changes you made since the tip of the new branch.
|
||||
|
||||
. When a merge conflict happens during switching branches with
|
||||
the `-m` option, you would see something like this:
|
||||
+
|
||||
=== 3. Merge conflict
|
||||
|
||||
When a merge conflict happens during switching branches with
|
||||
the `-m` option, you would see something like this:
|
||||
|
||||
------------
|
||||
$ git checkout -m mytopic
|
||||
Auto-merging frotz
|
||||
ERROR: Merge conflict in frotz
|
||||
fatal: merge program failed
|
||||
------------
|
||||
+
|
||||
|
||||
At this point, `git diff` shows the changes cleanly merged as in
|
||||
the previous example, as well as the changes in the conflicted
|
||||
files. Edit and resolve the conflict and mark it resolved with
|
||||
`git add` as usual:
|
||||
+
|
||||
|
||||
------------
|
||||
$ edit frotz
|
||||
$ git add frotz
|
||||
|
|
|
@ -58,6 +58,11 @@ never use the local optimizations). Specifying `--no-local` will
|
|||
override the default when `/path/to/repo` is given, using the regular
|
||||
Git transport instead.
|
||||
+
|
||||
If the repository's `$GIT_DIR/objects` has symbolic links or is a
|
||||
symbolic link, the clone will fail. This is a security measure to
|
||||
prevent the unintentional copying of files by dereferencing the symbolic
|
||||
links.
|
||||
+
|
||||
*NOTE*: this operation can race with concurrent modification to the
|
||||
source repository, similar to running `cp -r src dst` while modifying
|
||||
`src`.
|
||||
|
|
|
@ -113,7 +113,13 @@ separated by an `=` (equals) sign, followed by a newline.
|
|||
The key may contain any bytes except `=`, newline, or NUL. The value may
|
||||
contain any bytes except newline or NUL.
|
||||
|
||||
In both cases, all bytes are treated as-is (i.e., there is no quoting,
|
||||
Attributes with keys that end with C-style array brackets `[]` can have
|
||||
multiple values. Each instance of a multi-valued attribute forms an
|
||||
ordered list of values - the order of the repeated attributes defines
|
||||
the order of the values. An empty multi-valued attribute (`key[]=\n`)
|
||||
acts to clear any previous entries and reset the list.
|
||||
|
||||
In all cases, all bytes are treated as-is (i.e., there is no quoting,
|
||||
and one cannot transmit a value with newline or NUL in it). The list of
|
||||
attributes is terminated by a blank line or end-of-file.
|
||||
|
||||
|
@ -150,6 +156,12 @@ Git understands the following attributes:
|
|||
When reading credentials from helpers, `git credential fill` ignores expired
|
||||
passwords. Represented as Unix time UTC, seconds since 1970.
|
||||
|
||||
`oauth_refresh_token`::
|
||||
|
||||
An OAuth refresh token may accompany a password that is an OAuth access
|
||||
token. Helpers must treat this attribute as confidential like the password
|
||||
attribute. Git itself has no special behaviour for this attribute.
|
||||
|
||||
`url`::
|
||||
|
||||
When this special attribute is read by `git credential`, the
|
||||
|
@ -166,6 +178,17 @@ empty string.
|
|||
Components which are missing from the URL (e.g., there is no
|
||||
username in the example above) will be left unset.
|
||||
|
||||
`wwwauth[]`::
|
||||
|
||||
When an HTTP response is received by Git that includes one or more
|
||||
'WWW-Authenticate' authentication headers, these will be passed by Git
|
||||
to credential helpers.
|
||||
+
|
||||
Each 'WWW-Authenticate' header value is passed as a multi-valued
|
||||
attribute 'wwwauth[]', where the order of the attributes is the same as
|
||||
they appear in the HTTP response. This attribute is 'one-way' from Git
|
||||
to pass additional information to credential helpers.
|
||||
|
||||
Unrecognised attributes are silently discarded.
|
||||
|
||||
GIT
|
||||
|
|
|
@ -97,10 +97,12 @@ instead. `--no-symlinks` is the default on Windows.
|
|||
--[no-]gui::
|
||||
When 'git-difftool' is invoked with the `-g` or `--gui` option
|
||||
the default diff tool will be read from the configured
|
||||
`diff.guitool` variable instead of `diff.tool`. The `--no-gui`
|
||||
option can be used to override this setting. If `diff.guitool`
|
||||
is not set, we will fallback in the order of `merge.guitool`,
|
||||
`diff.tool`, `merge.tool` until a tool is found.
|
||||
`diff.guitool` variable instead of `diff.tool`. This may be
|
||||
selected automatically using the configuration variable
|
||||
`difftool.guiDefault`. The `--no-gui` option can be used to
|
||||
override these settings. If `diff.guitool` is not set, we will
|
||||
fallback in the order of `merge.guitool`, `diff.tool`,
|
||||
`merge.tool` until a tool is found.
|
||||
|
||||
--[no-]trust-exit-code::
|
||||
'git-difftool' invokes a diff tool individually on each file.
|
||||
|
|
|
@ -204,6 +204,15 @@ representing the status of a single ref. Each line is of the form:
|
|||
<flag> <summary> <from> -> <to> [<reason>]
|
||||
-------------------------------
|
||||
|
||||
When using `--porcelain`, the output format is intended to be
|
||||
machine-parseable. In contrast to the human-readable output formats it
|
||||
thus prints to standard output instead of standard error. Each line is
|
||||
of the form:
|
||||
|
||||
-------------------------------
|
||||
<flag> <old-object-id> <new-object-id> <local-reference>
|
||||
-------------------------------
|
||||
|
||||
The status of up-to-date refs is shown only if the --verbose option is
|
||||
used.
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ SYNOPSIS
|
|||
--------
|
||||
[verse]
|
||||
'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
|
||||
[(--sort=<key>)...] [--format=<format>] [<pattern>...]
|
||||
[(--sort=<key>)...] [--format=<format>]
|
||||
[ --stdin | <pattern>... ]
|
||||
[--points-at=<object>]
|
||||
[--merged[=<object>]] [--no-merged[=<object>]]
|
||||
[--contains[=<object>]] [--no-contains[=<object>]]
|
||||
|
@ -32,6 +33,10 @@ OPTIONS
|
|||
literally, in the latter case matching completely or from the
|
||||
beginning up to a slash.
|
||||
|
||||
--stdin::
|
||||
If `--stdin` is supplied, then the list of patterns is read from
|
||||
standard input instead of from the argument list.
|
||||
|
||||
--count=<count>::
|
||||
By default the command shows all refs that match
|
||||
`<pattern>`. This option makes it stop after showing
|
||||
|
@ -93,6 +98,10 @@ OPTIONS
|
|||
--ignore-case::
|
||||
Sorting and filtering refs are case insensitive.
|
||||
|
||||
--omit-empty::
|
||||
Do not print a newline after formatted refs where the format expands
|
||||
to the empty string.
|
||||
|
||||
FIELD NAMES
|
||||
-----------
|
||||
|
||||
|
@ -217,6 +226,11 @@ worktreepath::
|
|||
out, if it is checked out in any linked worktree. Empty string
|
||||
otherwise.
|
||||
|
||||
ahead-behind:<committish>::
|
||||
Two integers, separated by a space, demonstrating the number of
|
||||
commits ahead and behind, respectively, when comparing the output
|
||||
ref to the `<committish>` specified in the format.
|
||||
|
||||
In addition to the above, for commit and tag objects, the header
|
||||
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
|
||||
be used to specify the value in the header field.
|
||||
|
|
|
@ -99,7 +99,7 @@ To omit patch numbers from the subject, use `-N`.
|
|||
|
||||
If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
|
||||
`References` headers to make the second and subsequent patch mails appear
|
||||
as replies to the first mail; this also generates a `Message-Id` header to
|
||||
as replies to the first mail; this also generates a `Message-ID` header to
|
||||
reference.
|
||||
|
||||
OPTIONS
|
||||
|
@ -163,7 +163,7 @@ include::diff-options.txt[]
|
|||
--no-thread::
|
||||
Controls addition of `In-Reply-To` and `References` headers to
|
||||
make the second and subsequent mails appear as replies to the
|
||||
first. Also controls generation of the `Message-Id` header to
|
||||
first. Also controls generation of the `Message-ID` header to
|
||||
reference.
|
||||
+
|
||||
The optional <style> argument can be either `shallow` or `deep`.
|
||||
|
@ -173,8 +173,7 @@ series, where the head is chosen from the cover letter, the
|
|||
threading makes every mail a reply to the previous one.
|
||||
+
|
||||
The default is `--no-thread`, unless the `format.thread` configuration
|
||||
is set. If `--thread` is specified without a style, it defaults to the
|
||||
style specified by `format.thread` if any, or else `shallow`.
|
||||
is set. `--thread` without an argument is equivalent to `--thread=shallow`.
|
||||
+
|
||||
Beware that the default for 'git send-email' is to thread emails
|
||||
itself. If you want `git format-patch` to take care of threading, you
|
||||
|
|
|
@ -54,9 +54,10 @@ other housekeeping tasks (e.g. rerere, working trees, reflog...) will
|
|||
be performed as well.
|
||||
|
||||
|
||||
--cruft::
|
||||
--[no-]cruft::
|
||||
When expiring unreachable objects, pack them separately into a
|
||||
cruft pack instead of storing them as loose objects.
|
||||
cruft pack instead of storing them as loose objects. `--cruft`
|
||||
is on by default.
|
||||
|
||||
--prune=<date>::
|
||||
Prune loose objects older than date (default is 2 weeks ago,
|
||||
|
@ -77,9 +78,10 @@ be performed as well.
|
|||
instance running on this repository.
|
||||
|
||||
--keep-largest-pack::
|
||||
All packs except the largest pack and those marked with a
|
||||
`.keep` files are consolidated into a single pack. When this
|
||||
option is used, `gc.bigPackThreshold` is ignored.
|
||||
All packs except the largest non-cruft pack, any packs marked
|
||||
with a `.keep` file, and any cruft pack(s) are consolidated into
|
||||
a single pack. When this option is used, `gc.bigPackThreshold`
|
||||
is ignored.
|
||||
|
||||
AGGRESSIVE
|
||||
----------
|
||||
|
|
|
@ -280,7 +280,7 @@ $ cat msg.txt
|
|||
subject
|
||||
|
||||
message
|
||||
$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>'
|
||||
$ git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>' <msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
@ -322,17 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re
|
|||
'Signed-off-by: ' already, and show how it works:
|
||||
+
|
||||
------------
|
||||
$ cat msg1.txt
|
||||
subject
|
||||
|
||||
message
|
||||
$ git config trailer.sign.key "Signed-off-by: "
|
||||
$ git config trailer.sign.ifmissing add
|
||||
$ git config trailer.sign.ifexists doNothing
|
||||
$ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
|
||||
$ git interpret-trailers <<EOF
|
||||
> EOF
|
||||
$ git config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
|
||||
$ git interpret-trailers --trailer sign <msg1.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
||||
Signed-off-by: Bob <bob@example.com>
|
||||
$ git interpret-trailers <<EOF
|
||||
> Signed-off-by: Alice <alice@example.com>
|
||||
> EOF
|
||||
$ cat msg2.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
||||
Signed-off-by: Alice <alice@example.com>
|
||||
$ git interpret-trailers --trailer sign <msg2.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
||||
Signed-off-by: Alice <alice@example.com>
|
||||
------------
|
||||
|
@ -357,15 +370,14 @@ Fix #42
|
|||
$ cat ~/bin/glog-find-author
|
||||
#!/bin/sh
|
||||
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
|
||||
$ cat msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
$ git config trailer.help.key "Helped-by: "
|
||||
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
|
||||
$ git config trailer.help.cmd "~/bin/glog-find-author"
|
||||
$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
|
||||
> subject
|
||||
>
|
||||
> message
|
||||
>
|
||||
> EOF
|
||||
$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
@ -382,15 +394,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>
|
|||
$ cat ~/bin/glog-grep
|
||||
#!/bin/sh
|
||||
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
|
||||
$ cat msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
$ git config trailer.ref.key "Reference-to: "
|
||||
$ git config trailer.ref.ifExists "replace"
|
||||
$ git config trailer.ref.cmd "~/bin/glog-grep"
|
||||
$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
|
||||
> subject
|
||||
>
|
||||
> message
|
||||
>
|
||||
> EOF
|
||||
$ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
@ -402,17 +413,20 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
|
|||
commit that is related, and show how it works:
|
||||
+
|
||||
------------
|
||||
$ cat msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
||||
see: HEAD~2
|
||||
$ cat ~/bin/glog-ref
|
||||
#!/bin/sh
|
||||
git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14
|
||||
$ git config trailer.see.key "See-also: "
|
||||
$ git config trailer.see.ifExists "replace"
|
||||
$ git config trailer.see.ifMissing "doNothing"
|
||||
$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
|
||||
$ git interpret-trailers <<EOF
|
||||
> subject
|
||||
>
|
||||
> message
|
||||
>
|
||||
> see: HEAD~2
|
||||
> EOF
|
||||
$ git config trailer.see.cmd "glog-ref"
|
||||
$ git interpret-trailers --trailer=see <msg.txt
|
||||
subject
|
||||
|
||||
message
|
||||
|
@ -427,22 +441,21 @@ See-also: fe3187489d69c4 (subject of related commit)
|
|||
to add a 'git-version' trailer:
|
||||
+
|
||||
------------
|
||||
$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF
|
||||
> ***subject***
|
||||
>
|
||||
> ***message***
|
||||
>
|
||||
> Fixes: Z
|
||||
> Cc: Z
|
||||
> Reviewed-by: Z
|
||||
> Signed-off-by: Z
|
||||
> EOF
|
||||
$ cat temp.txt
|
||||
***subject***
|
||||
|
||||
***message***
|
||||
|
||||
Fixes: Z
|
||||
Cc: Z
|
||||
Reviewed-by: Z
|
||||
Signed-off-by: Z
|
||||
$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
|
||||
$ git config commit.template commit_template.txt
|
||||
$ cat >.git/hooks/commit-msg <<EOF
|
||||
> #!/bin/sh
|
||||
> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
|
||||
> mv "\$1.new" "\$1"
|
||||
> EOF
|
||||
$ cat .git/hooks/commit-msg
|
||||
#!/bin/sh
|
||||
git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
|
||||
mv "\$1.new" "\$1"
|
||||
$ chmod +x .git/hooks/commit-msg
|
||||
------------
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ This is an integer status followed by a NUL character. The integer status is:
|
|||
|
||||
0: merge had conflicts
|
||||
1: merge was clean
|
||||
<0: something prevented the merge from running (e.g. access to repository
|
||||
<0: something prevented the merge from running (e.g. access to repository
|
||||
objects denied by filesystem)
|
||||
|
||||
[[OIDTLT]]
|
||||
|
|
|
@ -85,12 +85,13 @@ success of the resolution after the custom tool has exited.
|
|||
the default merge tool will be read from the configured
|
||||
`merge.guitool` variable instead of `merge.tool`. If
|
||||
`merge.guitool` is not set, we will fallback to the tool
|
||||
configured under `merge.tool`.
|
||||
configured under `merge.tool`. This may be autoselected using
|
||||
the configuration variable `mergetool.guiDefault`.
|
||||
|
||||
--no-gui::
|
||||
This overrides a previous `-g` or `--gui` setting and reads the
|
||||
default merge tool will be read from the configured `merge.tool`
|
||||
variable.
|
||||
This overrides a previous `-g` or `--gui` setting or
|
||||
`mergetool.guiDefault` configuration and reads the default merge
|
||||
tool from the configured `merge.tool` variable.
|
||||
|
||||
-O<orderfile>::
|
||||
Process files in the order specified in the
|
||||
|
|
|
@ -10,7 +10,7 @@ SYNOPSIS
|
|||
--------
|
||||
[verse]
|
||||
'git name-rev' [--tags] [--refs=<pattern>]
|
||||
( --all | --stdin | <commit-ish>... )
|
||||
( --all | --annotate-stdin | <commit-ish>... )
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
@ -46,7 +46,8 @@ OPTIONS
|
|||
Transform stdin by substituting all the 40-character SHA-1
|
||||
hexes (say $hex) with "$hex ($rev_name)". When used with
|
||||
--name-only, substitute with "$rev_name", omitting $hex
|
||||
altogether.
|
||||
altogether. This option was called `--stdin` in older versions
|
||||
of Git.
|
||||
+
|
||||
For example:
|
||||
+
|
||||
|
@ -70,10 +71,6 @@ The full name after substitution is master,
|
|||
while its tree object is 70d105cc79e63b81cfdcb08a15297c23e60b07ad
|
||||
-----------
|
||||
|
||||
--stdin::
|
||||
This option is deprecated in favor of 'git name-rev --annotate-stdin'.
|
||||
They are functionally equivalent.
|
||||
|
||||
--name-only::
|
||||
Instead of printing both the SHA-1 and the name, print only
|
||||
the name. If given with --tags the usual tag prefix of
|
||||
|
@ -107,7 +104,7 @@ Now you are wiser, because you know that it happened 940 revisions before v0.99.
|
|||
Another nice thing you can do is:
|
||||
|
||||
------------
|
||||
% git log | git name-rev --stdin
|
||||
% git log | git name-rev --annotate-stdin
|
||||
------------
|
||||
|
||||
GIT
|
||||
|
|
|
@ -11,6 +11,20 @@ SYNOPSIS
|
|||
[verse]
|
||||
'git pack-redundant' [--verbose] [--alt-odb] (--all | <pack-filename>...)
|
||||
|
||||
WARNING
|
||||
-------
|
||||
`git pack-redundant` has been deprecated and is scheduled for removal in
|
||||
a future version of Git. Because it can only remove entire duplicate
|
||||
packs and not individual duplicate objects, it is generally not a useful
|
||||
tool for reducing repository size. You are better off using `git gc` to
|
||||
do so, which will put objects into a new pack, removing duplicates.
|
||||
|
||||
Running `pack-redundant` without the `--i-still-use-this` flag will fail
|
||||
in this release. If you believe you have a use case for which
|
||||
`pack-redundant` is better suited and oppose this removal, please
|
||||
contact the Git mailing list at git@vger.kernel.org. More information
|
||||
about the list is available at https://git-scm.com/community.
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This program computes which packs in your repository
|
||||
|
|
|
@ -9,7 +9,7 @@ git-push - Update remote refs along with associated objects
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
|
||||
'git push' [--all | --branches | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
|
||||
[--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
|
||||
[-u | --set-upstream] [-o <string> | --push-option=<string>]
|
||||
[--[no-]signed|--signed=(true|false|if-asked)]
|
||||
|
@ -147,6 +147,7 @@ already exists on the remote side.
|
|||
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
|
||||
|
||||
--all::
|
||||
--branches::
|
||||
Push all branches (i.e. refs under `refs/heads/`); cannot be
|
||||
used with other <refspec>.
|
||||
|
||||
|
|
|
@ -529,20 +529,25 @@ See also INCOMPATIBLE OPTIONS below.
|
|||
|
||||
-r::
|
||||
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
|
||||
--no-rebase-merges::
|
||||
By default, a rebase will simply drop merge commits from the todo
|
||||
list, and put the rebased commits into a single, linear branch.
|
||||
With `--rebase-merges`, the rebase will instead try to preserve
|
||||
the branching structure within the commits that are to be rebased,
|
||||
by recreating the merge commits. Any resolved merge conflicts or
|
||||
manual amendments in these merge commits will have to be
|
||||
resolved/re-applied manually.
|
||||
resolved/re-applied manually. `--no-rebase-merges` can be used to
|
||||
countermand both the `rebase.rebaseMerges` config option and a previous
|
||||
`--rebase-merges`.
|
||||
+
|
||||
By default, or when `no-rebase-cousins` was specified, commits which do not
|
||||
have `<upstream>` as direct ancestor will keep their original branch point,
|
||||
i.e. commits that would be excluded by linkgit:git-log[1]'s
|
||||
`--ancestry-path` option will keep their original ancestry by default. If
|
||||
the `rebase-cousins` mode is turned on, such commits are instead rebased
|
||||
onto `<upstream>` (or `<onto>`, if specified).
|
||||
When rebasing merges, there are two modes: `rebase-cousins` and
|
||||
`no-rebase-cousins`. If the mode is not specified, it defaults to
|
||||
`no-rebase-cousins`. In `no-rebase-cousins` mode, commits which do not have
|
||||
`<upstream>` as direct ancestor will keep their original branch point, i.e.
|
||||
commits that would be excluded by linkgit:git-log[1]'s `--ancestry-path`
|
||||
option will keep their original ancestry by default. In `rebase-cousins` mode,
|
||||
such commits are instead rebased onto `<upstream>` (or `<onto>`, if
|
||||
specified).
|
||||
+
|
||||
It is currently only possible to recreate the merge commits using the
|
||||
`ort` merge strategy; different merge strategies can be used only via
|
||||
|
|
|
@ -197,10 +197,11 @@ respectively, and they must begin with `refs/` when applied to `--glob`
|
|||
or `--all`. If a trailing '/{asterisk}' is intended, it must be given
|
||||
explicitly.
|
||||
|
||||
--exclude-hidden=[receive|uploadpack]::
|
||||
Do not include refs that would be hidden by `git-receive-pack` or
|
||||
`git-upload-pack` by consulting the appropriate `receive.hideRefs` or
|
||||
`uploadpack.hideRefs` configuration along with `transfer.hideRefs` (see
|
||||
--exclude-hidden=[fetch|receive|uploadpack]::
|
||||
Do not include refs that would be hidden by `git-fetch`,
|
||||
`git-receive-pack` or `git-upload-pack` by consulting the appropriate
|
||||
`fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
|
||||
configuration along with `transfer.hideRefs` (see
|
||||
linkgit:git-config[1]). This option affects the next pseudo-ref option
|
||||
`--all` or `--glob` and is cleared after processing them.
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ See the CONFIGURATION section for `sendemail.multiEdit`.
|
|||
|
||||
--in-reply-to=<identifier>::
|
||||
Make the first mail (or all the mails with `--no-thread`) appear as a
|
||||
reply to the given Message-Id, which avoids breaking threads to
|
||||
reply to the given Message-ID, which avoids breaking threads to
|
||||
provide a new patch series.
|
||||
The second and subsequent emails will be sent as replies according to
|
||||
the `--[no-]chain-reply-to` setting.
|
||||
|
@ -320,6 +320,17 @@ Automating
|
|||
Output of this command must be single email address per line.
|
||||
Default is the value of `sendemail.ccCmd` configuration value.
|
||||
|
||||
--header-cmd=<command>::
|
||||
Specify a command that is executed once per outgoing message
|
||||
and output RFC 2822 style header lines to be inserted into
|
||||
them. When the `sendemail.headerCmd` configuration variable is
|
||||
set, its value is always used. When --header-cmd is provided
|
||||
at the command line, its value takes precedence over the
|
||||
`sendemail.headerCmd` configuration variable.
|
||||
|
||||
--no-header-cmd::
|
||||
Disable any header command in use.
|
||||
|
||||
--[no-]chain-reply-to::
|
||||
If this is set, each email will be sent as a reply to the previous
|
||||
email sent. If disabled with "--no-chain-reply-to", all emails after
|
||||
|
@ -484,14 +495,10 @@ edit ~/.gitconfig to specify your account settings:
|
|||
smtpServerPort = 587
|
||||
----
|
||||
|
||||
If you have multi-factor authentication set up on your Gmail account, you will
|
||||
need to generate an app-specific password for use with 'git send-email'. Visit
|
||||
If you have multi-factor authentication set up on your Gmail account, you can
|
||||
generate an app-specific password for use with 'git send-email'. Visit
|
||||
https://security.google.com/settings/security/apppasswords to create it.
|
||||
|
||||
If you do not have multi-factor authentication set up on your Gmail account,
|
||||
you will need to allow less secure app access. Visit
|
||||
https://myaccount.google.com/lesssecureapps to enable it.
|
||||
|
||||
Once your commits are ready to be sent to the mailing list, run the
|
||||
following commands:
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ git-sparse-checkout - Reduce your working tree to a subset of tracked files
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git sparse-checkout' (init | list | set | add | reapply | disable) [<options>]
|
||||
'git sparse-checkout' (init | list | set | add | reapply | disable | check-rules) [<options>]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -135,6 +135,29 @@ paths to pass to a subsequent 'set' or 'add' command. However,
|
|||
the disable command, so the easy restore of calling a plain `init`
|
||||
decreased in utility.
|
||||
|
||||
'check-rules'::
|
||||
Check whether sparsity rules match one or more paths.
|
||||
+
|
||||
By default `check-rules` reads a list of paths from stdin and outputs only
|
||||
the ones that match the current sparsity rules. The input is expected to consist
|
||||
of one path per line, matching the output of `git ls-tree --name-only` including
|
||||
that pathnames that begin with a double quote (") are interpreted as C-style
|
||||
quoted strings.
|
||||
+
|
||||
When called with the `--rules-file <file>` flag the input files are matched
|
||||
against the sparse checkout rules found in `<file>` instead of the current ones.
|
||||
The rules in the files are expected to be in the same form as accepted by `git
|
||||
sparse-checkout set --stdin` (in particular, they must be newline-delimited).
|
||||
+
|
||||
By default, the rules passed to the `--rules-file` option are interpreted as
|
||||
cone mode directories. To pass non-cone mode patterns with `--rules-file`,
|
||||
combine the option with the `--no-cone` option.
|
||||
+
|
||||
When called with the `-z` flag, the format of the paths input on stdin as well
|
||||
as the output paths are \0 terminated and not quoted. Note that this does not
|
||||
apply to the format of the rules passed with the `--rules-file` option.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
`git sparse-checkout set MY/DIR1 SUB/DIR2`::
|
||||
|
|
|
@ -131,6 +131,10 @@ options for details.
|
|||
--ignore-case::
|
||||
Sorting and filtering tags are case insensitive.
|
||||
|
||||
--omit-empty::
|
||||
Do not print a newline after formatted refs where the format expands
|
||||
to the empty string.
|
||||
|
||||
--column[=<options>]::
|
||||
--no-column::
|
||||
Display tag listing in columns. See configuration variable
|
||||
|
|
|
@ -546,9 +546,9 @@ double-quotes and respecting backslash escapes. E.g., the value
|
|||
|
||||
`GIT_DEFAULT_HASH`::
|
||||
If this variable is set, the default hash algorithm for new
|
||||
repositories will be set to this value. This value is currently
|
||||
ignored when cloning; the setting of the remote repository
|
||||
is used instead. The default is "sha1". THIS VARIABLE IS
|
||||
repositories will be set to this value. This value is
|
||||
ignored when cloning and the setting of the remote repository
|
||||
is always used. The default is "sha1". THIS VARIABLE IS
|
||||
EXPERIMENTAL! See `--object-format` in linkgit:git-init[1].
|
||||
|
||||
Git Commits
|
||||
|
|
|
@ -120,20 +120,19 @@ repository upon 'git add' and 'git commit'.
|
|||
`text`
|
||||
^^^^^^
|
||||
|
||||
This attribute enables and controls end-of-line normalization. When a
|
||||
text file is normalized, its line endings are converted to LF in the
|
||||
repository. To control what line ending style is used in the working
|
||||
directory, use the `eol` attribute for a single file and the
|
||||
`core.eol` configuration variable for all text files.
|
||||
Note that setting `core.autocrlf` to `true` or `input` overrides
|
||||
`core.eol` (see the definitions of those options in
|
||||
linkgit:git-config[1]).
|
||||
This attribute marks the path as a text file, which enables end-of-line
|
||||
conversion: When a matching file is added to the index, the file's line
|
||||
endings are normalized to LF in the index. Conversely, when the file is
|
||||
copied from the index to the working directory, its line endings may be
|
||||
converted from LF to CRLF depending on the `eol` attribute, the Git
|
||||
config, and the platform (see explanation of `eol` below).
|
||||
|
||||
Set::
|
||||
|
||||
Setting the `text` attribute on a path enables end-of-line
|
||||
normalization and marks the path as a text file. End-of-line
|
||||
conversion takes place without guessing the content type.
|
||||
conversion on checkin and checkout as described above. Line endings
|
||||
are normalized to LF in the index every time the file is checked in,
|
||||
even if the file was previously added to Git with CRLF line endings.
|
||||
|
||||
Unset::
|
||||
|
||||
|
@ -142,10 +141,11 @@ Unset::
|
|||
|
||||
Set to string value "auto"::
|
||||
|
||||
When `text` is set to "auto", the path is marked for automatic
|
||||
end-of-line conversion. If Git decides that the content is
|
||||
text, its line endings are converted to LF on checkin.
|
||||
When the file has been committed with CRLF, no conversion is done.
|
||||
When `text` is set to "auto", Git decides by itself whether the file
|
||||
is text or binary. If it is text and the file was not already in
|
||||
Git with CRLF endings, line endings are converted on checkin and
|
||||
checkout as described above. Otherwise, no conversion is done on
|
||||
checkin or checkout.
|
||||
|
||||
Unspecified::
|
||||
|
||||
|
@ -159,26 +159,29 @@ unspecified.
|
|||
`eol`
|
||||
^^^^^
|
||||
|
||||
This attribute sets a specific line-ending style to be used in the
|
||||
working directory. This attribute has effect only if the `text`
|
||||
attribute is set or unspecified, or if it is set to `auto`, the file is
|
||||
detected as text, and it is stored with LF endings in the index. Note
|
||||
that setting this attribute on paths which are in the index with CRLF
|
||||
line endings may make the paths to be considered dirty unless
|
||||
`text=auto` is set. Adding the path to the index again will normalize
|
||||
the line endings in the index.
|
||||
This attribute marks a path to use a specific line-ending style in the
|
||||
working tree when it is checked out. It has effect only if `text` or
|
||||
`text=auto` is set (see above), but specifying `eol` automatically sets
|
||||
`text` if `text` was left unspecified.
|
||||
|
||||
Set to string value "crlf"::
|
||||
|
||||
This setting forces Git to normalize line endings for this
|
||||
file on checkin and convert them to CRLF when the file is
|
||||
checked out.
|
||||
This setting converts the file's line endings in the working
|
||||
directory to CRLF when the file is checked out.
|
||||
|
||||
Set to string value "lf"::
|
||||
|
||||
This setting forces Git to normalize line endings to LF on
|
||||
checkin and prevents conversion to CRLF when the file is
|
||||
checked out.
|
||||
This setting uses the same line endings in the working directory as
|
||||
in the index when the file is checked out.
|
||||
|
||||
Unspecified::
|
||||
|
||||
If the `eol` attribute is unspecified for a file, its line endings
|
||||
in the working directory are determined by the `core.autocrlf` or
|
||||
`core.eol` configuration variable (see the definitions of those
|
||||
options in linkgit:git-config[1]). If `text` is set but neither of
|
||||
those variables is, the default is `eol=crlf` on Windows and
|
||||
`eol=lf` on all other platforms.
|
||||
|
||||
Backwards compatibility with `crlf` attribute
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -611,8 +611,8 @@ result of repeatedly resetting the objects' mtimes to the present time.
|
|||
|
||||
If you are GC-ing repositories in a mixed version environment, consider omitting
|
||||
the `--cruft` option when using linkgit:git-repack[1] and linkgit:git-gc[1], and
|
||||
leaving the `gc.cruftPacks` configuration unset until all writers understand
|
||||
cruft packs.
|
||||
setting the `gc.cruftPacks` configuration to "false" until all writers
|
||||
understand cruft packs.
|
||||
|
||||
=== Alternatives
|
||||
|
||||
|
|
|
@ -595,10 +595,51 @@ processed by rebase.
|
|||
sendemail-validate
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This hook is invoked by linkgit:git-send-email[1]. It takes a single parameter,
|
||||
the name of the file that holds the e-mail to be sent. Exiting with a
|
||||
non-zero status causes `git send-email` to abort before sending any
|
||||
e-mails.
|
||||
This hook is invoked by linkgit:git-send-email[1].
|
||||
|
||||
It takes these command line arguments. They are,
|
||||
1. the name of the file which holds the contents of the email to be sent.
|
||||
2. The name of the file which holds the SMTP headers of the email.
|
||||
|
||||
The SMTP headers are passed in the exact same way as they are passed to the
|
||||
user's Mail Transport Agent (MTA). In effect, the email given to the user's
|
||||
MTA, is the contents of $2 followed by the contents of $1.
|
||||
|
||||
An example of a few common headers is shown below. Take notice of the
|
||||
capitalization and multi-line tab structure.
|
||||
|
||||
From: Example <from@example.com>
|
||||
To: to@example.com
|
||||
Cc: cc@example.com,
|
||||
A <author@example.com>,
|
||||
One <one@example.com>,
|
||||
two@example.com
|
||||
Subject: PATCH-STRING
|
||||
|
||||
Exiting with a non-zero status causes `git send-email` to abort
|
||||
before sending any e-mails.
|
||||
|
||||
The following environment variables are set when executing the hook.
|
||||
|
||||
`GIT_SENDEMAIL_FILE_COUNTER`::
|
||||
A 1-based counter incremented by one for every file holding an e-mail
|
||||
to be sent (excluding any FIFOs). This counter does not follow the
|
||||
patch series counter scheme. It will always start at 1 and will end at
|
||||
GIT_SENDEMAIL_FILE_TOTAL.
|
||||
|
||||
`GIT_SENDEMAIL_FILE_TOTAL`::
|
||||
The total number of files that will be sent (excluding any FIFOs). This
|
||||
counter does not follow the patch series counter scheme. It will always
|
||||
be equal to the number of files being sent, whether there is a cover
|
||||
letter or not.
|
||||
|
||||
These variables may for instance be used to validate patch series.
|
||||
|
||||
The sample `sendemail-validate` hook that comes with Git checks that all sent
|
||||
patches (excluding the cover letter) can be applied on top of the upstream
|
||||
repository default branch without conflicts. Some placeholders are left for
|
||||
additional validation steps to be performed after all patches of a given series
|
||||
have been applied.
|
||||
|
||||
fsmonitor-watchman
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -146,7 +146,9 @@ The purpose of gitignore files is to ensure that certain files
|
|||
not tracked by Git remain untracked.
|
||||
|
||||
To stop tracking a file that is currently tracked, use
|
||||
'git rm --cached'.
|
||||
'git rm --cached' to remove the file from the index. The filename
|
||||
can then be added to the `.gitignore` file to stop the file from
|
||||
being reintroduced in later commits.
|
||||
|
||||
Git does not follow symbolic links when accessing a `.gitignore` file in
|
||||
the working tree. This keeps behavior consistent when the file is
|
||||
|
|
|
@ -49,7 +49,7 @@ $ git config --global user.email you@yourdomain.example.com
|
|||
Importing a new project
|
||||
-----------------------
|
||||
|
||||
Assume you have a tarball project.tar.gz with your initial work. You
|
||||
Assume you have a tarball `project.tar.gz` with your initial work. You
|
||||
can place it under Git revision control as follows.
|
||||
|
||||
------------------------------------------------
|
||||
|
@ -65,10 +65,10 @@ Initialized empty Git repository in .git/
|
|||
------------------------------------------------
|
||||
|
||||
You've now initialized the working directory--you may notice a new
|
||||
directory created, named ".git".
|
||||
directory created, named `.git`.
|
||||
|
||||
Next, tell Git to take a snapshot of the contents of all files under the
|
||||
current directory (note the '.'), with 'git add':
|
||||
current directory (note the `.`), with `git add`:
|
||||
|
||||
------------------------------------------------
|
||||
$ git add .
|
||||
|
@ -76,7 +76,7 @@ $ git add .
|
|||
|
||||
This snapshot is now stored in a temporary staging area which Git calls
|
||||
the "index". You can permanently store the contents of the index in the
|
||||
repository with 'git commit':
|
||||
repository with `git commit`:
|
||||
|
||||
------------------------------------------------
|
||||
$ git commit
|
||||
|
@ -95,21 +95,20 @@ $ git add file1 file2 file3
|
|||
------------------------------------------------
|
||||
|
||||
You are now ready to commit. You can see what is about to be committed
|
||||
using 'git diff' with the --cached option:
|
||||
using `git diff` with the `--cached` option:
|
||||
|
||||
------------------------------------------------
|
||||
$ git diff --cached
|
||||
------------------------------------------------
|
||||
|
||||
(Without --cached, 'git diff' will show you any changes that
|
||||
(Without `--cached`, `git diff` will show you any changes that
|
||||
you've made but not yet added to the index.) You can also get a brief
|
||||
summary of the situation with 'git status':
|
||||
summary of the situation with `git status`:
|
||||
|
||||
------------------------------------------------
|
||||
$ git status
|
||||
On branch master
|
||||
Changes to be committed:
|
||||
Your branch is up to date with 'origin/master'.
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
|
||||
modified: file1
|
||||
|
@ -128,7 +127,7 @@ $ git commit
|
|||
This will again prompt you for a message describing the change, and then
|
||||
record a new version of the project.
|
||||
|
||||
Alternatively, instead of running 'git add' beforehand, you can use
|
||||
Alternatively, instead of running `git add` beforehand, you can use
|
||||
|
||||
------------------------------------------------
|
||||
$ git commit -a
|
||||
|
@ -151,7 +150,7 @@ Git tracks content not files
|
|||
|
||||
Many revision control systems provide an `add` command that tells the
|
||||
system to start tracking changes to a new file. Git's `add` command
|
||||
does something simpler and more powerful: 'git add' is used both for new
|
||||
does something simpler and more powerful: `git add` is used both for new
|
||||
and newly modified files, and in both cases it takes a snapshot of the
|
||||
given files and stages that content in the index, ready for inclusion in
|
||||
the next commit.
|
||||
|
@ -182,7 +181,7 @@ Managing branches
|
|||
-----------------
|
||||
|
||||
A single Git repository can maintain multiple branches of
|
||||
development. To create a new branch named "experimental", use
|
||||
development. To create a new branch named `experimental`, use
|
||||
|
||||
------------------------------------------------
|
||||
$ git branch experimental
|
||||
|
@ -201,8 +200,8 @@ you'll get a list of all existing branches:
|
|||
* master
|
||||
------------------------------------------------
|
||||
|
||||
The "experimental" branch is the one you just created, and the
|
||||
"master" branch is a default branch that was created for you
|
||||
The `experimental` branch is the one you just created, and the
|
||||
`master` branch is a default branch that was created for you
|
||||
automatically. The asterisk marks the branch you are currently on;
|
||||
type
|
||||
|
||||
|
@ -210,8 +209,8 @@ type
|
|||
$ git switch experimental
|
||||
------------------------------------------------
|
||||
|
||||
to switch to the experimental branch. Now edit a file, commit the
|
||||
change, and switch back to the master branch:
|
||||
to switch to the `experimental` branch. Now edit a file, commit the
|
||||
change, and switch back to the `master` branch:
|
||||
|
||||
------------------------------------------------
|
||||
(edit file)
|
||||
|
@ -220,9 +219,9 @@ $ git switch master
|
|||
------------------------------------------------
|
||||
|
||||
Check that the change you made is no longer visible, since it was
|
||||
made on the experimental branch and you're back on the master branch.
|
||||
made on the `experimental` branch and you're back on the `master` branch.
|
||||
|
||||
You can make a different change on the master branch:
|
||||
You can make a different change on the `master` branch:
|
||||
|
||||
------------------------------------------------
|
||||
(edit file)
|
||||
|
@ -230,7 +229,7 @@ $ git commit -a
|
|||
------------------------------------------------
|
||||
|
||||
at this point the two branches have diverged, with different changes
|
||||
made in each. To merge the changes made in experimental into master, run
|
||||
made in each. To merge the changes made in `experimental` into `master`, run
|
||||
|
||||
------------------------------------------------
|
||||
$ git merge experimental
|
||||
|
@ -258,16 +257,16 @@ $ gitk
|
|||
|
||||
will show a nice graphical representation of the resulting history.
|
||||
|
||||
At this point you could delete the experimental branch with
|
||||
At this point you could delete the `experimental` branch with
|
||||
|
||||
------------------------------------------------
|
||||
$ git branch -d experimental
|
||||
------------------------------------------------
|
||||
|
||||
This command ensures that the changes in the experimental branch are
|
||||
This command ensures that the changes in the `experimental` branch are
|
||||
already in the current branch.
|
||||
|
||||
If you develop on a branch crazy-idea, then regret it, you can always
|
||||
If you develop on a branch `crazy-idea`, then regret it, you can always
|
||||
delete the branch with
|
||||
|
||||
-------------------------------------
|
||||
|
@ -281,7 +280,7 @@ Using Git for collaboration
|
|||
---------------------------
|
||||
|
||||
Suppose that Alice has started a new project with a Git repository in
|
||||
/home/alice/project, and that Bob, who has a home directory on the
|
||||
`/home/alice/project`, and that Bob, who has a home directory on the
|
||||
same machine, wants to contribute.
|
||||
|
||||
Bob begins with:
|
||||
|
@ -290,7 +289,7 @@ Bob begins with:
|
|||
bob$ git clone /home/alice/project myrepo
|
||||
------------------------------------------------
|
||||
|
||||
This creates a new directory "myrepo" containing a clone of Alice's
|
||||
This creates a new directory `myrepo` containing a clone of Alice's
|
||||
repository. The clone is on an equal footing with the original
|
||||
project, possessing its own copy of the original project's history.
|
||||
|
||||
|
@ -303,31 +302,31 @@ bob$ git commit -a
|
|||
------------------------------------------------
|
||||
|
||||
When he's ready, he tells Alice to pull changes from the repository
|
||||
at /home/bob/myrepo. She does this with:
|
||||
at `/home/bob/myrepo`. She does this with:
|
||||
|
||||
------------------------------------------------
|
||||
alice$ cd /home/alice/project
|
||||
alice$ git pull /home/bob/myrepo master
|
||||
------------------------------------------------
|
||||
|
||||
This merges the changes from Bob's "master" branch into Alice's
|
||||
This merges the changes from Bob's `master` branch into Alice's
|
||||
current branch. If Alice has made her own changes in the meantime,
|
||||
then she may need to manually fix any conflicts.
|
||||
|
||||
The "pull" command thus performs two operations: it fetches changes
|
||||
The `pull` command thus performs two operations: it fetches changes
|
||||
from a remote branch, then merges them into the current branch.
|
||||
|
||||
Note that in general, Alice would want her local changes committed before
|
||||
initiating this "pull". If Bob's work conflicts with what Alice did since
|
||||
initiating this `pull`. If Bob's work conflicts with what Alice did since
|
||||
their histories forked, Alice will use her working tree and the index to
|
||||
resolve conflicts, and existing local changes will interfere with the
|
||||
conflict resolution process (Git will still perform the fetch but will
|
||||
refuse to merge -- Alice will have to get rid of her local changes in
|
||||
some way and pull again when this happens).
|
||||
|
||||
Alice can peek at what Bob did without merging first, using the "fetch"
|
||||
Alice can peek at what Bob did without merging first, using the `fetch`
|
||||
command; this allows Alice to inspect what Bob did, using a special
|
||||
symbol "FETCH_HEAD", in order to determine if he has anything worth
|
||||
symbol `FETCH_HEAD`, in order to determine if he has anything worth
|
||||
pulling, like this:
|
||||
|
||||
------------------------------------------------
|
||||
|
@ -336,10 +335,10 @@ alice$ git log -p HEAD..FETCH_HEAD
|
|||
------------------------------------------------
|
||||
|
||||
This operation is safe even if Alice has uncommitted local changes.
|
||||
The range notation "HEAD..FETCH_HEAD" means "show everything that is reachable
|
||||
from the FETCH_HEAD but exclude anything that is reachable from HEAD".
|
||||
Alice already knows everything that leads to her current state (HEAD),
|
||||
and reviews what Bob has in his state (FETCH_HEAD) that she has not
|
||||
The range notation `HEAD..FETCH_HEAD` means "show everything that is reachable
|
||||
from the `FETCH_HEAD` but exclude anything that is reachable from `HEAD`".
|
||||
Alice already knows everything that leads to her current state (`HEAD`),
|
||||
and reviews what Bob has in his state (`FETCH_HEAD`) that she has not
|
||||
seen with this command.
|
||||
|
||||
If Alice wants to visualize what Bob did since their histories forked
|
||||
|
@ -349,7 +348,7 @@ she can issue the following command:
|
|||
$ gitk HEAD..FETCH_HEAD
|
||||
------------------------------------------------
|
||||
|
||||
This uses the same two-dot range notation we saw earlier with 'git log'.
|
||||
This uses the same two-dot range notation we saw earlier with `git log`.
|
||||
|
||||
Alice may want to view what both of them did since they forked.
|
||||
She can use three-dot form instead of the two-dot form:
|
||||
|
@ -361,13 +360,13 @@ $ gitk HEAD...FETCH_HEAD
|
|||
This means "show everything that is reachable from either one, but
|
||||
exclude anything that is reachable from both of them".
|
||||
|
||||
Please note that these range notation can be used with both gitk
|
||||
and "git log".
|
||||
Please note that these range notation can be used with both `gitk`
|
||||
and `git log`.
|
||||
|
||||
After inspecting what Bob did, if there is nothing urgent, Alice may
|
||||
decide to continue working without pulling from Bob. If Bob's history
|
||||
does have something Alice would immediately need, Alice may choose to
|
||||
stash her work-in-progress first, do a "pull", and then finally unstash
|
||||
stash her work-in-progress first, do a `pull`, and then finally unstash
|
||||
her work-in-progress on top of the resulting history.
|
||||
|
||||
When you are working in a small closely knit group, it is not
|
||||
|
@ -379,8 +378,8 @@ it easier:
|
|||
alice$ git remote add bob /home/bob/myrepo
|
||||
------------------------------------------------
|
||||
|
||||
With this, Alice can perform the first part of the "pull" operation
|
||||
alone using the 'git fetch' command without merging them with her own
|
||||
With this, Alice can perform the first part of the `pull` operation
|
||||
alone using the `git fetch` command without merging them with her own
|
||||
branch, using:
|
||||
|
||||
-------------------------------------
|
||||
|
@ -388,7 +387,7 @@ alice$ git fetch bob
|
|||
-------------------------------------
|
||||
|
||||
Unlike the longhand form, when Alice fetches from Bob using a
|
||||
remote repository shorthand set up with 'git remote', what was
|
||||
remote repository shorthand set up with `git remote`, what was
|
||||
fetched is stored in a remote-tracking branch, in this case
|
||||
`bob/master`. So after this:
|
||||
|
||||
|
@ -397,10 +396,10 @@ alice$ git log -p master..bob/master
|
|||
-------------------------------------
|
||||
|
||||
shows a list of all the changes that Bob made since he branched from
|
||||
Alice's master branch.
|
||||
Alice's `master` branch.
|
||||
|
||||
After examining those changes, Alice
|
||||
could merge the changes into her master branch:
|
||||
could merge the changes into her `master` branch:
|
||||
|
||||
-------------------------------------
|
||||
alice$ git merge bob/master
|
||||
|
@ -432,12 +431,12 @@ bob$ git config --get remote.origin.url
|
|||
/home/alice/project
|
||||
-------------------------------------
|
||||
|
||||
(The complete configuration created by 'git clone' is visible using
|
||||
(The complete configuration created by `git clone` is visible using
|
||||
`git config -l`, and the linkgit:git-config[1] man page
|
||||
explains the meaning of each option.)
|
||||
|
||||
Git also keeps a pristine copy of Alice's master branch under the
|
||||
name "origin/master":
|
||||
Git also keeps a pristine copy of Alice's `master` branch under the
|
||||
name `origin/master`:
|
||||
|
||||
-------------------------------------
|
||||
bob$ git branch -r
|
||||
|
@ -462,8 +461,8 @@ Exploring history
|
|||
-----------------
|
||||
|
||||
Git history is represented as a series of interrelated commits. We
|
||||
have already seen that the 'git log' command can list those commits.
|
||||
Note that first line of each git log entry also gives a name for the
|
||||
have already seen that the `git log` command can list those commits.
|
||||
Note that first line of each `git log` entry also gives a name for the
|
||||
commit:
|
||||
|
||||
-------------------------------------
|
||||
|
@ -475,7 +474,7 @@ Date: Tue May 16 17:18:22 2006 -0700
|
|||
merge-base: Clarify the comments on post processing.
|
||||
-------------------------------------
|
||||
|
||||
We can give this name to 'git show' to see the details about this
|
||||
We can give this name to `git show` to see the details about this
|
||||
commit.
|
||||
|
||||
-------------------------------------
|
||||
|
@ -514,7 +513,7 @@ You can also give commits names of your own; after running
|
|||
$ git tag v2.5 1b2e1d63ff
|
||||
-------------------------------------
|
||||
|
||||
you can refer to 1b2e1d63ff by the name "v2.5". If you intend to
|
||||
you can refer to `1b2e1d63ff` by the name `v2.5`. If you intend to
|
||||
share this name with other people (for example, to identify a release
|
||||
version), you should create a "tag" object, and perhaps sign it; see
|
||||
linkgit:git-tag[1] for details.
|
||||
|
@ -533,22 +532,22 @@ $ git reset --hard HEAD^ # reset your current branch and working
|
|||
Be careful with that last command: in addition to losing any changes
|
||||
in the working directory, it will also remove all later commits from
|
||||
this branch. If this branch is the only branch containing those
|
||||
commits, they will be lost. Also, don't use 'git reset' on a
|
||||
commits, they will be lost. Also, don't use `git reset` on a
|
||||
publicly-visible branch that other developers pull from, as it will
|
||||
force needless merges on other developers to clean up the history.
|
||||
If you need to undo changes that you have pushed, use 'git revert'
|
||||
If you need to undo changes that you have pushed, use `git revert`
|
||||
instead.
|
||||
|
||||
The 'git grep' command can search for strings in any version of your
|
||||
The `git grep` command can search for strings in any version of your
|
||||
project, so
|
||||
|
||||
-------------------------------------
|
||||
$ git grep "hello" v2.5
|
||||
-------------------------------------
|
||||
|
||||
searches for all occurrences of "hello" in v2.5.
|
||||
searches for all occurrences of "hello" in `v2.5`.
|
||||
|
||||
If you leave out the commit name, 'git grep' will search any of the
|
||||
If you leave out the commit name, `git grep` will search any of the
|
||||
files it manages in your current directory. So
|
||||
|
||||
-------------------------------------
|
||||
|
@ -558,7 +557,7 @@ $ git grep "hello"
|
|||
is a quick way to search just the files that are tracked by Git.
|
||||
|
||||
Many Git commands also take sets of commits, which can be specified
|
||||
in a number of ways. Here are some examples with 'git log':
|
||||
in a number of ways. Here are some examples with `git log`:
|
||||
|
||||
-------------------------------------
|
||||
$ git log v2.5..v2.6 # commits between v2.5 and v2.6
|
||||
|
@ -568,16 +567,16 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify
|
|||
# Makefile
|
||||
-------------------------------------
|
||||
|
||||
You can also give 'git log' a "range" of commits where the first is not
|
||||
You can also give `git log` a "range" of commits where the first is not
|
||||
necessarily an ancestor of the second; for example, if the tips of
|
||||
the branches "stable" and "master" diverged from a common
|
||||
the branches `stable` and `master` diverged from a common
|
||||
commit some time ago, then
|
||||
|
||||
-------------------------------------
|
||||
$ git log stable..master
|
||||
-------------------------------------
|
||||
|
||||
will list commits made in the master branch but not in the
|
||||
will list commits made in the `master` branch but not in the
|
||||
stable branch, while
|
||||
|
||||
-------------------------------------
|
||||
|
@ -585,15 +584,15 @@ $ git log master..stable
|
|||
-------------------------------------
|
||||
|
||||
will show the list of commits made on the stable branch but not
|
||||
the master branch.
|
||||
the `master` branch.
|
||||
|
||||
The 'git log' command has a weakness: it must present commits in a
|
||||
The `git log` command has a weakness: it must present commits in a
|
||||
list. When the history has lines of development that diverged and
|
||||
then merged back together, the order in which 'git log' presents
|
||||
then merged back together, the order in which `git log` presents
|
||||
those commits is meaningless.
|
||||
|
||||
Most projects with multiple contributors (such as the Linux kernel,
|
||||
or Git itself) have frequent merges, and 'gitk' does a better job of
|
||||
or Git itself) have frequent merges, and `gitk` does a better job of
|
||||
visualizing their history. For example,
|
||||
|
||||
-------------------------------------
|
||||
|
@ -601,7 +600,7 @@ $ gitk --since="2 weeks ago" drivers/
|
|||
-------------------------------------
|
||||
|
||||
allows you to browse any commits from the last 2 weeks of commits
|
||||
that modified files under the "drivers" directory. (Note: you can
|
||||
that modified files under the `drivers` directory. (Note: you can
|
||||
adjust gitk's fonts by holding down the control key while pressing
|
||||
"-" or "+".)
|
||||
|
||||
|
@ -613,7 +612,7 @@ of the file:
|
|||
$ git diff v2.5:Makefile HEAD:Makefile.in
|
||||
-------------------------------------
|
||||
|
||||
You can also use 'git show' to see any such file:
|
||||
You can also use `git show` to see any such file:
|
||||
|
||||
-------------------------------------
|
||||
$ git show v2.5:Makefile
|
||||
|
@ -649,7 +648,7 @@ digressions that may be interesting at this point are:
|
|||
|
||||
* linkgit:git-bisect[1]: When there is a regression in your
|
||||
project, one way to track down the bug is by searching through
|
||||
the history to find the exact commit that's to blame. Git bisect
|
||||
the history to find the exact commit that's to blame. `git bisect`
|
||||
can help you perform a binary search for that commit. It is
|
||||
smart enough to perform a close-to-optimal search even in the
|
||||
case of complex non-linear history with lots of merged branches.
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<!-- manpage-base-url.xsl:
|
||||
special settings for manpages rendered from newer docbook -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<!-- set a base URL for relative links -->
|
||||
<xsl:param name="man.base.url.for.relative.links"
|
||||
>@@MAN_BASE_URL@@</xsl:param>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -8,19 +8,7 @@
|
|||
<xsl:param name="man.output.quietly" select="1"/>
|
||||
<xsl:param name="refentry.meta.get.quietly" select="1"/>
|
||||
|
||||
<!-- convert asciidoc callouts to man page format -->
|
||||
<xsl:template match="co">
|
||||
<xsl:value-of select="concat('\fB(',substring-after(@id,'-'),')\fR')"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="calloutlist">
|
||||
<xsl:text>.sp </xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
<xsl:template match="callout">
|
||||
<xsl:value-of select="concat('\fB',substring-after(@arearefs,'-'),'. \fR')"/>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>.br </xsl:text>
|
||||
</xsl:template>
|
||||
<!-- unset maximum length of title -->
|
||||
<xsl:param name="man.th.title.max.length"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<!-- work around newer groff/man setups using a prettier apostrophe
|
||||
that unfortunately does not quote anything when cut&pasting
|
||||
examples to the shell -->
|
||||
<xsl:template name="escape.apostrophe">
|
||||
<xsl:param name="content"/>
|
||||
<xsl:call-template name="string.subst">
|
||||
<xsl:with-param name="string" select="$content"/>
|
||||
<xsl:with-param name="target">'</xsl:with-param>
|
||||
<xsl:with-param name="replacement">\(aq</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -195,10 +195,11 @@ respectively, and they must begin with `refs/` when applied to `--glob`
|
|||
or `--all`. If a trailing '/{asterisk}' is intended, it must be given
|
||||
explicitly.
|
||||
|
||||
--exclude-hidden=[receive|uploadpack]::
|
||||
Do not include refs that would be hidden by `git-receive-pack` or
|
||||
`git-upload-pack` by consulting the appropriate `receive.hideRefs` or
|
||||
`uploadpack.hideRefs` configuration along with `transfer.hideRefs` (see
|
||||
--exclude-hidden=[fetch|receive|uploadpack]::
|
||||
Do not include refs that would be hidden by `git-fetch`,
|
||||
`git-receive-pack` or `git-upload-pack` by consulting the appropriate
|
||||
`fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
|
||||
configuration along with `transfer.hideRefs` (see
|
||||
linkgit:git-config[1]). This option affects the next pseudo-ref option
|
||||
`--all` or `--glob` and is cleared after processing them.
|
||||
|
||||
|
@ -889,7 +890,7 @@ ifdef::git-rev-list[]
|
|||
Print the object IDs of any object referenced by the listed
|
||||
commits. `--objects foo ^bar` thus means ``send me
|
||||
all object IDs which I need to download if I have the commit
|
||||
object _bar_ but not _foo_''.
|
||||
object _bar_ but not _foo_''. See also `--object-names` below.
|
||||
|
||||
--in-commit-order::
|
||||
Print tree and blob ids in order of the commits. The tree
|
||||
|
@ -919,7 +920,12 @@ ifdef::git-rev-list[]
|
|||
|
||||
--object-names::
|
||||
Only useful with `--objects`; print the names of the object IDs
|
||||
that are found. This is the default behavior.
|
||||
that are found. This is the default behavior. Note that the
|
||||
"name" of each object is ambiguous, and mostly intended as a
|
||||
hint for packing objects. In particular: no distinction is made between
|
||||
the names of tags, trees, and blobs; path names may be modified
|
||||
to remove newlines; and if an object would appear multiple times
|
||||
with different names, only one name is shown.
|
||||
|
||||
--no-object-names::
|
||||
Only useful with `--objects`; does not print the names of the object
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
GVF=GIT-VERSION-FILE
|
||||
DEF_VER=v2.40.0-rc2
|
||||
DEF_VER=v2.40.GIT
|
||||
|
||||
LF='
|
||||
'
|
||||
|
|
6
Makefile
6
Makefile
|
@ -207,10 +207,6 @@ include shared.mak
|
|||
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
|
||||
# field that counts the on-disk footprint in 512-byte blocks.
|
||||
#
|
||||
# Define GNU_ROFF if your target system uses GNU groff. This forces
|
||||
# apostrophes to be ASCII so that cut&pasting examples to the shell
|
||||
# will work.
|
||||
#
|
||||
# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
|
||||
# documentation.
|
||||
#
|
||||
|
@ -1036,6 +1032,7 @@ LIB_OBJS += fsmonitor.o
|
|||
LIB_OBJS += fsmonitor-ipc.o
|
||||
LIB_OBJS += fsmonitor-settings.o
|
||||
LIB_OBJS += gettext.o
|
||||
LIB_OBJS += git-zlib.o
|
||||
LIB_OBJS += gpg-interface.o
|
||||
LIB_OBJS += graph.o
|
||||
LIB_OBJS += grep.o
|
||||
|
@ -1196,7 +1193,6 @@ LIB_OBJS += write-or-die.o
|
|||
LIB_OBJS += ws.o
|
||||
LIB_OBJS += wt-status.o
|
||||
LIB_OBJS += xdiff-interface.o
|
||||
LIB_OBJS += zlib.o
|
||||
|
||||
BUILTIN_OBJS += builtin/add.o
|
||||
BUILTIN_OBJS += builtin/am.o
|
||||
|
|
11
abspath.c
11
abspath.c
|
@ -1,4 +1,6 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "abspath.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
/*
|
||||
* Do not use this for inspecting *tracked* content. When path is a
|
||||
|
@ -280,3 +282,10 @@ char *prefix_filename(const char *pfx, const char *arg)
|
|||
#endif
|
||||
return strbuf_detach(&path, NULL);
|
||||
}
|
||||
|
||||
char *prefix_filename_except_for_dash(const char *pfx, const char *arg)
|
||||
{
|
||||
if (!strcmp(arg, "-"))
|
||||
return xstrdup(arg);
|
||||
return prefix_filename(pfx, arg);
|
||||
}
|
||||
|
|
33
abspath.h
Normal file
33
abspath.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef ABSPATH_H
|
||||
#define ABSPATH_H
|
||||
|
||||
int is_directory(const char *);
|
||||
char *strbuf_realpath(struct strbuf *resolved, const char *path,
|
||||
int die_on_error);
|
||||
char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
|
||||
int die_on_error);
|
||||
char *real_pathdup(const char *path, int die_on_error);
|
||||
const char *absolute_path(const char *path);
|
||||
char *absolute_pathdup(const char *path);
|
||||
|
||||
/*
|
||||
* Concatenate "prefix" (if len is non-zero) and "path", with no
|
||||
* connecting characters (so "prefix" should end with a "/").
|
||||
* Unlike prefix_path, this should be used if the named file does
|
||||
* not have to interact with index entry; i.e. name of a random file
|
||||
* on the filesystem.
|
||||
*
|
||||
* The return value is always a newly allocated string (even if the
|
||||
* prefix was empty).
|
||||
*/
|
||||
char *prefix_filename(const char *prefix, const char *path);
|
||||
|
||||
/* Likewise, but path=="-" always yields "-" */
|
||||
char *prefix_filename_except_for_dash(const char *prefix, const char *path);
|
||||
|
||||
static inline int is_absolute_path(const char *path)
|
||||
{
|
||||
return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
|
||||
}
|
||||
|
||||
#endif /* ABSPATH_H */
|
|
@ -3,6 +3,8 @@
|
|||
#include "color.h"
|
||||
#include "config.h"
|
||||
#include "diffcore.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "revision.h"
|
||||
#include "refs.h"
|
||||
#include "string-list.h"
|
||||
|
@ -10,6 +12,7 @@
|
|||
#include "dir.h"
|
||||
#include "run-command.h"
|
||||
#include "prompt.h"
|
||||
#include "tree.h"
|
||||
|
||||
static void init_color(struct repository *r, struct add_i_state *s,
|
||||
const char *section_and_slot, char *dst,
|
||||
|
@ -551,7 +554,7 @@ static int get_modified_files(struct repository *r,
|
|||
opt.def = is_initial ?
|
||||
empty_tree_oid_hex() : oid_to_hex(&head_oid);
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(r, &rev, NULL);
|
||||
setup_revisions(0, NULL, &rev, &opt);
|
||||
|
||||
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
|
||||
|
|
11
add-patch.c
11
add-patch.c
|
@ -1,5 +1,11 @@
|
|||
#include "cache.h"
|
||||
#include "add-interactive.h"
|
||||
#include "advice.h"
|
||||
#include "alloc.h"
|
||||
#include "editor.h"
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "object-name.h"
|
||||
#include "strbuf.h"
|
||||
#include "run-command.h"
|
||||
#include "strvec.h"
|
||||
|
@ -414,7 +420,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
|
|||
strvec_push(&args,
|
||||
/* could be on an unborn branch */
|
||||
!strcmp("HEAD", s->revision) &&
|
||||
get_oid("HEAD", &oid) ?
|
||||
repo_get_oid(the_repository, "HEAD", &oid) ?
|
||||
empty_tree_oid_hex() : s->revision);
|
||||
}
|
||||
color_arg_index = args.nr;
|
||||
|
@ -483,7 +489,8 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
|
|||
if (!eol)
|
||||
eol = pend;
|
||||
|
||||
if (starts_with(p, "diff ")) {
|
||||
if (starts_with(p, "diff ") ||
|
||||
starts_with(p, "* Unmerged path ")) {
|
||||
complete_file(marker, hunk);
|
||||
ALLOC_GROW_BY(s->file_diff, s->file_diff_nr, 1,
|
||||
file_diff_alloc);
|
||||
|
|
13
advice.c
13
advice.c
|
@ -1,6 +1,8 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "advice.h"
|
||||
#include "config.h"
|
||||
#include "color.h"
|
||||
#include "gettext.h"
|
||||
#include "help.h"
|
||||
#include "string-list.h"
|
||||
|
||||
|
@ -44,6 +46,7 @@ static struct {
|
|||
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
|
||||
[ADVICE_DETACHED_HEAD] = { "detachedHead", 1 },
|
||||
[ADVICE_SUGGEST_DETACHING_HEAD] = { "suggestDetachingHead", 1 },
|
||||
[ADVICE_DIVERGING] = { "diverging", 1 },
|
||||
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates", 1 },
|
||||
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated", 1 },
|
||||
[ADVICE_IGNORED_HOOK] = { "ignoredHook", 1 },
|
||||
|
@ -217,6 +220,14 @@ void NORETURN die_conclude_merge(void)
|
|||
|
||||
void NORETURN die_ff_impossible(void)
|
||||
{
|
||||
advise_if_enabled(ADVICE_DIVERGING,
|
||||
_("Diverging branches can't be fast-forwarded, you need to either:\n"
|
||||
"\n"
|
||||
"\tgit merge --no-ff\n"
|
||||
"\n"
|
||||
"or:\n"
|
||||
"\n"
|
||||
"\tgit rebase\n"));
|
||||
die(_("Not possible to fast-forward, aborting."));
|
||||
}
|
||||
|
||||
|
|
3
advice.h
3
advice.h
|
@ -1,8 +1,6 @@
|
|||
#ifndef ADVICE_H
|
||||
#define ADVICE_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
||||
struct string_list;
|
||||
|
||||
/*
|
||||
|
@ -21,6 +19,7 @@ struct string_list;
|
|||
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
|
||||
ADVICE_COMMIT_BEFORE_MERGE,
|
||||
ADVICE_DETACHED_HEAD,
|
||||
ADVICE_DIVERGING,
|
||||
ADVICE_SUGGEST_DETACHING_HEAD,
|
||||
ADVICE_FETCH_SHOW_FORCED_UPDATES,
|
||||
ADVICE_GRAFT_FILE_DEPRECATED,
|
||||
|
|
22
alias.c
22
alias.c
|
@ -1,6 +1,9 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "alias.h"
|
||||
#include "alloc.h"
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
#include "strbuf.h"
|
||||
#include "string-list.h"
|
||||
|
||||
struct config_alias_data {
|
||||
|
@ -44,6 +47,23 @@ void list_aliases(struct string_list *list)
|
|||
read_early_config(config_alias_cb, &data);
|
||||
}
|
||||
|
||||
void quote_cmdline(struct strbuf *buf, const char **argv)
|
||||
{
|
||||
for (const char **argp = argv; *argp; argp++) {
|
||||
if (argp != argv)
|
||||
strbuf_addch(buf, ' ');
|
||||
strbuf_addch(buf, '"');
|
||||
for (const char *p = *argp; *p; p++) {
|
||||
const char c = *p;
|
||||
|
||||
if (c == '"' || c =='\\')
|
||||
strbuf_addch(buf, '\\');
|
||||
strbuf_addch(buf, c);
|
||||
}
|
||||
strbuf_addch(buf, '"');
|
||||
}
|
||||
}
|
||||
|
||||
#define SPLIT_CMDLINE_BAD_ENDING 1
|
||||
#define SPLIT_CMDLINE_UNCLOSED_QUOTE 2
|
||||
#define SPLIT_CMDLINE_ARGC_OVERFLOW 3
|
||||
|
|
3
alias.h
3
alias.h
|
@ -1,9 +1,12 @@
|
|||
#ifndef ALIAS_H
|
||||
#define ALIAS_H
|
||||
|
||||
struct strbuf;
|
||||
struct string_list;
|
||||
|
||||
char *alias_lookup(const char *alias);
|
||||
/* Quote argv so buf can be parsed by split_cmdline() */
|
||||
void quote_cmdline(struct strbuf *buf, const char **argv);
|
||||
int split_cmdline(char *cmdline, const char ***argv);
|
||||
/* Takes a negative value returned by split_cmdline */
|
||||
const char *split_cmdline_strerror(int cmdline_errno);
|
||||
|
|
3
alloc.c
3
alloc.c
|
@ -8,11 +8,12 @@
|
|||
* up with maximal alignment because it doesn't know what the object alignment
|
||||
* for the new allocation is.
|
||||
*/
|
||||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "object.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "commit.h"
|
||||
#include "repository.h"
|
||||
#include "tag.h"
|
||||
#include "alloc.h"
|
||||
|
||||
|
|
75
alloc.h
75
alloc.h
|
@ -17,4 +17,79 @@ void *alloc_object_node(struct repository *r);
|
|||
struct alloc_state *allocate_alloc_state(void);
|
||||
void clear_alloc_state(struct alloc_state *s);
|
||||
|
||||
#define alloc_nr(x) (((x)+16)*3/2)
|
||||
|
||||
/**
|
||||
* Dynamically growing an array using realloc() is error prone and boring.
|
||||
*
|
||||
* Define your array with:
|
||||
*
|
||||
* - a pointer (`item`) that points at the array, initialized to `NULL`
|
||||
* (although please name the variable based on its contents, not on its
|
||||
* type);
|
||||
*
|
||||
* - an integer variable (`alloc`) that keeps track of how big the current
|
||||
* allocation is, initialized to `0`;
|
||||
*
|
||||
* - another integer variable (`nr`) to keep track of how many elements the
|
||||
* array currently has, initialized to `0`.
|
||||
*
|
||||
* Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
|
||||
* alloc)`. This ensures that the array can hold at least `n` elements by
|
||||
* calling `realloc(3)` and adjusting `alloc` variable.
|
||||
*
|
||||
* ------------
|
||||
* sometype *item;
|
||||
* size_t nr;
|
||||
* size_t alloc
|
||||
*
|
||||
* for (i = 0; i < nr; i++)
|
||||
* if (we like item[i] already)
|
||||
* return;
|
||||
*
|
||||
* // we did not like any existing one, so add one
|
||||
* ALLOC_GROW(item, nr + 1, alloc);
|
||||
* item[nr++] = value you like;
|
||||
* ------------
|
||||
*
|
||||
* You are responsible for updating the `nr` variable.
|
||||
*
|
||||
* If you need to specify the number of elements to allocate explicitly
|
||||
* then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
|
||||
*
|
||||
* Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
|
||||
* added niceties.
|
||||
*
|
||||
* DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
|
||||
*/
|
||||
#define ALLOC_GROW(x, nr, alloc) \
|
||||
do { \
|
||||
if ((nr) > alloc) { \
|
||||
if (alloc_nr(alloc) < (nr)) \
|
||||
alloc = (nr); \
|
||||
else \
|
||||
alloc = alloc_nr(alloc); \
|
||||
REALLOC_ARRAY(x, alloc); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Similar to ALLOC_GROW but handles updating of the nr value and
|
||||
* zeroing the bytes of the newly-grown array elements.
|
||||
*
|
||||
* DO NOT USE any expression with side-effect for any of the
|
||||
* arguments.
|
||||
*/
|
||||
#define ALLOC_GROW_BY(x, nr, increase, alloc) \
|
||||
do { \
|
||||
if (increase) { \
|
||||
size_t new_nr = nr + (increase); \
|
||||
if (new_nr < nr) \
|
||||
BUG("negative growth in ALLOC_GROW_BY"); \
|
||||
ALLOC_GROW(x, new_nr, alloc); \
|
||||
memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
|
||||
nr = new_nr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
|
39
apply.c
39
apply.c
|
@ -8,20 +8,32 @@
|
|||
*/
|
||||
|
||||
#include "cache.h"
|
||||
#include "abspath.h"
|
||||
#include "alloc.h"
|
||||
#include "base85.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "delta.h"
|
||||
#include "diff.h"
|
||||
#include "dir.h"
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "ll-merge.h"
|
||||
#include "lockfile.h"
|
||||
#include "object-name.h"
|
||||
#include "object-file.h"
|
||||
#include "parse-options.h"
|
||||
#include "quote.h"
|
||||
#include "rerere.h"
|
||||
#include "apply.h"
|
||||
#include "entry.h"
|
||||
#include "setup.h"
|
||||
#include "symlinks.h"
|
||||
#include "ws.h"
|
||||
#include "wrapper.h"
|
||||
|
||||
struct gitdiff_data {
|
||||
struct strbuf *root;
|
||||
|
@ -3201,7 +3213,8 @@ static int apply_binary(struct apply_state *state,
|
|||
unsigned long size;
|
||||
char *result;
|
||||
|
||||
result = read_object_file(&oid, &type, &size);
|
||||
result = repo_read_object_file(the_repository, &oid, &type,
|
||||
&size);
|
||||
if (!result)
|
||||
return error(_("the necessary postimage %s for "
|
||||
"'%s' cannot be read"),
|
||||
|
@ -3264,7 +3277,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
|
|||
unsigned long sz;
|
||||
char *result;
|
||||
|
||||
result = read_object_file(oid, &type, &sz);
|
||||
result = repo_read_object_file(the_repository, oid, &type,
|
||||
&sz);
|
||||
if (!result)
|
||||
return -1;
|
||||
/* XXX read_sha1_file NUL-terminates */
|
||||
|
@ -3492,7 +3506,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
|
|||
|
||||
clear_image(image);
|
||||
|
||||
image->buf = read_object_file(result_id, &type, &size);
|
||||
image->buf = repo_read_object_file(the_repository, result_id, &type,
|
||||
&size);
|
||||
if (!image->buf || type != OBJ_BLOB)
|
||||
die("unable to read blob object %s", oid_to_hex(result_id));
|
||||
image->len = size;
|
||||
|
@ -3610,7 +3625,7 @@ static int try_threeway(struct apply_state *state,
|
|||
/* Preimage the patch was prepared for */
|
||||
if (patch->is_new)
|
||||
write_object_file("", 0, OBJ_BLOB, &pre_oid);
|
||||
else if (get_oid(patch->old_oid_prefix, &pre_oid) ||
|
||||
else if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) ||
|
||||
read_blob_object(&buf, &pre_oid, patch->old_mode))
|
||||
return error(_("repository lacks the necessary blob to perform 3-way merge."));
|
||||
|
||||
|
@ -4127,7 +4142,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
|
|||
else
|
||||
return error(_("sha1 information is lacking or "
|
||||
"useless for submodule %s"), name);
|
||||
} else if (!get_oid_blob(patch->old_oid_prefix, &oid)) {
|
||||
} else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) {
|
||||
; /* ok */
|
||||
} else if (!patch->lines_added && !patch->lines_deleted) {
|
||||
/* mode-only change: update the current */
|
||||
|
@ -4576,7 +4591,7 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch)
|
|||
FILE *rej;
|
||||
char namebuf[PATH_MAX];
|
||||
struct fragment *frag;
|
||||
int cnt = 0;
|
||||
int fd, cnt = 0;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
for (cnt = 0, frag = patch->fragments; frag; frag = frag->next) {
|
||||
|
@ -4616,7 +4631,17 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch)
|
|||
memcpy(namebuf, patch->new_name, cnt);
|
||||
memcpy(namebuf + cnt, ".rej", 5);
|
||||
|
||||
rej = fopen(namebuf, "w");
|
||||
fd = open(namebuf, O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||
if (fd < 0) {
|
||||
if (errno != EEXIST)
|
||||
return error_errno(_("cannot open %s"), namebuf);
|
||||
if (unlink(namebuf))
|
||||
return error_errno(_("cannot unlink '%s'"), namebuf);
|
||||
fd = open(namebuf, O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||
if (fd < 0)
|
||||
return error_errno(_("cannot open %s"), namebuf);
|
||||
}
|
||||
rej = fdopen(fd, "w");
|
||||
if (!rej)
|
||||
return error_errno(_("cannot open %s"), namebuf);
|
||||
|
||||
|
|
2
apply.h
2
apply.h
|
@ -1,7 +1,7 @@
|
|||
#ifndef APPLY_H
|
||||
#define APPLY_H
|
||||
|
||||
#include "hash.h"
|
||||
#include "hash-ll.h"
|
||||
#include "lockfile.h"
|
||||
#include "string-list.h"
|
||||
#include "strmap.h"
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2006 Rene Scharfe
|
||||
*/
|
||||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "alloc.h"
|
||||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
#include "git-zlib.h"
|
||||
#include "hex.h"
|
||||
#include "tar.h"
|
||||
#include "archive.h"
|
||||
#include "object-store.h"
|
||||
#include "streaming.h"
|
||||
#include "run-command.h"
|
||||
#include "write-or-die.h"
|
||||
|
||||
#define RECORDSIZE (512)
|
||||
#define BLOCKSIZE (RECORDSIZE * 20)
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2006 Rene Scharfe
|
||||
*/
|
||||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "config.h"
|
||||
#include "archive.h"
|
||||
#include "gettext.h"
|
||||
#include "git-zlib.h"
|
||||
#include "hex.h"
|
||||
#include "streaming.h"
|
||||
#include "utf8.h"
|
||||
#include "object-store.h"
|
||||
#include "userdiff.h"
|
||||
#include "write-or-die.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "date.h"
|
||||
|
||||
|
|
98
archive.c
98
archive.c
|
@ -1,8 +1,17 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "abspath.h"
|
||||
#include "alloc.h"
|
||||
#include "config.h"
|
||||
#include "convert.h"
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "pretty.h"
|
||||
#include "setup.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
#include "attr.h"
|
||||
#include "archive.h"
|
||||
|
@ -59,7 +68,8 @@ static void format_subst(const struct commit *commit,
|
|||
strbuf_add(&fmt, b + 8, c - b - 8);
|
||||
|
||||
strbuf_add(buf, src, b - src);
|
||||
format_commit_message(commit, fmt.buf, buf, ctx);
|
||||
repo_format_commit_message(the_repository, commit, fmt.buf,
|
||||
buf, ctx);
|
||||
len -= c + 1 - src;
|
||||
src = c + 1;
|
||||
}
|
||||
|
@ -84,7 +94,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
|
|||
(args->tree ? &args->tree->object.oid : NULL), oid);
|
||||
|
||||
path += args->baselen;
|
||||
buffer = read_object_file(oid, type, sizep);
|
||||
buffer = repo_read_object_file(the_repository, oid, type, sizep);
|
||||
if (buffer && S_ISREG(mode)) {
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
size_t size = 0;
|
||||
|
@ -166,6 +176,29 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
|
|||
args->convert = check_attr_export_subst(check);
|
||||
}
|
||||
|
||||
if (args->prefix) {
|
||||
static struct strbuf new_path = STRBUF_INIT;
|
||||
static struct strbuf buf = STRBUF_INIT;
|
||||
const char *rel;
|
||||
|
||||
rel = relative_path(path_without_prefix, args->prefix, &buf);
|
||||
|
||||
/*
|
||||
* We don't add an entry for the current working
|
||||
* directory when we are at the root; skip it also when
|
||||
* we're in a subdirectory or submodule. Skip entries
|
||||
* higher up as well.
|
||||
*/
|
||||
if (!strcmp(rel, "./") || starts_with(rel, "../"))
|
||||
return S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0;
|
||||
|
||||
/* rel can refer to path, so don't edit it in place */
|
||||
strbuf_reset(&new_path);
|
||||
strbuf_add(&new_path, args->base, args->baselen);
|
||||
strbuf_addstr(&new_path, rel);
|
||||
strbuf_swap(&path, &new_path);
|
||||
}
|
||||
|
||||
if (args->verbose)
|
||||
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
|
||||
|
||||
|
@ -401,6 +434,27 @@ static int reject_entry(const struct object_id *oid UNUSED,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int reject_outside(const struct object_id *oid UNUSED,
|
||||
struct strbuf *base, const char *filename,
|
||||
unsigned mode, void *context)
|
||||
{
|
||||
struct archiver_args *args = context;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct strbuf path = STRBUF_INIT;
|
||||
int ret = 0;
|
||||
|
||||
if (S_ISDIR(mode))
|
||||
return READ_TREE_RECURSIVE;
|
||||
|
||||
strbuf_addbuf(&path, base);
|
||||
strbuf_addstr(&path, filename);
|
||||
if (starts_with(relative_path(path.buf, args->prefix, &buf), "../"))
|
||||
ret = -1;
|
||||
strbuf_release(&buf);
|
||||
strbuf_release(&path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int path_exists(struct archiver_args *args, const char *path)
|
||||
{
|
||||
const char *paths[] = { path, NULL };
|
||||
|
@ -408,8 +462,13 @@ static int path_exists(struct archiver_args *args, const char *path)
|
|||
int ret;
|
||||
|
||||
ctx.args = args;
|
||||
parse_pathspec(&ctx.pathspec, 0, 0, "", paths);
|
||||
parse_pathspec(&ctx.pathspec, 0, PATHSPEC_PREFER_CWD,
|
||||
args->prefix, paths);
|
||||
ctx.pathspec.recursive = 1;
|
||||
if (args->prefix && read_tree(args->repo, args->tree, &ctx.pathspec,
|
||||
reject_outside, args))
|
||||
die(_("pathspec '%s' matches files outside the "
|
||||
"current directory"), path);
|
||||
ret = read_tree(args->repo, args->tree,
|
||||
&ctx.pathspec,
|
||||
reject_entry, &ctx);
|
||||
|
@ -425,9 +484,8 @@ static void parse_pathspec_arg(const char **pathspec,
|
|||
* Also if pathspec patterns are dependent, we're in big
|
||||
* trouble as we test each one separately
|
||||
*/
|
||||
parse_pathspec(&ar_args->pathspec, 0,
|
||||
PATHSPEC_PREFER_FULL,
|
||||
"", pathspec);
|
||||
parse_pathspec(&ar_args->pathspec, 0, PATHSPEC_PREFER_CWD,
|
||||
ar_args->prefix, pathspec);
|
||||
ar_args->pathspec.recursive = 1;
|
||||
if (pathspec) {
|
||||
while (*pathspec) {
|
||||
|
@ -439,8 +497,7 @@ static void parse_pathspec_arg(const char **pathspec,
|
|||
}
|
||||
|
||||
static void parse_treeish_arg(const char **argv,
|
||||
struct archiver_args *ar_args, const char *prefix,
|
||||
int remote)
|
||||
struct archiver_args *ar_args, int remote)
|
||||
{
|
||||
const char *name = argv[0];
|
||||
const struct object_id *commit_oid;
|
||||
|
@ -455,13 +512,14 @@ static void parse_treeish_arg(const char **argv,
|
|||
const char *colon = strchrnul(name, ':');
|
||||
int refnamelen = colon - name;
|
||||
|
||||
if (!dwim_ref(name, refnamelen, &oid, &ref, 0))
|
||||
if (!repo_dwim_ref(the_repository, name, refnamelen, &oid, &ref, 0))
|
||||
die(_("no such ref: %.*s"), refnamelen, name);
|
||||
} else {
|
||||
dwim_ref(name, strlen(name), &oid, &ref, 0);
|
||||
repo_dwim_ref(the_repository, name, strlen(name), &oid, &ref,
|
||||
0);
|
||||
}
|
||||
|
||||
if (get_oid(name, &oid))
|
||||
if (repo_get_oid(the_repository, name, &oid))
|
||||
die(_("not a valid object name: %s"), name);
|
||||
|
||||
commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
|
||||
|
@ -479,20 +537,6 @@ static void parse_treeish_arg(const char **argv,
|
|||
if (!tree)
|
||||
die(_("not a tree object: %s"), oid_to_hex(&oid));
|
||||
|
||||
if (prefix) {
|
||||
struct object_id tree_oid;
|
||||
unsigned short mode;
|
||||
int err;
|
||||
|
||||
err = get_tree_entry(ar_args->repo,
|
||||
&tree->object.oid,
|
||||
prefix, &tree_oid,
|
||||
&mode);
|
||||
if (err || !S_ISDIR(mode))
|
||||
die(_("current working directory is untracked"));
|
||||
|
||||
tree = parse_tree_indirect(&tree_oid);
|
||||
}
|
||||
ar_args->refname = ref;
|
||||
ar_args->tree = tree;
|
||||
ar_args->commit_oid = commit_oid;
|
||||
|
@ -710,7 +754,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
|
|||
setup_git_directory();
|
||||
}
|
||||
|
||||
parse_treeish_arg(argv, &args, prefix, remote);
|
||||
parse_treeish_arg(argv, &args, remote);
|
||||
parse_pathspec_arg(argv + 1, &args);
|
||||
|
||||
rc = ar->write_archive(ar, &args);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#ifndef ARCHIVE_H
|
||||
#define ARCHIVE_H
|
||||
|
||||
#include "cache.h"
|
||||
#include "object-name.h"
|
||||
#include "pathspec.h"
|
||||
#include "string-list.h"
|
||||
|
||||
struct repository;
|
||||
struct pretty_print_context;
|
||||
|
|
5
attr.c
5
attr.c
|
@ -7,15 +7,20 @@
|
|||
*/
|
||||
|
||||
#include "cache.h"
|
||||
#include "alloc.h"
|
||||
#include "config.h"
|
||||
#include "environment.h"
|
||||
#include "exec-cmd.h"
|
||||
#include "attr.h"
|
||||
#include "dir.h"
|
||||
#include "gettext.h"
|
||||
#include "utf8.h"
|
||||
#include "quote.h"
|
||||
#include "revision.h"
|
||||
#include "object-store.h"
|
||||
#include "setup.h"
|
||||
#include "thread-utils.h"
|
||||
#include "tree-walk.h"
|
||||
|
||||
const char git_attr__true[] = "(builtin)true";
|
||||
const char git_attr__false[] = "\0(builtin)false";
|
||||
|
|
4
banned.h
4
banned.h
|
@ -18,6 +18,10 @@
|
|||
#define strncpy(x,y,n) BANNED(strncpy)
|
||||
#undef strncat
|
||||
#define strncat(x,y,n) BANNED(strncat)
|
||||
#undef strtok
|
||||
#define strtok(x,y) BANNED(strtok)
|
||||
#undef strtok_r
|
||||
#define strtok_r(x,y,z) BANNED(strtok_r)
|
||||
|
||||
#undef sprintf
|
||||
#undef vsprintf
|
||||
|
|
3
base85.c
3
base85.c
|
@ -1,4 +1,5 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "base85.h"
|
||||
|
||||
#undef DEBUG_85
|
||||
|
||||
|
|
7
base85.h
Normal file
7
base85.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef BASE85_H
|
||||
#define BASE85_H
|
||||
|
||||
int decode_85(char *dst, const char *line, int linelen);
|
||||
void encode_85(char *buf, const unsigned char *data, int bytes);
|
||||
|
||||
#endif /* BASE85_H */
|
17
bisect.c
17
bisect.c
|
@ -1,7 +1,10 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "config.h"
|
||||
#include "commit.h"
|
||||
#include "diff.h"
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "revision.h"
|
||||
#include "refs.h"
|
||||
#include "list-objects.h"
|
||||
|
@ -14,6 +17,7 @@
|
|||
#include "strvec.h"
|
||||
#include "commit-slab.h"
|
||||
#include "commit-reach.h"
|
||||
#include "object-name.h"
|
||||
#include "object-store.h"
|
||||
#include "dir.h"
|
||||
|
||||
|
@ -148,8 +152,9 @@ static void show_list(const char *debug, int counted, int nr,
|
|||
unsigned commit_flags = commit->object.flags;
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
char *buf = read_object_file(&commit->object.oid, &type,
|
||||
&size);
|
||||
char *buf = repo_read_object_file(the_repository,
|
||||
&commit->object.oid, &type,
|
||||
&size);
|
||||
const char *subject_start;
|
||||
int subject_len;
|
||||
|
||||
|
@ -751,7 +756,8 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
|
|||
}
|
||||
|
||||
commit = lookup_commit_reference(the_repository, bisect_rev);
|
||||
format_commit_message(commit, "[%H] %s%n", &commit_msg, &pp);
|
||||
repo_format_commit_message(the_repository, commit, "[%H] %s%n",
|
||||
&commit_msg, &pp);
|
||||
fputs(commit_msg.buf, stdout);
|
||||
strbuf_release(&commit_msg);
|
||||
|
||||
|
@ -846,7 +852,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
|
|||
enum bisect_error res = BISECT_OK;
|
||||
struct commit_list *result;
|
||||
|
||||
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
|
||||
result = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,
|
||||
rev + 1);
|
||||
|
||||
for (; result; result = result->next) {
|
||||
const struct object_id *mb = &result->item->object.oid;
|
||||
|
|
68
blame.c
68
blame.c
|
@ -3,9 +3,14 @@
|
|||
#include "object-store.h"
|
||||
#include "cache-tree.h"
|
||||
#include "mergesort.h"
|
||||
#include "convert.h"
|
||||
#include "diff.h"
|
||||
#include "diffcore.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "setup.h"
|
||||
#include "tag.h"
|
||||
#include "trace2.h"
|
||||
#include "blame.h"
|
||||
#include "alloc.h"
|
||||
#include "commit-slab.h"
|
||||
|
@ -176,12 +181,12 @@ static void set_commit_buffer_from_strbuf(struct repository *r,
|
|||
static struct commit *fake_working_tree_commit(struct repository *r,
|
||||
struct diff_options *opt,
|
||||
const char *path,
|
||||
const char *contents_from)
|
||||
const char *contents_from,
|
||||
struct object_id *oid)
|
||||
{
|
||||
struct commit *commit;
|
||||
struct blame_origin *origin;
|
||||
struct commit_list **parent_tail, *parent;
|
||||
struct object_id head_oid;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
const char *ident;
|
||||
time_t now;
|
||||
|
@ -197,17 +202,18 @@ static struct commit *fake_working_tree_commit(struct repository *r,
|
|||
commit->date = now;
|
||||
parent_tail = &commit->parents;
|
||||
|
||||
if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
|
||||
die("no such ref: HEAD");
|
||||
|
||||
parent_tail = append_parent(r, parent_tail, &head_oid);
|
||||
parent_tail = append_parent(r, parent_tail, oid);
|
||||
append_merge_parents(r, parent_tail);
|
||||
verify_working_tree_path(r, commit, path);
|
||||
|
||||
origin = make_origin(commit, path);
|
||||
|
||||
ident = fmt_ident("Not Committed Yet", "not.committed.yet",
|
||||
WANT_BLANK_IDENT, NULL, 0);
|
||||
if (contents_from)
|
||||
ident = fmt_ident("External file (--contents)", "external.file",
|
||||
WANT_BLANK_IDENT, NULL, 0);
|
||||
else
|
||||
ident = fmt_ident("Not Committed Yet", "not.committed.yet",
|
||||
WANT_BLANK_IDENT, NULL, 0);
|
||||
strbuf_addstr(&msg, "tree 0000000000000000000000000000000000000000\n");
|
||||
for (parent = commit->parents; parent; parent = parent->next)
|
||||
strbuf_addf(&msg, "parent %s\n",
|
||||
|
@ -1028,8 +1034,9 @@ static void fill_origin_blob(struct diff_options *opt,
|
|||
&o->blob_oid, 1, &file->ptr, &file_size))
|
||||
;
|
||||
else
|
||||
file->ptr = read_object_file(&o->blob_oid, &type,
|
||||
&file_size);
|
||||
file->ptr = repo_read_object_file(the_repository,
|
||||
&o->blob_oid, &type,
|
||||
&file_size);
|
||||
file->size = file_size;
|
||||
|
||||
if (!file->ptr)
|
||||
|
@ -2429,7 +2436,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
|
||||
if (sg_origin[i])
|
||||
continue;
|
||||
if (parse_commit(p))
|
||||
if (repo_parse_commit(the_repository, p))
|
||||
continue;
|
||||
porigin = find(sb->repo, p, origin, sb->bloom_data);
|
||||
if (!porigin)
|
||||
|
@ -2592,7 +2599,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt)
|
|||
* so hold onto it in the meantime.
|
||||
*/
|
||||
blame_origin_incref(suspect);
|
||||
parse_commit(commit);
|
||||
repo_parse_commit(the_repository, commit);
|
||||
if (sb->reverse ||
|
||||
(!(commit->object.flags & UNINTERESTING) &&
|
||||
!(revs->max_age != -1 && commit->date < revs->max_age)))
|
||||
|
@ -2771,22 +2778,37 @@ void setup_scoreboard(struct blame_scoreboard *sb,
|
|||
sb->commits.compare = compare_commits_by_reverse_commit_date;
|
||||
}
|
||||
|
||||
if (sb->final && sb->contents_from)
|
||||
die(_("cannot use --contents with final commit object name"));
|
||||
|
||||
if (sb->reverse && sb->revs->first_parent_only)
|
||||
sb->revs->children.name = NULL;
|
||||
|
||||
if (!sb->final) {
|
||||
if (sb->contents_from || !sb->final) {
|
||||
struct object_id head_oid, *parent_oid;
|
||||
|
||||
/*
|
||||
* "--not A B -- path" without anything positive;
|
||||
* do not default to HEAD, but use the working tree
|
||||
* or "--contents".
|
||||
* Build a fake commit at the top of the history, when
|
||||
* (1) "git blame [^A] --path", i.e. with no positive end
|
||||
* of the history range, in which case we build such
|
||||
* a fake commit on top of the HEAD to blame in-tree
|
||||
* modifications.
|
||||
* (2) "git blame --contents=file [A] -- path", with or
|
||||
* without positive end of the history range but with
|
||||
* --contents, in which case we pretend that there is
|
||||
* a fake commit on top of the positive end (defaulting to
|
||||
* HEAD) that has the given contents in the path.
|
||||
*/
|
||||
if (sb->final) {
|
||||
parent_oid = &sb->final->object.oid;
|
||||
} else {
|
||||
if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
|
||||
die("no such ref: HEAD");
|
||||
parent_oid = &head_oid;
|
||||
}
|
||||
|
||||
setup_work_tree();
|
||||
sb->final = fake_working_tree_commit(sb->repo,
|
||||
&sb->revs->diffopt,
|
||||
sb->path, sb->contents_from);
|
||||
sb->path, sb->contents_from,
|
||||
parent_oid);
|
||||
add_pending_object(sb->revs, &(sb->final->object), ":");
|
||||
}
|
||||
|
||||
|
@ -2838,8 +2860,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
|
|||
&sb->final_buf_size))
|
||||
;
|
||||
else
|
||||
sb->final_buf = read_object_file(&o->blob_oid, &type,
|
||||
&sb->final_buf_size);
|
||||
sb->final_buf = repo_read_object_file(the_repository,
|
||||
&o->blob_oid,
|
||||
&type,
|
||||
&sb->final_buf_size);
|
||||
|
||||
if (!sb->final_buf)
|
||||
die(_("cannot read blob %s for path %s"),
|
||||
|
|
1
blame.h
1
blame.h
|
@ -1,7 +1,6 @@
|
|||
#ifndef BLAME_H
|
||||
#define BLAME_H
|
||||
|
||||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "revision.h"
|
||||
|
|
2
blob.c
2
blob.c
|
@ -1,4 +1,4 @@
|
|||
#include "cache.h"
|
||||
#include "git-compat-util.h"
|
||||
#include "blob.h"
|
||||
#include "repository.h"
|
||||
#include "alloc.h"
|
||||
|
|
1
bloom.c
1
bloom.c
|
@ -6,6 +6,7 @@
|
|||
#include "hashmap.h"
|
||||
#include "commit-graph.h"
|
||||
#include "commit.h"
|
||||
#include "commit-slab.h"
|
||||
|
||||
define_commit_slab(bloom_filter_slab, struct bloom_filter);
|
||||
|
||||
|
|
55
branch.c
55
branch.c
|
@ -1,10 +1,15 @@
|
|||
#include "git-compat-util.h"
|
||||
#include "cache.h"
|
||||
#include "advice.h"
|
||||
#include "config.h"
|
||||
#include "branch.h"
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "object-name.h"
|
||||
#include "refs.h"
|
||||
#include "refspec.h"
|
||||
#include "remote.h"
|
||||
#include "repository.h"
|
||||
#include "sequencer.h"
|
||||
#include "commit.h"
|
||||
#include "worktree.h"
|
||||
|
@ -531,7 +536,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
|
|||
explicit_tracking = 1;
|
||||
|
||||
real_ref = NULL;
|
||||
if (get_oid_mb(start_name, &oid)) {
|
||||
if (repo_get_oid_mb(r, start_name, &oid)) {
|
||||
if (explicit_tracking) {
|
||||
int code = die_message(_(upstream_missing), start_name);
|
||||
advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,
|
||||
|
@ -541,7 +546,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
|
|||
die(_("not a valid object name: '%s'"), start_name);
|
||||
}
|
||||
|
||||
switch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {
|
||||
switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,
|
||||
&real_ref, 0)) {
|
||||
case 0:
|
||||
/* Not branching from any existing branch */
|
||||
if (explicit_tracking)
|
||||
|
@ -772,7 +778,7 @@ void create_branches_recursively(struct repository *r, const char *name,
|
|||
name);
|
||||
}
|
||||
|
||||
create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,
|
||||
create_branch(r, name, start_commitish, force, 0, reflog, quiet,
|
||||
BRANCH_TRACK_NEVER, dry_run);
|
||||
if (dry_run)
|
||||
return;
|
||||
|
@ -820,40 +826,17 @@ void remove_branch_state(struct repository *r, int verbose)
|
|||
void die_if_checked_out(const char *branch, int ignore_current_worktree)
|
||||
{
|
||||
struct worktree **worktrees = get_worktrees();
|
||||
const struct worktree *wt;
|
||||
|
||||
wt = find_shared_symref(worktrees, "HEAD", branch);
|
||||
if (wt && (!ignore_current_worktree || !wt->is_current)) {
|
||||
skip_prefix(branch, "refs/heads/", &branch);
|
||||
die(_("'%s' is already checked out at '%s'"), branch, wt->path);
|
||||
for (int i = 0; worktrees[i]; i++) {
|
||||
if (worktrees[i]->is_current && ignore_current_worktree)
|
||||
continue;
|
||||
|
||||
if (is_shared_symref(worktrees[i], "HEAD", branch)) {
|
||||
skip_prefix(branch, "refs/heads/", &branch);
|
||||
die(_("'%s' is already checked out at '%s'"),
|
||||
branch, worktrees[i]->path);
|
||||
}
|
||||
}
|
||||
|
||||
free_worktrees(worktrees);
|
||||
}
|
||||
|
||||
int replace_each_worktree_head_symref(const char *oldref, const char *newref,
|
||||
const char *logmsg)
|
||||
{
|
||||
int ret = 0;
|
||||
struct worktree **worktrees = get_worktrees();
|
||||
int i;
|
||||
|
||||
for (i = 0; worktrees[i]; i++) {
|
||||
struct ref_store *refs;
|
||||
|
||||
if (worktrees[i]->is_detached)
|
||||
continue;
|
||||
if (!worktrees[i]->head_ref)
|
||||
continue;
|
||||
if (strcmp(oldref, worktrees[i]->head_ref))
|
||||
continue;
|
||||
|
||||
refs = get_worktree_ref_store(worktrees[i]);
|
||||
if (refs_create_symref(refs, "HEAD", newref, logmsg))
|
||||
ret = error(_("HEAD of working tree %s is not updated"),
|
||||
worktrees[i]->path);
|
||||
}
|
||||
|
||||
free_worktrees(worktrees);
|
||||
return ret;
|
||||
}
|
||||
|
|
8
branch.h
8
branch.h
|
@ -155,12 +155,4 @@ int read_branch_desc(struct strbuf *, const char *branch_name);
|
|||
*/
|
||||
void die_if_checked_out(const char *branch, int ignore_current_worktree);
|
||||
|
||||
/*
|
||||
* Update all per-worktree HEADs pointing at the old ref to point the new ref.
|
||||
* This will be used when renaming a branch. Returns 0 if successful, non-zero
|
||||
* otherwise.
|
||||
*/
|
||||
int replace_each_worktree_head_symref(const char *oldref, const char *newref,
|
||||
const char *logmsg);
|
||||
|
||||
#endif
|
||||
|
|
10
builtin.h
10
builtin.h
|
@ -107,6 +107,16 @@ void setup_auto_pager(const char *cmd, int def);
|
|||
|
||||
int is_builtin(const char *s);
|
||||
|
||||
/*
|
||||
* Builtins which do not use RUN_SETUP should never see
|
||||
* a prefix that is not empty; use this to protect downstream
|
||||
* code which is not prepared to call prefix_filename(), etc.
|
||||
*/
|
||||
#define BUG_ON_NON_EMPTY_PREFIX(prefix) do { \
|
||||
if ((prefix)) \
|
||||
BUG("unexpected prefix in builtin: %s", (prefix)); \
|
||||
} while (0)
|
||||
|
||||
int cmd_add(int argc, const char **argv, const char *prefix);
|
||||
int cmd_am(int argc, const char **argv, const char *prefix);
|
||||
int cmd_annotate(int argc, const char **argv, const char *prefix);
|
||||
|
|
|
@ -5,10 +5,13 @@
|
|||
*/
|
||||
#define USE_THE_INDEX_VARIABLE
|
||||
#include "cache.h"
|
||||
#include "advice.h"
|
||||
#include "config.h"
|
||||
#include "builtin.h"
|
||||
#include "lockfile.h"
|
||||
#include "editor.h"
|
||||
#include "dir.h"
|
||||
#include "gettext.h"
|
||||
#include "pathspec.h"
|
||||
#include "exec-cmd.h"
|
||||
#include "cache-tree.h"
|
||||
|
|
45
builtin/am.c
45
builtin/am.c
|
@ -5,9 +5,15 @@
|
|||
*/
|
||||
#define USE_THE_INDEX_VARIABLE
|
||||
#include "cache.h"
|
||||
#include "abspath.h"
|
||||
#include "advice.h"
|
||||
#include "config.h"
|
||||
#include "builtin.h"
|
||||
#include "editor.h"
|
||||
#include "environment.h"
|
||||
#include "exec-cmd.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "parse-options.h"
|
||||
#include "dir.h"
|
||||
#include "run-command.h"
|
||||
|
@ -22,6 +28,7 @@
|
|||
#include "diffcore.h"
|
||||
#include "unpack-trees.h"
|
||||
#include "branch.h"
|
||||
#include "object-name.h"
|
||||
#include "sequencer.h"
|
||||
#include "revision.h"
|
||||
#include "merge-recursive.h"
|
||||
|
@ -33,8 +40,10 @@
|
|||
#include "apply.h"
|
||||
#include "string-list.h"
|
||||
#include "packfile.h"
|
||||
#include "pager.h"
|
||||
#include "repository.h"
|
||||
#include "pretty.h"
|
||||
#include "wrapper.h"
|
||||
|
||||
/**
|
||||
* Returns the length of the first line of msg.
|
||||
|
@ -1066,7 +1075,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
|
|||
else
|
||||
write_state_text(state, "applying", "");
|
||||
|
||||
if (!get_oid("HEAD", &curr_head)) {
|
||||
if (!repo_get_oid(the_repository, "HEAD", &curr_head)) {
|
||||
write_state_text(state, "abort-safety", oid_to_hex(&curr_head));
|
||||
if (!state->rebasing)
|
||||
update_ref("am", "ORIG_HEAD", &curr_head, NULL, 0,
|
||||
|
@ -1109,7 +1118,7 @@ static void am_next(struct am_state *state)
|
|||
unlink(am_path(state, "original-commit"));
|
||||
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
|
||||
|
||||
if (!get_oid("HEAD", &head))
|
||||
if (!repo_get_oid(the_repository, "HEAD", &head))
|
||||
write_state_text(state, "abort-safety", oid_to_hex(&head));
|
||||
else
|
||||
write_state_text(state, "abort-safety", "");
|
||||
|
@ -1329,7 +1338,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
|
|||
size_t ident_len;
|
||||
struct ident_split id;
|
||||
|
||||
buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
|
||||
buffer = repo_logmsg_reencode(the_repository, commit, NULL,
|
||||
get_commit_output_encoding());
|
||||
|
||||
ident_line = find_commit_header(buffer, "author", &ident_len);
|
||||
if (!ident_line)
|
||||
|
@ -1361,7 +1371,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
|
|||
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
|
||||
state->msg = xstrdup(msg + 2);
|
||||
state->msg_len = strlen(state->msg);
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1402,9 +1412,9 @@ static void write_index_patch(const struct am_state *state)
|
|||
struct rev_info rev_info;
|
||||
FILE *fp;
|
||||
|
||||
if (!get_oid("HEAD", &head)) {
|
||||
if (!repo_get_oid(the_repository, "HEAD", &head)) {
|
||||
struct commit *commit = lookup_commit_or_die(&head, "HEAD");
|
||||
tree = get_commit_tree(commit);
|
||||
tree = repo_get_commit_tree(the_repository, commit);
|
||||
} else
|
||||
tree = lookup_tree(the_repository,
|
||||
the_repository->hash_algo->empty_tree);
|
||||
|
@ -1556,7 +1566,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
|
|||
struct commit *result;
|
||||
char *their_tree_name;
|
||||
|
||||
if (get_oid("HEAD", &our_tree) < 0)
|
||||
if (repo_get_oid(the_repository, "HEAD", &our_tree) < 0)
|
||||
oidcpy(&our_tree, the_hash_algo->empty_tree);
|
||||
|
||||
if (build_fake_ancestor(state, index_path))
|
||||
|
@ -1646,7 +1656,7 @@ static void do_commit(const struct am_state *state)
|
|||
if (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL))
|
||||
die(_("git write-tree failed to write a tree"));
|
||||
|
||||
if (!get_oid_commit("HEAD", &parent)) {
|
||||
if (!repo_get_oid_commit(the_repository, "HEAD", &parent)) {
|
||||
old_oid = &parent;
|
||||
commit_list_insert(lookup_commit(the_repository, &parent),
|
||||
&parents);
|
||||
|
@ -2088,7 +2098,7 @@ static void am_skip(struct am_state *state)
|
|||
|
||||
am_rerere_clear();
|
||||
|
||||
if (get_oid("HEAD", &head))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head))
|
||||
oidcpy(&head, the_hash_algo->empty_tree);
|
||||
|
||||
if (clean_index(&head, &head))
|
||||
|
@ -2130,7 +2140,7 @@ static int safe_to_abort(const struct am_state *state)
|
|||
oidclr(&abort_safety);
|
||||
strbuf_release(&sb);
|
||||
|
||||
if (get_oid("HEAD", &head))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head))
|
||||
oidclr(&head);
|
||||
|
||||
if (oideq(&head, &abort_safety))
|
||||
|
@ -2163,7 +2173,7 @@ static void am_abort(struct am_state *state)
|
|||
if (!has_curr_head)
|
||||
oidcpy(&curr_head, the_hash_algo->empty_tree);
|
||||
|
||||
has_orig_head = !get_oid("ORIG_HEAD", &orig_head);
|
||||
has_orig_head = !repo_get_oid(the_repository, "ORIG_HEAD", &orig_head);
|
||||
if (!has_orig_head)
|
||||
oidcpy(&orig_head, the_hash_algo->empty_tree);
|
||||
|
||||
|
@ -2300,17 +2310,6 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int git_am_config(const char *k, const char *v, void *cb UNUSED)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = git_gpg_config(k, v, NULL);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
return git_default_config(k, v, NULL);
|
||||
}
|
||||
|
||||
int cmd_am(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct am_state state;
|
||||
|
@ -2434,7 +2433,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
|
|||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||
usage_with_options(usage, options);
|
||||
|
||||
git_config(git_am_config, NULL);
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
am_state_init(&state);
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "cache.h"
|
||||
#include "builtin.h"
|
||||
#include "gettext.h"
|
||||
#include "parse-options.h"
|
||||
#include "repository.h"
|
||||
#include "apply.h"
|
||||
|
||||
static const char * const apply_usage[] = {
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#include "cache.h"
|
||||
#include "builtin.h"
|
||||
#include "archive.h"
|
||||
#include "gettext.h"
|
||||
#include "transport.h"
|
||||
#include "parse-options.h"
|
||||
#include "pkt-line.h"
|
||||
#include "repository.h"
|
||||
#include "sideband.h"
|
||||
|
||||
static void create_output_file(const char *output_file)
|
||||
|
@ -81,7 +83,7 @@ static int run_remote_archiver(int argc, const char **argv,
|
|||
int cmd_archive(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
const char *exec = "git-upload-archive";
|
||||
const char *output = NULL;
|
||||
char *output = NULL;
|
||||
const char *remote = NULL;
|
||||
struct option local_opts[] = {
|
||||
OPT_FILENAME('o', "output", &output,
|
||||
|
@ -106,5 +108,6 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
|
|||
|
||||
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
||||
|
||||
UNLEAK(output);
|
||||
return write_archive(argc, argv, prefix, the_repository, output, 0);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue