Merge branch 'sb/submodule-path-misc-bugs' into sb/submodule-init

"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

Any further comments?  Otherwise will merge to 'next'.

* sb/submodule-path-misc-bugs: (600 commits)
  t7407: make expectation as clear as possible
  submodule update: test recursive path reporting from subdirectory
  submodule update: align reporting path for custom command execution
  submodule status: correct path handling in recursive submodules
  submodule update --init: correct path handling in recursive submodules
  submodule foreach: correct path display in recursive submodules
  Git 2.8
  Documentation: fix git-p4 AsciiDoc formatting
  mingw: skip some tests in t9115 due to file name issues
  t1300: fix the new --show-origin tests on Windows
  t1300-repo-config: make it resilient to being run via 'sh -x'
  config --show-origin: report paths with forward slashes
  submodule: fix regression for deinit without submodules
  l10n: pt_PT: Update and add new translations
  l10n: ca.po: update translation
  Git 2.8-rc4
  Documentation: fix broken linkgit to git-config
  Documentation: use ASCII quotation marks in git-p4
  Revert "config.mak.uname: use clang for Mac OS X 10.6"
  git-compat-util: st_add4: work around gcc 4.2.x compiler crash
  ...
This commit is contained in:
Junio C Hamano 2016-04-14 12:47:44 -07:00
commit ee30f17805
461 changed files with 55195 additions and 26723 deletions

1
.gitignore vendored
View File

@ -187,6 +187,7 @@
/test-dump-cache-tree
/test-dump-split-index
/test-dump-untracked-cache
/test-fake-ssh
/test-scrap-cache-tree
/test-genrandom
/test-hashmap

View File

@ -1,5 +1,11 @@
language: c
sudo: false
cache:
directories:
- $HOME/travis-cache
os:
- linux
- osx
@ -15,12 +21,12 @@ addons:
env:
global:
- DEVELOPER=1
- P4_VERSION="15.2"
- GIT_LFS_VERSION="1.1.0"
- DEFAULT_TEST_TARGET=prove
- GIT_PROVE_OPTS="--timer --jobs 3"
- GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
- GIT_TEST_OPTS="--verbose --tee"
- CFLAGS="-g -O2 -Wall -Werror"
- GIT_TEST_CLONE_2GB=YesPlease
# t9810 occasionally fails on Travis CI OS X
# t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X
@ -67,6 +73,8 @@ before_install:
p4 -V | grep Rev.;
echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)";
git-lfs version;
mkdir -p $HOME/travis-cache;
ln -s $HOME/travis-cache/.prove t/.prove;
before_script: make --jobs=2

View File

@ -171,6 +171,11 @@ For C programs:
- We try to keep to at most 80 characters per line.
- As a Git developer we assume you have a reasonably modern compiler
and we recommend you to enable the DEVELOPER makefile knob to
ensure your patch is clear of all compiler warnings we care about,
by e.g. "echo DEVELOPER=1 >>config.mak".
- We try to support a wide range of C compilers to compile Git with,
including old ones. That means that you should not use C99
initializers, even if a lot of compilers grok it.

View File

@ -0,0 +1,11 @@
Git v2.4.11 Release Notes
=========================
Fixes since v2.4.10
-------------------
* Bugfix patches were backported from the 'master' front to plug heap
corruption holes, to catch integer overflow in the computation of
pathname lengths, and to get rid of the name_path API. Both of
these would have resulted in writing over an under-allocated buffer
when formulating pathnames while tree traversal.

View File

@ -0,0 +1,11 @@
Git v2.5.5 Release Notes
========================
Fixes since v2.5.4
------------------
* Bugfix patches were backported from the 'master' front to plug heap
corruption holes, to catch integer overflow in the computation of
pathname lengths, and to get rid of the name_path API. Both of
these would have resulted in writing over an under-allocated buffer
when formulating pathnames while tree traversal.

View File

@ -21,5 +21,38 @@ Fixes since v2.6.4
NULL. This gives a compiler an excuse to declare that tree will
never be NULL and apply a wrong optimization. Avoid it.
* The helper used to iterate over loose object directories to prune
stale objects did not closedir() immediately when it is done with a
directory--a callback such as the one used for "git prune" may want
to do rmdir(), but it would fail on open directory on platforms
such as WinXP.
* "git p4" used to import Perforce CLs that touch only paths outside
the client spec as empty commits. It has been corrected to ignore
them instead, with a new configuration git-p4.keepEmptyCommits as a
backward compatibility knob.
* The exit code of git-fsck did not reflect some types of errors
found in packed objects, which has been corrected.
* The completion script (in contrib/) used to list "git column"
(which is not an end-user facing command) as one of the choices
* Improve error reporting when SMTP TLS fails.
* When getpwuid() on the system returned NULL (e.g. the user is not
in the /etc/passwd file or other uid-to-name mappings), the
codepath to find who the user is to record it in the reflog barfed
and died. Loosen the check in this codepath, which already accepts
questionable ident string (e.g. host part of the e-mail address is
obviously bogus), and in general when we operate fmt_ident() function
in non-strict mode.
* "git symbolic-ref" forgot to report a failure with its exit status.
* History traversal with "git log --source" that starts with an
annotated tag failed to report the tag as "source", due to an
old regression in the command line parser back in v2.2 days.
Also contains typofixes, documentation updates and trivial code
clean-ups.

View File

@ -0,0 +1,11 @@
Git v2.6.6 Release Notes
========================
Fixes since v2.6.5
------------------
* Bugfix patches were backported from the 'master' front to plug heap
corruption holes, to catch integer overflow in the computation of
pathname lengths, and to get rid of the name_path API. Both of
these would have resulted in writing over an under-allocated buffer
when formulating pathnames while tree traversal.

View File

@ -6,6 +6,10 @@ Updates since v2.6
UI, Workflows & Features
* The appearance of "gitk", particularly on high DPI monitors, have
been improved. "gitk" also comes with an undated translation for
Swedish and Japanese.
* "git remote" learned "get-url" subcommand to show the URL for a
given remote name used for fetching and pushing.
@ -22,7 +26,7 @@ UI, Workflows & Features
* Users who are too busy to type three extra keystrokes to ask for
"git stash show -p" can now set stash.showPatch configuration
varible to true to always see the actual patch, not just the list
variable to true to always see the actual patch, not just the list
of paths affected with feel for the extent of damage via diffstat.
* "quiltimport" allows to specify the series file by honoring the
@ -65,7 +69,7 @@ UI, Workflows & Features
a superset of "--no-progress". Extend the command to support the
usual "--[no-]progress".
* The semantics of tranfer.hideRefs configuration variable have been
* The semantics of transfer.hideRefs configuration variable have been
extended to work better with the ref "namespace" feature that lets
you throw unrelated bunches of repositories in a single physical
repository and virtually serve them as separate ones.
@ -79,6 +83,12 @@ UI, Workflows & Features
* The credential-cache daemon can be told to ignore SIGHUP to work
around issue when running Git from inside emacs.
* "git push" learned new configuration for doing "--recurse-submodules"
on each push.
* "format-patch" has learned a new option to zero-out the commit
object name on the mbox "From " line.
Performance, Internal Implementation, Development Support etc.
@ -100,7 +110,6 @@ Performance, Internal Implementation, Development Support etc.
* The debugging infrastructure for pkt-line based communication has
been improved to mark the side-band communication specifically.
(merge fd89433 jk/async-pkt-line later to maint).
* Update "git branch" that list existing branches, using the
ref-filter API that is shared with "git tag" and "git
@ -162,6 +171,9 @@ Performance, Internal Implementation, Development Support etc.
git/git (including build-status for pull requests that people
open).
* The write(2) emulation for Windows learned to set errno to EPIPE
when necessary.
Also contains various documentation updates and code clean-ups.
@ -356,12 +368,47 @@ notes for details).
* A build without NO_IPv6 used to use gethostbyname() when guessing
user's hostname, instead of getaddrinfo() that is used in other
codepaths in such a build.
(merge 00bce77 ep/ident-with-getaddrinfo later to maint).
* The exit code of git-fsck didnot reflect some types of errors found
in packed objects, which has been corrected.
(merge 8c24d83 dt/fsck-verify-pack-error later to maint).
* The exit code of git-fsck did not reflect some types of errors
found in packed objects, which has been corrected.
* The helper used to iterate over loose object directories to prune
stale objects did not closedir() immediately when it is done with a
directory--a callback such as the one used for "git prune" may want
to do rmdir(), but it would fail on open directory on platforms
such as WinXP.
* "git p4" used to import Perforce CLs that touch only paths outside
the client spec as empty commits. It has been corrected to ignore
them instead, with a new configuration git-p4.keepEmptyCommits as a
backward compatibility knob.
* The completion script (in contrib/) used to list "git column"
(which is not an end-user facing command) as one of the choices
(merge 160fcdb sg/completion-no-column later to maint).
* The error reporting from "git send-email", when SMTP TLS fails, has
been improved.
(merge 9d60524 jk/send-email-ssl-errors later to maint).
* When getpwuid() on the system returned NULL (e.g. the user is not
in the /etc/passwd file or other uid-to-name mappings), the
codepath to find who the user is to record it in the reflog barfed
and died. Loosen the check in this codepath, which already accepts
questionable ident string (e.g. host part of the e-mail address is
obviously bogus), and in general when we operate fmt_ident() function
in non-strict mode.
(merge 92bcbb9 jk/ident-loosen-getpwuid later to maint).
* "git symbolic-ref" forgot to report a failure with its exit status.
(merge f91b273 jk/symbolic-ref-maint later to maint).
* History traversal with "git log --source" that starts with an
annotated tag failed to report the tag as "source", due to an
old regression in the command line parser back in v2.2 days.
(merge 728350b jk/pending-keep-tag-name later to maint).
* "git p4" when interacting with multiple depots at the same time
used to incorrectly drop changes.
* Code clean-up, minor fixes etc.
(merge 15ed07d jc/rerere later to maint).
(merge 147875f sb/submodule-config-parse later to maint).

View File

@ -0,0 +1,87 @@
Git v2.7.1 Release Notes
========================
Fixes since v2.7
----------------
* An earlier change in 2.5.x-era broke users' hooks and aliases by
exporting GIT_WORK_TREE to point at the root of the working tree,
interfering when they tried to use a different working tree without
setting GIT_WORK_TREE environment themselves.
* The "exclude_list" structure has the usual "alloc, nr" pair of
fields to be used by ALLOC_GROW(), but clear_exclude_list() forgot
to reset 'alloc' to 0 when it cleared 'nr' to discard the managed
array.
* "git send-email" was confused by escaped quotes stored in the alias
files saved by "mutt", which has been corrected.
* A few unportable C construct have been spotted by clang compiler
and have been fixed.
* The documentation has been updated to hint the connection between
the '--signoff' option and DCO.
* "git reflog" incorrectly assumed that all objects that used to be
at the tip of a ref must be commits, which caused it to segfault.
* The ignore mechanism saw a few regressions around untracked file
listing and sparse checkout selection areas in 2.7.0; the change
that is responsible for the regression has been reverted.
* Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR
(e.g. COMMIT_EDITMSG) that is meant to be left after the command is
done. This however did not work well if the repository is set to
be shared with core.sharedRepository and the umask of the previous
user is tighter. They have been made to work better by calling
unlink(2) and retrying after fopen(3) fails with EPERM.
* Asking gitweb for a nonexistent commit left a warning in the server
log.
* "git rebase", unlike all other callers of "gc --auto", did not
ignore the exit code from "gc --auto".
* Many codepaths that run "gc --auto" before exiting kept packfiles
mapped and left the file descriptors to them open, which was not
friendly to systems that cannot remove files that are open. They
now close the packs before doing so.
* A recent optimization to filter-branch in v2.7.0 introduced a
regression when --prune-empty filter is used, which has been
corrected.
* The description for SANITY prerequisite the test suite uses has
been clarified both in the comment and in the implementation.
* "git tag" started listing a tag "foo" as "tags/foo" when a branch
named "foo" exists in the same repository; remove this unnecessary
disambiguation, which is a regression introduced in v2.7.0.
* The way "git svn" uses auth parameter was broken by Subversion
1.9.0 and later.
* The "split" subcommand of "git subtree" (in contrib/) incorrectly
skipped merges when it shouldn't, which was corrected.
* A few options of "git diff" did not work well when the command was
run from a subdirectory.
* dirname() emulation has been added, as Msys2 lacks it.
* The underlying machinery used by "ls-files -o" and other commands
have been taught not to create empty submodule ref cache for a
directory that is not a submodule. This removes a ton of wasted
CPU cycles.
* Drop a few old "todo" items by deciding that the change one of them
suggests is not such a good idea, and doing the change the other
one suggested to do.
* Documentation for "git fetch --depth" has been updated for clarity.
* The command line completion learned a handful of additional options
and command specific syntax.
Also includes a handful of documentation and test updates.

View File

@ -0,0 +1,41 @@
Git v2.7.2 Release Notes
========================
Fixes since v2.7.1
------------------
* The low-level merge machinery has been taught to use CRLF line
termination when inserting conflict markers to merged contents that
are themselves CRLF line-terminated.
* "git worktree" had a broken code that attempted to auto-fix
possible inconsistency that results from end-users moving a
worktree to different places without telling Git (the original
repository needs to maintain backpointers to its worktrees, but
"mv" run by end-users who are not familiar with that fact will
obviously not adjust them), which actually made things worse
when triggered.
* "git push --force-with-lease" has been taught to report if the push
needed to force (or fast-forwarded).
* The emulated "yes" command used in our test scripts has been
tweaked not to spend too much time generating unnecessary output
that is not used, to help those who test on Windows where it would
not stop until it fills the pipe buffer due to lack of SIGPIPE.
* The vimdiff backend for "git mergetool" has been tweaked to arrange
and number buffers in the order that would match the expectation of
majority of people who read left to right, then top down and assign
buffers 1 2 3 4 "mentally" to local base remote merge windows based
on that order.
* The documentation for "git clean" has been corrected; it mentioned
that .git/modules/* are removed by giving two "-f", which has never
been the case.
* Paths that have been told the index about with "add -N" are not
quite yet in the index, but a few commands behaved as if they
already are in a harmful way.
Also includes tiny documentation and test updates.

View File

@ -0,0 +1,62 @@
Git v2.7.3 Release Notes
========================
Fixes since v2.7.2
------------------
* Traditionally, the tests that try commands that work on the
contents in the working tree were named with "worktree" in their
filenames, but with the recent addition of "git worktree"
subcommand, whose tests are also named similarly, it has become
harder to tell them apart. The traditional tests have been renamed
to use "work-tree" instead in an attempt to differentiate them.
* Many codepaths forget to check return value from git_config_set();
the function is made to die() to make sure we do not proceed when
setting a configuration variable failed.
* Handling of errors while writing into our internal asynchronous
process has been made more robust, which reduces flakiness in our
tests.
* "git show 'HEAD:Foo[BAR]Baz'" did not interpret the argument as a
rev, i.e. the object named by the the pathname with wildcard
characters in a tree object.
* "git rev-parse --git-common-dir" used in the worktree feature
misbehaved when run from a subdirectory.
* The "v(iew)" subcommand of the interactive "git am -i" command was
broken in 2.6.0 timeframe when the command was rewritten in C.
* "git merge-tree" used to mishandle "both sides added" conflict with
its own "create a fake ancestor file that has the common parts of
what both sides have added and do a 3-way merge" logic; this has
been updated to use the usual "3-way merge with an empty blob as
the fake common ancestor file" approach used in the rest of the
system.
* The memory ownership rule of fill_textconv() API, which was a bit
tricky, has been documented a bit better.
* The documentation did not clearly state that the 'simple' mode is
now the default for "git push" when push.default configuration is
not set.
* Recent versions of GNU grep are pickier when their input contains
arbitrary binary data, which some of our tests uses. Rewrite the
tests to sidestep the problem.
* A helper function "git submodule" uses since v2.7.0 to list the
modules that match the pathspec argument given to its subcommands
(e.g. "submodule add <repo> <path>") has been fixed.
* "git config section.var value" to set a value in per-repository
configuration file failed when it was run outside any repository,
but didn't say the reason correctly.
* The code to read the pack data using the offsets stored in the pack
idx file has been made more carefully check the validity of the
data in the idx.
Also includes documentation and test updates.

View File

@ -0,0 +1,11 @@
Git v2.7.4 Release Notes
========================
Fixes since v2.7.3
------------------
* Bugfix patches were backported from the 'master' front to plug heap
corruption holes, to catch integer overflow in the computation of
pathname lengths, and to get rid of the name_path API. Both of
these would have resulted in writing over an under-allocated buffer
when formulating pathnames while tree traversal.

View File

@ -0,0 +1,439 @@
Git 2.8 Release Notes
=====================
Backward compatibility note
---------------------------
The rsync:// transport has been removed.
Updates since v2.7
------------------
UI, Workflows & Features
* It turns out "git clone" over rsync transport has been broken when
the source repository has packed references for a long time, and
nobody noticed nor complained about it.
* "push" learned that its "--delete" option can be shortened to
"-d", just like "branch --delete" and "branch -d" are the same
thing.
* "git blame" learned to produce the progress eye-candy when it takes
too much time before emitting the first line of the result.
* "git grep" can now be configured (or told from the command line)
how many threads to use when searching in the working tree files.
* Some "git notes" operations, e.g. "git log --notes=<note>", should
be able to read notes from any tree-ish that is shaped like a notes
tree, but the notes infrastructure required that the argument must
be a ref under refs/notes/. Loosen it to require a valid ref only
when the operation would update the notes (in which case we must
have a place to store the updated notes tree, iow, a ref).
* "git grep" by default does not fall back to its "--no-index"
behavior outside a directory under Git's control (otherwise the
user may by mistake end up running a huge recursive search); with a
new configuration (set in $HOME/.gitconfig--by definition this
cannot be set in the config file per project), this safety can be
disabled.
* "git pull --rebase" has been extended to allow invoking
"rebase -i".
* "git p4" learned to cope with the type of a file getting changed.
* "git format-patch" learned to notice format.outputDirectory
configuration variable. This allows "-o <dir>" option to be
omitted on the command line if you always use the same directory in
your workflow.
* "interpret-trailers" has been taught to optionally update a file in
place, instead of always writing the result to the standard output.
* Many commands that read files that are expected to contain text
that is generated (or can be edited) by the end user to control
their behavior (e.g. "git grep -f <filename>") have been updated
to be more tolerant to lines that are terminated with CRLF (they
used to treat such a line to contain payload that ends with CR,
which is usually not what the users expect).
* "git notes merge" used to limit the source of the merged notes tree
to somewhere under refs/notes/ hierarchy, which was too limiting
when inventing a workflow to exchange notes with remote
repositories using remote-tracking notes trees (located in e.g.
refs/remote-notes/ or somesuch).
* "git ls-files" learned a new "--eol" option to help diagnose
end-of-line problems.
* "ls-remote" learned an option to show which branch the remote
repository advertises as its primary by pointing its HEAD at.
* New http.proxyAuthMethod configuration variable can be used to
specify what authentication method to use, as a way to work around
proxies that do not give error response expected by libcurl when
CURLAUTH_ANY is used. Also, the codepath for proxy authentication
has been taught to use credential API to store the authentication
material in user's keyrings.
* Update the untracked cache subsystem and change its primary UI from
"git update-index" to "git config".
* There were a few "now I am doing this thing" progress messages in
the TCP connection code that can be triggered by setting a verbose
option internally in the code, but "git fetch -v" and friends never
passed the verbose option down to that codepath.
* Clean/smudge filters defined in a configuration file of lower
precedence can now be overridden to be a pass-through no-op by
setting the variable to an empty string.
* A new "<branch>^{/!-<pattern>}" notation can be used to name a
commit that is reachable from <branch> that does not match the
given <pattern>.
* The "user.useConfigOnly" configuration variable can be used to
force the user to always set user.email & user.name configuration
variables, serving as a reminder for those who work on multiple
projects and do not want to put these in their $HOME/.gitconfig.
* "git fetch" and friends that make network connections can now be
told to only use ipv4 (or ipv6).
* Some authentication methods do not need username or password, but
libcurl needs some hint that it needs to perform authentication.
Supplying an empty username and password string is a valid way to
do so, but you can set the http.[<url>.]emptyAuth configuration
variable to achieve the same, if you find it cleaner.
* You can now set http.[<url>.]pinnedpubkey to specify the pinned
public key when building with recent enough versions of libcURL.
* The configuration system has been taught to phrase where it found a
bad configuration variable in a better way in its error messages.
"git config" learnt a new "--show-origin" option to indicate where
the values come from.
* The "credential-cache" daemon process used to run in whatever
directory it happened to start in, but this made umount(2)ing the
filesystem that houses the repository harder; now the process
chdir()s to the directory that house its own socket on startup.
* When "git submodule update" did not result in fetching the commit
object in the submodule that is referenced by the superproject, the
command learned to retry another fetch, specifically asking for
that commit that may not be connected to the refs it usually
fetches.
* "git merge-recursive" learned "--no-renames" option to disable its
rename detection logic.
* Across the transition at around Git version 2.0, the user used to
get a pretty loud warning when running "git push" without setting
push.default configuration variable. We no longer warn because the
transition was completed a long time ago.
* README has been renamed to README.md and its contents got tweaked
slightly to make it easier on the eyes.
Performance, Internal Implementation, Development Support etc.
* Add a framework to spawn a group of processes in parallel, and use
it to run "git fetch --recurse-submodules" in parallel.
* A slight update to the Makefile to mark ".PHONY" targets as such
correctly.
* In-core storage of the reverse index for .pack files (which lets
you go from a pack offset to an object name) has been streamlined.
* d95138e6 (setup: set env $GIT_WORK_TREE when work tree is set, like
$GIT_DIR, 2015-06-26) attempted to work around a glitch in alias
handling by overwriting GIT_WORK_TREE environment variable to
affect subprocesses when set_git_work_tree() gets called, which
resulted in a rather unpleasant regression to "clone" and "init".
Try to address the same issue by always restoring the environment
and respawning the real underlying command when handling alias.
* The low-level code that is used to create symbolic references has
been updated to share more code with the code that deals with
normal references.
* strbuf_getline() and friends have been redefined to make it easier
to identify which callsite of (new) strbuf_getline_lf() should
allow and silently ignore carriage-return at the end of the line to
help users on DOSsy systems.
* "git shortlog" used to accumulate various pieces of information
regardless of what was asked to be shown in the final output. It
has been optimized by noticing what need not to be collected
(e.g. there is no need to collect the log messages when showing
only the number of changes).
* "git checkout $branch" (and other operations that share the same
underlying machinery) has been optimized.
* Automated tests in Travis CI environment has been optimized by
persisting runtime statistics of previous "prove" run, executing
tests that take longer before other ones; this reduces the total
wallclock time.
* Test scripts have been updated to remove assumptions that are not
portable between Git for POSIX and Git for Windows, or to skip ones
with expectations that are not satisfiable on Git for Windows.
* Some calls to strcpy(3) triggers a false warning from static
analyzers that are less intelligent than humans, and reducing the
number of these false hits helps us notice real issues. A few
calls to strcpy(3) in a couple of protrams that are already safe
has been rewritten to avoid false warnings.
* The "name_path" API was an attempt to reduce the need to construct
the full path out of a series of path components while walking a
tree hierarchy, but over time made less efficient because the path
needs to be flattened, e.g. to be compared with another path that
is already flat. The API has been removed and its users have been
rewritten to simplify the overall code complexity.
* Help those who debug http(s) part of the system.
(merge 0054045 sp/remote-curl-ssl-strerror later to maint).
* The internal API to interact with "remote.*" configuration
variables has been streamlined.
* The ref-filter's format-parsing code has been refactored, in
preparation for "branch --format" and friends.
* Traditionally, the tests that try commands that work on the
contents in the working tree were named with "worktree" in their
filenames, but with the recent addition of "git worktree"
subcommand, whose tests are also named similarly, it has become
harder to tell them apart. The traditional tests have been renamed
to use "work-tree" instead in an attempt to differentiate them.
(merge 5549029 mg/work-tree-tests later to maint).
* Many codepaths forget to check return value from git_config_set();
the function is made to die() to make sure we do not proceed when
setting a configuration variable failed.
(merge 3d18064 ps/config-error later to maint).
* Handling of errors while writing into our internal asynchronous
process has been made more robust, which reduces flakiness in our
tests.
(merge 43f3afc jk/epipe-in-async later to maint).
* There is a new DEVELOPER knob that enables many compiler warning
options in the Makefile.
* The way the test scripts configure the Apache web server has been
updated to work also for Apache 2.4 running on RedHat derived
distros.
* Out of maintenance gcc on OSX 10.6 fails to compile the code in
'master'; work it around by using clang by default on the platform.
* The "name_path" API was an attempt to reduce the need to construct
the full path out of a series of path components while walking a
tree hierarchy, but over time made less efficient because the path
needs to be flattened, e.g. to be compared with another path that
is already flat, in many cases. The API has been removed and its
users have been rewritten to simplify the overall code complexity.
This incidentally also closes some heap-corruption holes.
* Recent versions of GNU grep is pickier than before to decide if a
file is "binary" and refuse to give line-oriented hits when we
expect it to, unless explicitly told with "-a" option. As our
scripted Porcelains use sane_grep wrapper for line-oriented data,
even when the line may contain non-ASCII payload we took from
end-user data, use "grep -a" to implement sane_grep wrapper when
using an implementation of "grep" that takes the "-a" option.
Also contains various documentation updates and code clean-ups.
Fixes since v2.7
----------------
Unless otherwise noted, all the fixes since v2.7 in the maintenance
track are contained in this release (see the maintenance releases'
notes for details).
* An earlier change in 2.5.x-era broke users' hooks and aliases by
exporting GIT_WORK_TREE to point at the root of the working tree,
interfering when they tried to use a different working tree without
setting GIT_WORK_TREE environment themselves.
* The "exclude_list" structure has the usual "alloc, nr" pair of
fields to be used by ALLOC_GROW(), but clear_exclude_list() forgot
to reset 'alloc' to 0 when it cleared 'nr' to discard the managed
array.
* Paths that have been told the index about with "add -N" are not
quite yet in the index, but a few commands behaved as if they
already are in a harmful way.
* "git send-email" was confused by escaped quotes stored in the alias
files saved by "mutt", which has been corrected.
* A few non-portable C construct have been spotted by clang compiler
and have been fixed.
* The documentation has been updated to hint the connection between
the '--signoff' option and DCO.
* "git reflog" incorrectly assumed that all objects that used to be
at the tip of a ref must be commits, which caused it to segfault.
* The ignore mechanism saw a few regressions around untracked file
listing and sparse checkout selection areas in 2.7.0; the change
that is responsible for the regression has been reverted.
* Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR
(e.g. COMMIT_EDITMSG) that is meant to be left after the command is
done. This however did not work well if the repository is set to
be shared with core.sharedRepository and the umask of the previous
user is tighter. They have been made to work better by calling
unlink(2) and retrying after fopen(3) fails with EPERM.
* Asking gitweb for a nonexistent commit left a warning in the server
log.
Somebody may want to follow this up with an additional test, perhaps?
IIRC, we do test that no Perl warnings are given to the server log,
so this should have been caught if our test coverage were good.
* "git rebase", unlike all other callers of "gc --auto", did not
ignore the exit code from "gc --auto".
* Many codepaths that run "gc --auto" before exiting kept packfiles
mapped and left the file descriptors to them open, which was not
friendly to systems that cannot remove files that are open. They
now close the packs before doing so.
* A recent optimization to filter-branch in v2.7.0 introduced a
regression when --prune-empty filter is used, which has been
corrected.
* The description for SANITY prerequisite the test suite uses has
been clarified both in the comment and in the implementation.
* "git tag" started listing a tag "foo" as "tags/foo" when a branch
named "foo" exists in the same repository; remove this unnecessary
disambiguation, which is a regression introduced in v2.7.0.
* The way "git svn" uses auth parameter was broken by Subversion
1.9.0 and later.
* The "split" subcommand of "git subtree" (in contrib/) incorrectly
skipped merges when it shouldn't, which was corrected.
* A few options of "git diff" did not work well when the command was
run from a subdirectory.
* The command line completion learned a handful of additional options
and command specific syntax.
* dirname() emulation has been added, as Msys2 lacks it.
* The underlying machinery used by "ls-files -o" and other commands
has been taught not to create empty submodule ref cache for a
directory that is not a submodule. This removes a ton of wasted
CPU cycles.
* "git worktree" had a broken code that attempted to auto-fix
possible inconsistency that results from end-users moving a
worktree to different places without telling Git (the original
repository needs to maintain back-pointers to its worktrees,
but "mv" run by end-users who are not familiar with that fact
will obviously not adjust them), which actually made things
worse when triggered.
* The low-level merge machinery has been taught to use CRLF line
termination when inserting conflict markers to merged contents that
are themselves CRLF line-terminated.
* "git push --force-with-lease" has been taught to report if the push
needed to force (or fast-forwarded).
* The emulated "yes" command used in our test scripts has been
tweaked not to spend too much time generating unnecessary output
that is not used, to help those who test on Windows where it would
not stop until it fills the pipe buffer due to lack of SIGPIPE.
* The documentation for "git clean" has been corrected; it mentioned
that .git/modules/* are removed by giving two "-f", which has never
been the case.
* The vimdiff backend for "git mergetool" has been tweaked to arrange
and number buffers in the order that would match the expectation of
majority of people who read left to right, then top down and assign
buffers 1 2 3 4 "mentally" to local base remote merge windows based
on that order.
* "git show 'HEAD:Foo[BAR]Baz'" did not interpret the argument as a
rev, i.e. the object named by the the pathname with wildcard
characters in a tree object.
(merge aac4fac nd/dwim-wildcards-as-pathspecs later to maint).
* "git rev-parse --git-common-dir" used in the worktree feature
misbehaved when run from a subdirectory.
(merge 17f1365 nd/git-common-dir-fix later to maint).
* "git worktree add -B <branchname>" did not work.
* The "v(iew)" subcommand of the interactive "git am -i" command was
broken in 2.6.0 timeframe when the command was rewritten in C.
(merge 708b8cc jc/am-i-v-fix later to maint).
* "git merge-tree" used to mishandle "both sides added" conflict with
its own "create a fake ancestor file that has the common parts of
what both sides have added and do a 3-way merge" logic; this has
been updated to use the usual "3-way merge with an empty blob as
the fake common ancestor file" approach used in the rest of the
system.
(merge 907681e jk/no-diff-emit-common later to maint).
* The memory ownership rule of fill_textconv() API, which was a bit
tricky, has been documented a bit better.
(merge a64e6a4 jk/more-comments-on-textconv later to maint).
* Update various codepaths to avoid manually-counted malloc().
(merge 08c95df jk/tighten-alloc later to maint).
* The documentation did not clearly state that the 'simple' mode is
now the default for "git push" when push.default configuration is
not set.
(merge f6b1fb3 mm/push-simple-doc later to maint).
* Recent versions of GNU grep are pickier when their input contains
arbitrary binary data, which some of our tests uses. Rewrite the
tests to sidestep the problem.
(merge 3b1442d jk/grep-binary-workaround-in-test later to maint).
* A helper function "git submodule" uses since v2.7.0 to list the
modules that match the pathspec argument given to its subcommands
(e.g. "submodule add <repo> <path>") has been fixed.
(merge 2b56bb7 sb/submodule-module-list-fix later to maint).
* "git config section.var value" to set a value in per-repository
configuration file failed when it was run outside any repository,
but didn't say the reason correctly.
(merge 638fa62 js/config-set-in-non-repository later to maint).
* The code to read the pack data using the offsets stored in the pack
idx file has been made more carefully check the validity of the
data in the idx.
(merge 7465feb jk/pack-idx-corruption-safety later to maint).
* Other minor clean-ups and documentation updates
(merge f459823 ak/extract-argv0-last-dir-sep later to maint).
(merge 63ca1c0 ak/git-strip-extension-from-dashed-command later to maint).
(merge 4867f11 ps/plug-xdl-merge-leak later to maint).
(merge 4938686 dt/initial-ref-xn-commit-doc later to maint).
(merge 9537f21 ma/update-hooks-sample-typofix later to maint).

View File

@ -69,6 +69,13 @@ include::line-range-format.txt[]
iso format is used. For supported values, see the discussion
of the --date option at linkgit:git-log[1].
--[no-]progress::
Progress status is reported on the standard error stream
by default when it is attached to a terminal. This flag
enables progress reporting even if not attached to a
terminal. Can't use `--progress` together with `--porcelain`
or `--incremental`.
-M|<num>|::
Detect moved or copied lines within a file. When a commit
moves or copies a block of lines (e.g. the original file

View File

@ -308,6 +308,15 @@ core.trustctime::
crawlers and some backup systems).
See linkgit:git-update-index[1]. True by default.
core.untrackedCache::
Determines what to do about the untracked cache feature of the
index. It will be kept, if this variable is unset or set to
`keep`. It will automatically be added if set to `true`. And
it will automatically be removed, if set to `false`. Before
setting it to `true`, you should check that mtime is working
properly on your system.
See linkgit:git-update-index[1]. `keep` by default.
core.checkStat::
Determines which stat fields to match between the index
and work tree. The user can set this to 'default' or
@ -870,6 +879,8 @@ When preserve, also pass `--preserve-merges` along to 'git rebase'
so that locally committed merge commits will not be flattened
by running 'git pull'.
+
When the value is `interactive`, the rebase is run in interactive mode.
+
*NOTE*: this is a possibly dangerous operation; do *not* use
it unless you understand the implications (see linkgit:git-rebase[1]
for details).
@ -1243,6 +1254,10 @@ format.coverLetter::
format-patch is invoked, but in addition can be set to "auto", to
generate a cover-letter only when there's more than one patch.
format.outputDirectory::
Set a custom directory to store the resulting files instead of the
current working directory.
filter.<driver>.clean::
The command which is used to convert the content of a worktree
file to a blob upon checkin. See linkgit:gitattributes[5] for
@ -1450,6 +1465,14 @@ grep.extendedRegexp::
option is ignored when the 'grep.patternType' option is set to a value
other than 'default'.
grep.threads::
Number of grep worker threads to use.
See `grep.threads` in linkgit:git-grep[1] for more information.
grep.fallbackToNoIndex::
If set to true, fall back to git grep --no-index if git grep
is executed outside of a git repository. Defaults to false.
gpg.program::
Use this custom program instead of "gpg" found on $PATH when
making or verifying a PGP signature. The program must support the
@ -1596,9 +1619,40 @@ help.htmlPath::
http.proxy::
Override the HTTP proxy, normally configured using the 'http_proxy',
'https_proxy', and 'all_proxy' environment variables (see
`curl(1)`). This can be overridden on a per-remote basis; see
remote.<name>.proxy
'https_proxy', and 'all_proxy' environment variables (see `curl(1)`). In
addition to the syntax understood by curl, it is possible to specify a
proxy string with a user name but no password, in which case git will
attempt to acquire one in the same way it does for other credentials. See
linkgit:gitcredentials[7] for more information. The syntax thus is
'[protocol://][user[:password]@]proxyhost[:port]'. This can be overridden
on a per-remote basis; see remote.<name>.proxy
http.proxyAuthMethod::
Set the method with which to authenticate against the HTTP proxy. This
only takes effect if the configured proxy string contains a user name part
(i.e. is of the form 'user@host' or 'user@host:port'). This can be
overridden on a per-remote basis; see `remote.<name>.proxyAuthMethod`.
Both can be overridden by the 'GIT_HTTP_PROXY_AUTHMETHOD' environment
variable. Possible values are:
+
--
* `anyauth` - Automatically pick a suitable authentication method. It is
assumed that the proxy answers an unauthenticated request with a 407
status code and one or more Proxy-authenticate headers with supported
authentication methods. This is the default.
* `basic` - HTTP Basic authentication
* `digest` - HTTP Digest authentication; this prevents the password from being
transmitted to the proxy in clear text
* `negotiate` - GSS-Negotiate authentication (compare the --negotiate option
of `curl(1)`)
* `ntlm` - NTLM authentication (compare the --ntlm option of `curl(1)`)
--
http.emptyAuth::
Attempt authentication without seeking a username or password. This
can be used to attempt GSS-Negotiate authentication without specifying
a username in the URL, as libcurl normally requires a username for
authentication.
http.cookieFile::
File containing previously stored cookie lines which should be used
@ -1679,6 +1733,14 @@ http.sslCAPath::
with when fetching or pushing over HTTPS. Can be overridden
by the 'GIT_SSL_CAPATH' environment variable.
http.pinnedpubkey::
Public key of the https service. It may either be the filename of
a PEM or DER encoded public key file or a string starting with
'sha256//' followed by the base64 encoded sha256 hash of the
public key. See also libcurl 'CURLOPT_PINNEDPUBLICKEY'. git will
exit with an error if this option is set but not supported by
cURL.
http.sslTry::
Attempt to use AUTH SSL/TLS and encrypted data transfers
when connecting via regular FTP protocol. This might be needed
@ -2074,7 +2136,7 @@ pack.indexVersion::
larger than 2 GB.
+
If you have an old Git that does not understand the version 2 `*.idx` file,
cloning or fetching over a non native protocol (e.g. "http" and "rsync")
cloning or fetching over a non native protocol (e.g. "http")
that will copy both `*.pack` file and corresponding `*.idx` file from the
other side may give you a repository that cannot be accessed with your
older version of Git. If the `*.pack` file is smaller than 2 GB, however,
@ -2149,6 +2211,8 @@ When preserve, also pass `--preserve-merges` along to 'git rebase'
so that locally committed merge commits will not be flattened
by running 'git pull'.
+
When the value is `interactive`, the rebase is run in interactive mode.
+
*NOTE*: this is a possibly dangerous operation; do *not* use
it unless you understand the implications (see linkgit:git-rebase[1]
for details).
@ -2229,6 +2293,20 @@ push.gpgSign::
override a value from a lower-priority config file. An explicit
command-line flag always overrides this config option.
push.recurseSubmodules::
Make sure all submodule commits used by the revisions to be pushed
are available on a remote-tracking branch. If the value is 'check'
then Git will verify that all submodule commits that changed in the
revisions to be pushed are available on at least one remote of the
submodule. If any commits are missing, the push will be aborted and
exit with non-zero status. If the value is 'on-demand' then all
submodules that changed in the revisions to be pushed will be
pushed. If on-demand was not able to push all necessary revisions
it will also be aborted and exit with non-zero status. If the value
is 'no' then default behavior of ignoring submodules when pushing
is retained. You may override this configuration at time of push by
specifying '--recurse-submodules=check|on-demand|no'.
rebase.stat::
Whether to show a diffstat of what changed upstream since the last
rebase. False by default.
@ -2393,6 +2471,11 @@ remote.<name>.proxy::
the proxy to use for that remote. Set to the empty string to
disable proxying for that remote.
remote.<name>.proxyAuthMethod::
For remotes that require curl (http, https and ftp), the method to use for
authenticating against the proxy in use (probably set in
`remote.<name>.proxy`). See `http.proxyAuthMethod`.
remote.<name>.fetch::
The default set of "refspec" for linkgit:git-fetch[1]. See
linkgit:git-fetch[1].
@ -2767,6 +2850,16 @@ user.name::
Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
environment variables. See linkgit:git-commit-tree[1].
user.useConfigOnly::
Instruct Git to avoid trying to guess defaults for 'user.email'
and 'user.name', and instead retrieve the values only from the
configuration. For example, if you have multiple email addresses
and would like to use a different one for each repository, then
with this configuration option set to `true` in the global config
along with a name, Git will prompt you to set up an email before
making new commits in a newly cloned repository.
Defaults to `false`.
user.signingKey::
If linkgit:git-tag[1] or linkgit:git-commit[1] is not selecting the
key you want it to automatically when creating a signed tag or

View File

@ -8,10 +8,11 @@
option old data in `.git/FETCH_HEAD` will be overwritten.
--depth=<depth>::
Deepen or shorten the history of a 'shallow' repository created by
`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])
to the specified number of commits from the tip of each remote
branch history. Tags for the deepened commits are not fetched.
Limit fetching to the specified number of commits from the tip of
each remote branch history. If fetching to a 'shallow' repository
created by `git clone` with `--depth=<depth>` option (see
linkgit:git-clone[1]), deepen or shorten the history to the specified
number of commits. Tags for the deepened commits are not fetched.
--unshallow::
If the source repository is complete, convert a shallow
@ -157,3 +158,11 @@ endif::git-pull[]
by default when it is attached to a terminal, unless -q
is specified. This flag forces progress status even if the
standard error stream is not directed to a terminal.
-4::
--ipv4::
Use IPv4 addresses only, ignoring IPv6 addresses.
-6::
--ipv6::
Use IPv6 addresses only, ignoring IPv4 addresses.

View File

@ -24,7 +24,7 @@ remove paths that do not exist in the working tree anymore.
The "index" holds a snapshot of the content of the working tree, and it
is this snapshot that is taken as the contents of the next commit. Thus
after making any changes to the working directory, and before running
after making any changes to the working tree, and before running
the commit command, you must use the `add` command to add any new or
modified files to the index.

View File

@ -35,6 +35,7 @@ OPTIONS
--signoff::
Add a `Signed-off-by:` line to the commit message, using
the committer identity of yourself.
See the signoff option in linkgit:git-commit[1] for more information.
-k::
--keep::

View File

@ -10,7 +10,8 @@ SYNOPSIS
[verse]
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]
[-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
[--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>] [--] <file>
[--progress] [--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>]
[--] <file>
DESCRIPTION
-----------

View File

@ -20,7 +20,7 @@ DESCRIPTION
Some workflows require that one or more branches of development on one
machine be replicated on another machine, but the two machines cannot
be directly connected, and therefore the interactive Git protocols (git,
ssh, rsync, http) cannot be used. This command provides support for
ssh, http) cannot be used. This command provides support for
'git fetch' and 'git pull' to operate by packaging objects and references
in an archive at the originating machine, then importing those into
another repository using 'git fetch' and 'git pull'

View File

@ -100,6 +100,7 @@ effect to your index in a row.
-s::
--signoff::
Add Signed-off-by line at the end of the commit message.
See the signoff option in linkgit:git-commit[1] for more information.
-S[<keyid>]::
--gpg-sign[=<keyid>]::

View File

@ -37,9 +37,7 @@ OPTIONS
to false, 'git clean' will refuse to delete files or directories
unless given -f, -n or -i. Git will refuse to delete directories
with .git sub directory or file unless a second -f
is given. This affects also git submodules where the storage area
of the removed submodule under .git/modules/ is not removed until
-f is given twice.
is given.
-i::
--interactive::

View File

@ -115,8 +115,7 @@ objects from the source repository into a pack in the cloned repository.
--quiet::
-q::
Operate quietly. Progress is not reported to the standard
error stream. This flag is also passed to the `rsync'
command when given.
error stream.
--verbose::
-v::
@ -190,15 +189,14 @@ objects from the source repository into a pack in the cloned repository.
--depth <depth>::
Create a 'shallow' clone with a history truncated to the
specified number of revisions.
specified number of commits. Implies `--single-branch` unless
`--no-single-branch` is given to fetch the histories near the
tips of all branches.
--[no-]single-branch::
Clone only the history leading to the tip of a single branch,
either specified by the `--branch` option or the primary
branch remote's `HEAD` points at. When creating a shallow
clone with the `--depth` option, this is the default, unless
`--no-single-branch` is given to fetch the histories near the
tips of all branches.
branch remote's `HEAD` points at.
Further fetches into the resulting repository will only update the
remote-tracking branch for the branch this option was used for the
initial cloning. If the HEAD at the remote did not point at any

View File

@ -154,7 +154,11 @@ OPTIONS
-s::
--signoff::
Add Signed-off-by line by the committer at the end of the commit
log message.
log message. The meaning of a signoff depends on the project,
but it typically certifies that committer has
the rights to submit this work under the same license and
agrees to a Developer Certificate of Origin
(see http://developercertificate.org/ for more information).
-n::
--no-verify::

View File

@ -9,18 +9,18 @@ git-config - Get and set repository or global options
SYNOPSIS
--------
[verse]
'git config' [<file-option>] [type] [-z|--null] name [value [value_regex]]
'git config' [<file-option>] [type] [--show-origin] [-z|--null] name [value [value_regex]]
'git config' [<file-option>] [type] --add name value
'git config' [<file-option>] [type] --replace-all name value [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get name [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
'git config' [<file-option>] [type] [-z|--null] [--name-only] --get-regexp name_regex [value_regex]
'git config' [<file-option>] [type] [--show-origin] [-z|--null] --get name [value_regex]
'git config' [<file-option>] [type] [--show-origin] [-z|--null] --get-all name [value_regex]
'git config' [<file-option>] [type] [--show-origin] [-z|--null] [--name-only] --get-regexp name_regex [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get-urlmatch name URL
'git config' [<file-option>] --unset name [value_regex]
'git config' [<file-option>] --unset-all name [value_regex]
'git config' [<file-option>] --rename-section old_name new_name
'git config' [<file-option>] --remove-section name
'git config' [<file-option>] [-z|--null] [--name-only] -l | --list
'git config' [<file-option>] [--show-origin] [-z|--null] [--name-only] -l | --list
'git config' [<file-option>] --get-color name [default]
'git config' [<file-option>] --get-colorbool name [stdout-is-tty]
'git config' [<file-option>] -e | --edit
@ -194,6 +194,12 @@ See also <<FILES>>.
Output only the names of config variables for `--list` or
`--get-regexp`.
--show-origin::
Augment the output of all queried config options with the
origin type (file, standard input, blob, command line) and
the actual origin (config file path, ref, or blob id if
applicable).
--get-colorbool name [stdout-is-tty]::
Find the color setting for `name` (e.g. `color.diff`) and output
@ -219,7 +225,9 @@ See also <<FILES>>.
--[no-]includes::
Respect `include.*` directives in config files when looking up
values. Defaults to on.
values. Defaults to `off` when a specific file is given (e.g.,
using `--file`, `--global`, etc) and `on` when searching all
config files.
[[FILES]]
FILES

View File

@ -36,7 +36,7 @@ OPTIONS
cache daemon if one is not started). Defaults to
`~/.git-credential-cache/socket`. If your home directory is on a
network-mounted filesystem, you may need to change this to a
local filesystem.
local filesystem. You must specify an absolute path.
CONTROLLING THE DAEMON
----------------------

View File

@ -92,7 +92,11 @@ refname::
The name of the ref (the part after $GIT_DIR/).
For a non-ambiguous short name of the ref append `:short`.
The option core.warnAmbiguousRefs is used to select the strict
abbreviation mode.
abbreviation mode. If `strip=<N>` is appended, strips `<N>`
slash-separated path components from the front of the refname
(e.g., `%(refname:strip=2)` turns `refs/tags/foo` into `foo`.
`<N>` must be a positive integer. If a displayed ref has fewer
components than `<N>`, the command aborts with an error.
objecttype::
The type of the object (`blob`, `tree`, `commit`, `tag`).
@ -129,19 +133,28 @@ color::
align::
Left-, middle-, or right-align the content between
%(align:...) and %(end). The "align:" is followed by `<width>`
and `<position>` in any order separated by a comma, where the
`<position>` is either left, right or middle, default being
left and `<width>` is the total length of the content with
alignment. If the contents length is more than the width then
no alignment is performed. If used with '--quote' everything
in between %(align:...) and %(end) is quoted, but if nested
then only the topmost level performs quoting.
%(align:...) and %(end). The "align:" is followed by
`width=<width>` and `position=<position>` in any order
separated by a comma, where the `<position>` is either left,
right or middle, default being left and `<width>` is the total
length of the content with alignment. For brevity, the
"width=" and/or "position=" prefixes may be omitted, and bare
<width> and <position> used instead. For instance,
`%(align:<width>,<position>)`. If the contents length is more
than the width then no alignment is performed. If used with
'--quote' everything in between %(align:...) and %(end) is
quoted, but if nested then only the topmost level performs
quoting.
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.
For commit and tag objects, the special `creatordate` and `creator`
fields will correspond to the appropriate date or name-email-date tuple
from the `committer` or `tagger` fields depending on the object type.
These are intended for working on a mix of annotated and lightweight tags.
Fields that have name-email-date tuple as its value (`author`,
`committer`, and `tagger`) can be suffixed with `name`, `email`,
and `date` to extract the named component.
@ -153,8 +166,8 @@ line is 'contents:body', where body is all of the lines after the first
blank line. The optional GPG signature is `contents:signature`. The
first `N` lines of the message is obtained using `contents:lines=N`.
For sorting purposes, fields with numeric values sort in numeric
order (`objectsize`, `authordate`, `committerdate`, `taggerdate`).
For sorting purposes, fields with numeric values sort in numeric order
(`objectsize`, `authordate`, `committerdate`, `creatordate`, `taggerdate`).
All other fields are used to sort in their byte-value order.
There is also an option to sort by versions, this can be done by using

View File

@ -57,7 +57,11 @@ The names of the output files are printed to standard
output, unless the `--stdout` option is specified.
If `-o` is specified, output files are created in <dir>. Otherwise
they are created in the current working directory.
they are created in the current working directory. The default path
can be set with the 'format.outputDirectory' configuration option.
The `-o` option takes precedence over `format.outputDirectory`.
To store patches in the current working directory even when
`format.outputDirectory` points elsewhere, use `-o .`.
By default, the subject of a single patch is "[PATCH] " followed by
the concatenation of lines from the commit message up to the first blank
@ -109,6 +113,7 @@ include::diff-options.txt[]
--signoff::
Add `Signed-off-by:` line to the commit message, using
the committer identity of yourself.
See the signoff option in linkgit:git-commit[1] for more information.
--stdout::
Print all commits to the standard output in mbox format,
@ -256,6 +261,10 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
using this option cannot be applied properly, but they are
still useful for code review.
--zero-commit::
Output an all-zero hash in each patch's From header instead
of the hash of the commit.
--root::
Treat the revision argument as a <revision range>, even if it
is just a single commit (that would normally be treated as a

View File

@ -23,6 +23,7 @@ SYNOPSIS
[--break] [--heading] [-p | --show-function]
[-A <post-context>] [-B <pre-context>] [-C <context>]
[-W | --function-context]
[--threads <num>]
[-f <file>] [-e] <pattern>
[--and|--or|--not|(|)|-e <pattern>...]
[ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...]
@ -53,9 +54,17 @@ grep.extendedRegexp::
option is ignored when the 'grep.patternType' option is set to a value
other than 'default'.
grep.threads::
Number of grep worker threads to use. If unset (or set to 0),
8 threads are used by default (for now).
grep.fullName::
If set to true, enable '--full-name' option by default.
grep.fallbackToNoIndex::
If set to true, fall back to git grep --no-index if git grep
is executed outside of a git repository. Defaults to false.
OPTIONS
-------
@ -227,6 +236,10 @@ OPTIONS
effectively showing the whole function in which the match was
found.
--threads <num>::
Number of grep worker threads to use.
See `grep.threads` in 'CONFIGURATION' for more information.
-f <file>::
Read patterns from <file>, one per line.

View File

@ -8,7 +8,7 @@ git-interpret-trailers - help add structured information into commit messages
SYNOPSIS
--------
[verse]
'git interpret-trailers' [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]
'git interpret-trailers' [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]
DESCRIPTION
-----------
@ -64,6 +64,9 @@ folding rules, the encoding rules and probably many other rules.
OPTIONS
-------
--in-place::
Edit the files in place.
--trim-empty::
If the <value> part of any trailer contains only whitespace,
the whole trailer will be removed from the resulting message.
@ -216,6 +219,25 @@ Signed-off-by: Alice <alice@example.com>
Signed-off-by: Bob <bob@example.com>
------------
* Use the '--in-place' option to edit a message file in place:
+
------------
$ cat msg.txt
subject
message
Signed-off-by: Bob <bob@example.com>
$ git interpret-trailers --trailer 'Acked-by: Alice <alice@example.com>' --in-place msg.txt
$ cat msg.txt
subject
message
Signed-off-by: Bob <bob@example.com>
Acked-by: Alice <alice@example.com>
------------
* Extract the last commit as a patch, and add a 'Cc' and a
'Reviewed-by' trailer to it:
+

View File

@ -12,6 +12,7 @@ SYNOPSIS
'git ls-files' [-z] [-t] [-v]
(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*
(-[c|d|o|i|s|u|k|m])*
[--eol]
[-x <pattern>|--exclude=<pattern>]
[-X <file>|--exclude-from=<file>]
[--exclude-per-directory=<file>]
@ -147,6 +148,24 @@ a space) at the start of each line:
possible for manual inspection; the exact format may change at
any time.
--eol::
Show <eolinfo> and <eolattr> of files.
<eolinfo> is the file content identification used by Git when
the "text" attribute is "auto" (or not set and core.autocrlf is not false).
<eolinfo> is either "-text", "none", "lf", "crlf", "mixed" or "".
+
"" means the file is not a regular file, it is not in the index or
not accessible in the working tree.
+
<eolattr> is the attribute that is used when checking out or committing,
it is either "", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf".
Note: Currently Git does not support "text=auto eol=lf" or "text=auto eol=crlf",
that may change in the future.
+
Both the <eolinfo> in the index ("i/<eolinfo>")
and in the working tree ("w/<eolinfo>") are shown for regular files,
followed by the ("attr/<eolattr>").
\--::
Do not interpret any more arguments as options.
@ -161,6 +180,9 @@ which case it outputs:
[<tag> ]<mode> <object> <stage> <file>
'git ls-files --eol' will show
i/<eolinfo><SPACES>w/<eolinfo><SPACES>attr/<eolattr><SPACE*><TAB><file>
'git ls-files --unmerged' and 'git ls-files --stage' can be used to examine
detailed information on unmerged paths.

View File

@ -9,8 +9,9 @@ git-ls-remote - List references in a remote repository
SYNOPSIS
--------
[verse]
'git ls-remote' [--heads] [--tags] [--upload-pack=<exec>]
[--exit-code] <repository> [<refs>...]
'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
[-q | --quiet] [--exit-code] [--get-url]
[--symref] [<repository> [<refs>...]]
DESCRIPTION
-----------
@ -29,6 +30,13 @@ OPTIONS
both, references stored in refs/heads and refs/tags are
displayed.
--refs::
Do not show peeled tags or pseudorefs like HEAD in the output.
-q::
--quiet::
Do not print remote URL to stderr.
--upload-pack=<exec>::
Specify the full path of 'git-upload-pack' on the remote
host. This allows listing references from repositories accessed via
@ -46,6 +54,12 @@ OPTIONS
"url.<base>.insteadOf" config setting (See linkgit:git-config[1]) and
exit without talking to the remote.
--symref::
In addition to the object pointed by it, show the underlying
ref pointed by it when showing a symbolic ref. Currently,
upload-pack only shows the symref HEAD, so it will be the only
one shown by ls-remote.
<repository>::
The "remote" repository to query. This parameter can be
either a URL or the name of a remote (see the GIT URLS and

View File

@ -515,20 +515,18 @@ git-p4.pathEncoding::
Git expects paths encoded as UTF-8. Use this config to tell git-p4
what encoding Perforce had used for the paths. This encoding is used
to transcode the paths to UTF-8. As an example, Perforce on Windows
often uses “cp1252” to encode path names.
often uses "cp1252" to encode path names.
git-p4.largeFileSystem::
Specify the system that is used for large (binary) files. Please note
that large file systems do not support the 'git p4 submit' command.
Only Git LFS [1] is implemented right now. Download
and install the Git LFS command line extension to use this option
and configure it like this:
Only Git LFS is implemented right now (see https://git-lfs.github.com/
for more information). Download and install the Git LFS command line
extension to use this option and configure it like this:
+
-------------
git config git-p4.largeFileSystem GitLFS
-------------
+
[1] https://git-lfs.github.com/
git-p4.largeFileExtensions::
All files matching a file extension in the list will be processed
@ -549,6 +547,10 @@ git-p4.largeFilePush::
Boolean variable which defines if large files are automatically
pushed to a server.
git-p4.keepEmptyCommits::
A changelist that contains only excluded files will be imported
as an empty commit if this boolean option is set to true.
Submit variables
~~~~~~~~~~~~~~~~
git-p4.detectRenames::

View File

@ -101,7 +101,7 @@ Options related to merging
include::merge-options.txt[]
-r::
--rebase[=false|true|preserve]::
--rebase[=false|true|preserve|interactive]::
When true, rebase the current branch on top of the upstream
branch after fetching. If there is a remote-tracking branch
corresponding to the upstream branch and the upstream branch
@ -113,6 +113,8 @@ to `git rebase` so that locally created merge commits will not be flattened.
+
When false, merge the current branch into the upstream branch.
+
When `interactive`, enable the interactive mode of rebase.
+
See `pull.rebase`, `branch.<name>.rebase` and `branch.autoSetupRebase` in
linkgit:git-config[1] if you want to make `git pull` always use
`--rebase` instead of merging.

View File

@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
[--repo=<repository>] [-f | --force] [--prune] [-v | --verbose]
[--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
[-u | --set-upstream]
[--[no-]signed|--sign=(true|false|if-asked)]
[--force-with-lease[=<refname>[:<expect>]]]
@ -37,6 +37,13 @@ the default `<refspec>` by consulting `remote.*.push` configuration,
and if it is not found, honors `push.default` configuration to decide
what to push (See linkgit:git-config[1] for the meaning of `push.default`).
When neither the command-line nor the configuration specify what to
push, the default behavior is used, which corresponds to the `simple`
value for `push.default`: the current branch is pushed to the
corresponding upstream branch, but as a safety measure, the push is
aborted if the upstream branch does not have the same name as the
local one.
OPTIONS[[OPTIONS]]
------------------
@ -257,22 +264,33 @@ origin +master` to force a push to the `master` branch). See the
is specified. This flag forces progress status even if the
standard error stream is not directed to a terminal.
--recurse-submodules=check|on-demand::
Make sure all submodule commits used by the revisions to be
pushed are available on a remote-tracking branch. If 'check' is
used Git will verify that all submodule commits that changed in
the revisions to be pushed are available on at least one remote
of the submodule. If any commits are missing the push will be
aborted and exit with non-zero status. If 'on-demand' is used
all submodules that changed in the revisions to be pushed will
be pushed. If on-demand was not able to push all necessary
revisions it will also be aborted and exit with non-zero status.
--no-recurse-submodules::
--recurse-submodules=check|on-demand|no::
May be used to make sure all submodule commits used by the
revisions to be pushed are available on a remote-tracking branch.
If 'check' is used Git will verify that all submodule commits that
changed in the revisions to be pushed are available on at least one
remote of the submodule. If any commits are missing the push will
be aborted and exit with non-zero status. If 'on-demand' is used
all submodules that changed in the revisions to be pushed will be
pushed. If on-demand was not able to push all necessary revisions
it will also be aborted and exit with non-zero status. A value of
'no' or using '--no-recurse-submodules' can be used to override the
push.recurseSubmodules configuration variable when no submodule
recursion is required.
--[no-]verify::
Toggle the pre-push hook (see linkgit:githooks[5]). The
default is --verify, giving the hook a chance to prevent the
push. With --no-verify, the hook is bypassed completely.
-4::
--ipv4::
Use IPv4 addresses only, ignoring IPv6 addresses.
-6::
--ipv6::
Use IPv6 addresses only, ignoring IPv4 addresses.
include::urls-remotes.txt[]

View File

@ -3,7 +3,7 @@ git-rebase(1)
NAME
----
git-rebase - Forward-port local commits to the updated upstream head
git-rebase - Reapply commits on top of another base tip
SYNOPSIS
--------

View File

@ -133,7 +133,7 @@ By default, the command passes `--delta-base-offset` option to
'git pack-objects'; this typically results in slightly smaller packs,
but the generated packs are incompatible with versions of Git older than
version 1.4.4. If you need to share your repository with such ancient Git
versions, either directly or via the dumb http or rsync protocol, then you
versions, either directly or via the dumb http protocol, then you
need to set the configuration variable `repack.UseDeltaBaseOffset` to
"false" and repack. Access from old Git versions over the native protocol
is unaffected by this option as the conversion is performed on the fly

View File

@ -89,6 +89,7 @@ effect to your index in a row.
-s::
--signoff::
Add Signed-off-by line at the end of the commit message.
See the signoff option in linkgit:git-commit[1] for more information.
--strategy=<strategy>::
Use the given merge strategy. Should only be used once.

View File

@ -1034,6 +1034,8 @@ listed below are allowed:
url = http://server.org/svn
fetch = trunk/project-a:refs/remotes/project-a/trunk
branches = branches/*/project-a:refs/remotes/project-a/branches/*
branches = branches/release_*:refs/remotes/project-a/branches/release_*
branches = branches/re*se:refs/remotes/project-a/branches/*
tags = tags/*/project-a:refs/remotes/project-a/tags/*
------------------------------------------------------------------------
@ -1044,6 +1046,16 @@ independent path component (surrounded by '/' or EOL). This
type of configuration is not automatically created by 'init' and
should be manually entered with a text-editor or using 'git config'.
Also note that only one asterisk is allowed per word. For example:
branches = branches/re*se:refs/remotes/project-a/branches/*
will match branches 'release', 'rese', 're123se', however
branches = branches/re*s*e:refs/remotes/project-a/branches/*
will produce an error.
It is also possible to fetch a subset of branches or tags by using a
comma-separated list of names within braces. For example:

View File

@ -163,7 +163,7 @@ This option is only applicable when listing tags without annotation lines.
A string that interpolates `%(fieldname)` from the object
pointed at by a ref being shown. The format is the same as
that of linkgit:git-for-each-ref[1]. When unspecified,
defaults to `%(refname:short)`.
defaults to `%(refname:strip=2)`.
--[no-]merged [<commit>]::
Only list tags whose tips are reachable, or not reachable

View File

@ -18,7 +18,7 @@ SYNOPSIS
[--[no-]skip-worktree]
[--ignore-submodules]
[--[no-]split-index]
[--[no-|force-]untracked-cache]
[--[no-|test-|force-]untracked-cache]
[--really-refresh] [--unresolve] [--again | -g]
[--info-only] [--index-info]
[-z] [--stdin] [--index-version <n>]
@ -174,17 +174,30 @@ may not support it yet.
--untracked-cache::
--no-untracked-cache::
Enable or disable untracked cache extension. This could speed
up for commands that involve determining untracked files such
as `git status`. The underlying operating system and file
system must change `st_mtime` field of a directory if files
are added or deleted in that directory.
Enable or disable untracked cache feature. Please use
`--test-untracked-cache` before enabling it.
+
These options take effect whatever the value of the `core.untrackedCache`
configuration variable (see linkgit:git-config[1]). But a warning is
emitted when the change goes against the configured value, as the
configured value will take effect next time the index is read and this
will remove the intended effect of the option.
--test-untracked-cache::
Only perform tests on the working directory to make sure
untracked cache can be used. You have to manually enable
untracked cache using `--untracked-cache` or
`--force-untracked-cache` or the `core.untrackedCache`
configuration variable afterwards if you really want to use
it. If a test fails the exit code is 1 and a message
explains what is not working as needed, otherwise the exit
code is 0 and OK is printed.
--force-untracked-cache::
For safety, `--untracked-cache` performs tests on the working
directory to make sure untracked cache can be used. These
tests can take a few seconds. `--force-untracked-cache` can be
used to skip the tests.
Same as `--untracked-cache`. Provided for backwards
compatibility with older versions of Git where
`--untracked-cache` used to imply `--test-untracked-cache` but
this option would enable the extension unconditionally.
\--::
Do not interpret any more arguments as options.
@ -375,6 +388,37 @@ Although this bit looks similar to assume-unchanged bit, its goal is
different from assume-unchanged bit's. Skip-worktree also takes
precedence over assume-unchanged bit when both are set.
Untracked cache
---------------
This cache is meant to speed up commands that involve determining
untracked files such as `git status`.
This feature works by recording the mtime of the working tree
directories and then omitting reading directories and stat calls
against files in those directories whose mtime hasn't changed. For
this to work the underlying operating system and file system must
change the `st_mtime` field of directories if files in the directory
are added, modified or deleted.
You can test whether the filesystem supports that with the
`--test-untracked-cache` option. The `--untracked-cache` option used
to implicitly perform that test in older versions of Git, but that's
no longer the case.
If you want to enable (or disable) this feature, it is easier to use
the `core.untrackedCache` configuration variable (see
linkgit:git-config[1]) than using the `--untracked-cache` option to
`git update-index` in each repository, especially if you want to do so
across all repositories you use, because you can set the configuration
variable to `true` (or `false`) in your `$HOME/.gitconfig` just once
and have it affect all repositories you touch.
When the `core.untrackedCache` configuration variable is changed, the
untracked cache is added to or removed from the index the next time a
command reads the index; while when `--[no-|force-]untracked-cache`
are used, the untracked cache is immediately added to or removed from
the index.
Configuration
-------------
@ -400,6 +444,9 @@ It can be useful when the inode change time is regularly modified by
something outside Git (file system crawlers and backup systems use
ctime for marking files processed) (see linkgit:git-config[1]).
The untracked cache extension can be enabled by the
`core.untrackedCache` configuration variable (see
linkgit:git-config[1]).
SEE ALSO
--------

View File

@ -32,11 +32,9 @@ The working tree's administrative files in the repository (see
`git worktree prune` in the main or any linked working tree to
clean up any stale administrative files.
If you move a linked working tree to another file system, or
within a file system that does not support hard links, you need to run
at least one git command inside the linked working tree
(e.g. `git status`) in order to update its administrative files in the
repository so that they do not get automatically pruned.
If you move a linked working tree, you need to manually update the
administrative files so that they do not get pruned automatically. See
section "DETAILS" for more information.
If a linked working tree is stored on a portable device or network share
which is not always mounted, you can prevent its administrative files from
@ -137,6 +135,13 @@ thumb is do not make any assumption about whether a path belongs to
$GIT_DIR or $GIT_COMMON_DIR when you need to directly access something
inside $GIT_DIR. Use `git rev-parse --git-path` to get the final path.
If you move a linked working tree, you need to update the 'gitdir' file
in the entry's directory. For example, if a linked working tree is moved
to `/newpath/test-next` and its `.git` file points to
`/path/main/.git/worktrees/test-next`, then update
`/path/main/.git/worktrees/test-next/gitdir` to reference `/newpath/test-next`
instead.
To prevent a $GIT_DIR/worktrees entry from being pruned (which
can be useful in some situations, such as when the
entry's working tree is stored on a portable device), add a file named

View File

@ -43,27 +43,44 @@ unreleased) version of Git, that is available from the 'master'
branch of the `git.git` repository.
Documentation for older releases are available here:
* link:v2.6.4/git.html[documentation for release 2.6.4]
* link:v2.8.0/git.html[documentation for release 2.8]
* release notes for
link:RelNotes/2.8.0.txt[2.8].
* link:v2.7.3/git.html[documentation for release 2.7.3]
* release notes for
link:RelNotes/2.7.3.txt[2.7.3],
link:RelNotes/2.7.2.txt[2.7.2],
link:RelNotes/2.7.1.txt[2.7.1],
link:RelNotes/2.7.0.txt[2.7].
* link:v2.6.6/git.html[documentation for release 2.6.6]
* release notes for
link:RelNotes/2.6.6.txt[2.6.6],
link:RelNotes/2.6.5.txt[2.6.5],
link:RelNotes/2.6.4.txt[2.6.4],
link:RelNotes/2.6.3.txt[2.6.3],
link:RelNotes/2.6.2.txt[2.6.2],
link:RelNotes/2.6.1.txt[2.6.1],
link:RelNotes/2.6.0.txt[2.6].
* link:v2.5.4/git.html[documentation for release 2.5.4]
* link:v2.5.5/git.html[documentation for release 2.5.5]
* release notes for
link:RelNotes/2.5.5.txt[2.5.5],
link:RelNotes/2.5.4.txt[2.5.4],
link:RelNotes/2.5.3.txt[2.5.3],
link:RelNotes/2.5.2.txt[2.5.2],
link:RelNotes/2.5.1.txt[2.5.1],
link:RelNotes/2.5.0.txt[2.5].
* link:v2.4.10/git.html[documentation for release 2.4.10]
* link:v2.4.11/git.html[documentation for release 2.4.11]
* release notes for
link:RelNotes/2.4.11.txt[2.4.11],
link:RelNotes/2.4.10.txt[2.4.10],
link:RelNotes/2.4.9.txt[2.4.9],
link:RelNotes/2.4.8.txt[2.4.8],
@ -1115,9 +1132,7 @@ of clones and fetches.
connection (or proxy, if configured)
- `ssh`: git over ssh (including `host:path` syntax,
`git+ssh://`, etc).
- `rsync`: git over rsync
`ssh://`, etc).
- `http`: git over http, both "smart http" and "dumb http".
Note that this does _not_ include `https`; if you want both,

View File

@ -710,7 +710,7 @@ files).
Again, this can all be simplified with
----------------
$ git clone rsync://rsync.kernel.org/pub/scm/git/git.git/ my-git
$ git clone git://git.kernel.org/pub/scm/git/git.git/ my-git
$ cd my-git
$ git checkout
----------------
@ -1011,20 +1011,6 @@ $ git fetch <remote-repository>
One of the following transports can be used to name the
repository to download from:
Rsync::
`rsync://remote.machine/path/to/repo.git/`
+
Rsync transport is usable for both uploading and downloading,
but is completely unaware of what git does, and can produce
unexpected results when you download from the public repository
while the repository owner is uploading into it via `rsync`
transport. Most notably, it could update the files under
`refs/` which holds the object name of the topmost commits
before uploading the files in `objects/` -- the downloader would
obtain head commit object name while that object itself is still
not available in the repository. For this reason, it is
considered deprecated.
SSH::
`remote.machine:/path/to/repo.git/` or
+
@ -1430,7 +1416,7 @@ while, depending on how active your project is.
When a repository is synchronized via `git push` and `git pull`
objects packed in the source repository are usually stored
unpacked in the destination, unless rsync transport is used.
unpacked in the destination.
While this allows you to use different packing strategies on
both ends, it also means you may need to repack both
repositories every once in a while.

View File

@ -397,7 +397,7 @@ preceding SP is also omitted. Currently, no commands pass any
'extra-info'.
The hook always runs after the automatic note copying (see
"notes.rewrite.<command>" in linkgit:git-config.txt[1]) has happened, and
"notes.rewrite.<command>" in linkgit:git-config[1]) has happened, and
thus has access to these notes.
The following command-specific comments apply:

View File

@ -82,12 +82,12 @@ PATTERN FORMAT
- An optional prefix "`!`" which negates the pattern; any
matching file excluded by a previous pattern will become
included again.
included again. It is not possible to re-include a file if a parent
directory of that file is excluded. Git doesn't list excluded
directories for performance reasons, so any patterns on contained
files have no effect, no matter where they are defined.
Put a backslash ("`\`") in front of the first "`!`" for patterns
that begin with a literal "`!`", for example, "`\!important!.txt`".
It is possible to re-include a file if a parent directory of that
file is excluded if certain conditions are met. See section NOTES
for detail.
- If the pattern ends with a slash, it is removed for the
purpose of the following description, but it would only find
@ -141,21 +141,6 @@ not tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
'git rm --cached'.
To re-include files or directories when their parent directory is
excluded, the following conditions must be met:
- The rules to exclude a directory and re-include a subset back must
be in the same .gitignore file.
- The directory part in the re-include rules must be literal (i.e. no
wildcards)
- The rules to exclude the parent directory must not end with a
trailing slash.
- The rules to exclude the parent directory must have at least one
slash.
EXAMPLES
--------

View File

@ -451,7 +451,7 @@ perform clones and pulls using the ssh protocol:
bob$ git clone alice.org:/home/alice/project myrepo
-------------------------------------
Alternatively, Git has a native protocol, or can use rsync or http;
Alternatively, Git has a native protocol, or can use http;
see linkgit:git-pull[1] for details.
Git can also be used in a CVS-like mode, with a central repository

View File

@ -531,6 +531,11 @@ The most notable example is `HEAD`.
"Secure Hash Algorithm 1"; a cryptographic hash function.
In the context of Git used as a synonym for <<def_object_name,object name>>.
[[def_shallow_clone]]shallow clone::
Mostly a synonym to <<def_shallow_repository,shallow repository>>
but the phrase makes it more explicit that it was created by
running `git clone --depth=...` command.
[[def_shallow_repository]]shallow repository::
A shallow <<def_repository,repository>> has an incomplete
history some of whose <<def_commit,commits>> have <<def_parent,parents>> cauterized away (in other

View File

@ -81,9 +81,17 @@ no-renormalize;;
Disables the `renormalize` option. This overrides the
`merge.renormalize` configuration variable.
no-renames;;
Turn off rename detection.
See also linkgit:git-diff[1] `--no-renames`.
find-renames[=<n>];;
Turn on rename detection, optionally setting the similarity
threshold. This is the default.
See also linkgit:git-diff[1] `--find-renames`.
rename-threshold=<n>;;
Controls the similarity threshold used for rename detection.
See also linkgit:git-diff[1] `-M`.
Deprecated synonym for `find-renames=<n>`.
subtree[=<path>];;
This option is a more advanced form of 'subtree' strategy, where

View File

@ -43,7 +43,7 @@ people using 80-column terminals.
commit may be copied to the output.
ifndef::git-rev-list[]
--notes[=<ref>]::
--notes[=<treeish>]::
Show the notes (see linkgit:git-notes[1]) that annotate the
commit, when showing the commit log message. This is the default
for `git log`, `git show` and `git whatchanged` commands when
@ -54,8 +54,8 @@ By default, the notes shown are from the notes refs listed in the
'core.notesRef' and 'notes.displayRef' variables (or corresponding
environment overrides). See linkgit:git-config[1] for more details.
+
With an optional '<ref>' argument, show this notes ref instead of the
default notes ref(s). The ref specifies the full refname when it begins
With an optional '<treeish>' argument, use the treeish to find the notes
to display. The treeish can specify the full refname when it begins
with `refs/notes/`; when it begins with `notes/`, `refs/` and otherwise
`refs/notes/` is prefixed to form a full name of the ref.
+
@ -71,7 +71,7 @@ being displayed. Examples: "--notes=foo" will show only notes from
"--notes --notes=foo --no-notes --notes=bar" will only show notes
from "refs/notes/bar".
--show-notes[=<ref>]::
--show-notes[=<treeish>]::
--[no-]standard-notes::
These options are deprecated. Use the above --notes/--no-notes
options instead.

View File

@ -61,11 +61,11 @@ some output processing may assume ref names in UTF-8.
'@'::
'@' alone is a shortcut for 'HEAD'.
'<refname>@\{<date>\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes ago\}'::
'<refname>@{<date>}', e.g. 'master@\{yesterday\}', 'HEAD@{5 minutes ago}'::
A ref followed by the suffix '@' with a date specification
enclosed in a brace
pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1
second ago\}' or '\{1979-02-26 18:30:00\}') specifies the value
pair (e.g. '\{yesterday\}', '{1 month 2 weeks 3 days 1 hour 1
second ago}' or '{1979-02-26 18:30:00}') specifies the value
of the ref at a prior point in time. This suffix may only be
used immediately following a ref name and the ref must have an
existing log ('$GIT_DIR/logs/<ref>'). Note that this looks up the state
@ -73,7 +73,7 @@ some output processing may assume ref names in UTF-8.
'master' branch last week. If you want to look at commits made during
certain times, see '--since' and '--until'.
'<refname>@\{<n>\}', e.g. 'master@\{1\}'::
'<refname>@{<n>}', e.g. 'master@\{1\}'::
A ref followed by the suffix '@' with an ordinal specification
enclosed in a brace pair (e.g. '\{1\}', '\{15\}') specifies
the n-th prior value of that ref. For example 'master@\{1\}'
@ -82,13 +82,13 @@ some output processing may assume ref names in UTF-8.
immediately following a ref name and the ref must have an existing
log ('$GIT_DIR/logs/<refname>').
'@\{<n>\}', e.g. '@\{1\}'::
'@{<n>}', e.g. '@\{1\}'::
You can use the '@' construct with an empty ref part to get at a
reflog entry of the current branch. For example, if you are on
branch 'blabla' then '@\{1\}' means the same as 'blabla@\{1\}'.
'@\{-<n>\}', e.g. '@\{-1\}'::
The construct '@\{-<n>\}' means the <n>th branch/commit checked out
'@{-<n>}', e.g. '@{-1}'::
The construct '@{-<n>}' means the <n>th branch/commit checked out
before the current one.
'<branchname>@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
@ -139,7 +139,7 @@ from one location and push to another. In a non-triangular workflow,
'<rev>{caret}1{caret}1{caret}1'. See below for an illustration of
the usage of this form.
'<rev>{caret}\{<type>\}', e.g. 'v0.99.8{caret}\{commit\}'::
'<rev>{caret}{<type>}', e.g. 'v0.99.8{caret}\{commit\}'::
A suffix '{caret}' followed by an object type name enclosed in
brace pair means dereference the object at '<rev>' recursively until
an object of type '<type>' is found or the object cannot be
@ -159,13 +159,13 @@ it does not have to be dereferenced even once to get to an object.
'rev{caret}\{tag\}' can be used to ensure that 'rev' identifies an
existing tag object.
'<rev>{caret}\{\}', e.g. 'v0.99.8{caret}\{\}'::
'<rev>{caret}{}', e.g. 'v0.99.8{caret}{}'::
A suffix '{caret}' followed by an empty brace pair
means the object could be a tag,
and dereference the tag recursively until a non-tag object is
found.
'<rev>{caret}\{/<text>\}', e.g. 'HEAD^{/fix nasty bug}'::
'<rev>{caret}{/<text>}', e.g. 'HEAD^{/fix nasty bug}'::
A suffix '{caret}' to a revision parameter, followed by a brace
pair that contains a text led by a slash,
is the same as the ':/fix nasty bug' syntax below except that
@ -176,11 +176,12 @@ existing tag object.
A colon, followed by a slash, followed by a text, names
a commit whose commit message matches the specified regular expression.
This name returns the youngest matching commit which is
reachable from any ref. If the commit message starts with a
'!' you have to repeat that; the special sequence ':/!',
followed by something else than '!', is reserved for now.
The regular expression can match any part of the commit message. To
match messages starting with a string, one can use e.g. ':/^foo'.
reachable from any ref. The regular expression can match any part of the
commit message. To match messages starting with a string, one can use
e.g. ':/^foo'. The special sequence ':/!' is reserved for modifiers to what
is matched. ':/!-foo' performs a negative match, while ':/!!foo' matches a
literal '!' character, followed by 'foo'. Any other sequence beginning with
':/!' is reserved for now.
'<rev>:<path>', e.g. 'HEAD:README', ':README', 'master:./README'::
A suffix ':' followed by a path names the blob or tree

View File

@ -56,3 +56,10 @@ Functions
`argv_array_clear`::
Free all memory associated with the array and return it to the
initial, empty state.
`argv_array_detach`::
Disconnect the `argv` member from the `argv_array` struct and
return it. The caller is responsible for freeing the memory used
by the array, and by the strings it references. After detaching,
the `argv_array` is in a reinitialized state and can be pushed
into again.

View File

@ -51,6 +51,10 @@ struct remote
The proxy to use for curl (http, https, ftp, etc.) URLs.
`http_proxy_authmethod`::
The method used for authenticating against `http_proxy`.
struct remotes can be found by name with remote_get(), and iterated
through with for_each_remote(). remote_get(NULL) will return the
default remote, given the current branch and configuration.

View File

@ -7,9 +7,8 @@ Depending on the transport protocol, some of this information may be
absent.
Git supports ssh, git, http, and https protocols (in addition, ftp,
and ftps can be used for fetching and rsync can be used for fetching
and pushing, but these are inefficient and deprecated; do not use
them).
and ftps can be used for fetching, but this is inefficient and
deprecated; do not use it).
The native transport (i.e. git:// URL) does no authentication and
should be used with caution on unsecured networks.
@ -20,7 +19,6 @@ The following syntaxes may be used with them:
- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
- rsync://host.xz/path/to/repo.git/
An alternative scp-like syntax may also be used with the ssh protocol:

View File

@ -2125,8 +2125,37 @@ Allowing web browsing of a repository
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The gitweb cgi script provides users an easy way to browse your
project's files and history without having to install Git; see the file
gitweb/INSTALL in the Git source tree for instructions on setting it up.
project's revisions, file contents and logs without having to install
Git. Features like RSS/Atom feeds and blame/annotation details may
optionally be enabled.
The linkgit:git-instaweb[1] command provides a simple way to start
browsing the repository using gitweb. The default server when using
instaweb is lighttpd.
See the file gitweb/INSTALL in the Git source tree and
linkgit:gitweb[1] for instructions on details setting up a permanent
installation with a CGI or Perl capable server.
[[how-to-get-a-git-repository-with-minimal-history]]
How to get a Git repository with minimal history
------------------------------------------------
A <<def_shallow_clone,shallow clone>>, with its truncated
history, is useful when one is interested only in recent history
of a project and getting full history from the upstream is
expensive.
A <<def_shallow_clone,shallow clone>> is created by specifying
the linkgit:git-clone[1] `--depth` switch. The depth can later be
changed with the linkgit:git-fetch[1] `--depth` switch, or full
history restored with `--unshallow`.
Merging inside a <<def_shallow_clone,shallow clone>> will work as long
as a merge base is in the recent history.
Otherwise, it will be like merging unrelated histories and may
have to result in huge conflicts. This limitation may make such
a repository unsuitable to be used in merge based workflows.
[[sharing-development-examples]]
Examples
@ -4636,23 +4665,15 @@ Scan email archives for other stuff left out
Scan man pages to see if any assume more background than this manual
provides.
Simplify beginning by suggesting disconnected head instead of
temporary branch creation?
Add more good examples. Entire sections of just cookbook examples
might be a good idea; maybe make an "advanced examples" section a
standard end-of-chapter section?
Include cross-references to the glossary, where appropriate.
Document shallow clones? See draft 1.5.0 release notes for some
documentation.
Add a section on working with other version control systems, including
CVS, Subversion, and just imports of series of release tarballs.
More details on gitweb?
Write a chapter on using plumbing and writing scripts.
Alternates, clone -reference, etc.

View File

@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v2.7.0-rc0
DEF_VER=v2.8.0
LF='
'

View File

@ -264,6 +264,9 @@ all::
#
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
# and egrep that are pickier when their input contains non-ASCII data.
#
# The TCL_PATH variable governs the location of the Tcl interpreter
# used to optimize git-gui for your system. Only used if NO_TCLTK
# is not set. Defaults to the bare 'tclsh'.
@ -380,6 +383,18 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
ifdef DEVELOPER
CFLAGS += -Werror \
-Wdeclaration-after-statement \
-Wno-format-zero-length \
-Wold-style-definition \
-Woverflow \
-Wpointer-arith \
-Wstrict-prototypes \
-Wunused \
-Wvla
endif
# Create as necessary, replace existing, make ranlib unneeded.
ARFLAGS = rcs
@ -583,6 +598,7 @@ TEST_PROGRAMS_NEED_X += test-delta
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
TEST_PROGRAMS_NEED_X += test-dump-split-index
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-genrandom
TEST_PROGRAMS_NEED_X += test-hashmap
TEST_PROGRAMS_NEED_X += test-index-version
@ -1727,7 +1743,7 @@ common-cmds.h: $(wildcard Documentation/git-*.txt)
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
$(gitwebdir_SQ):$(PERL_PATH_SQ)
$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP)
define cmd_munge_script
$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
@ -1739,6 +1755,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e $(BROKEN_PATH_FIX) \
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
$@.sh >$@+
endef
@ -2025,6 +2042,7 @@ $(VCSSVN_LIB): $(VCSSVN_OBJS)
export DEFAULT_EDITOR DEFAULT_PAGER
.PHONY: doc man html info pdf
doc:
$(MAKE) -C Documentation all
@ -2068,6 +2086,7 @@ po/git.pot: $(GENERATED_H) FORCE
$(LOCALIZED_PERL)
mv $@+ $@
.PHONY: pot
pot: po/git.pot
POFILES := $(wildcard po/*.po)
@ -2277,6 +2296,7 @@ mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
.PHONY: profile-install profile-fast-install
profile-install: profile
$(MAKE) install
@ -2343,6 +2363,8 @@ endif
done && \
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
.PHONY: install-gitweb install-doc install-man install-html install-info install-pdf
.PHONY: quick-install-doc quick-install-man quick-install-html
install-gitweb:
$(MAKE) -C gitweb install
@ -2402,6 +2424,7 @@ rpm: dist
htmldocs = git-htmldocs-$(GIT_VERSION)
manpages = git-manpages-$(GIT_VERSION)
.PHONY: dist-doc distclean
dist-doc:
$(RM) -r .doc-tmp-dir
mkdir .doc-tmp-dir
@ -2470,6 +2493,8 @@ ALL_COMMANDS += git
ALL_COMMANDS += gitk
ALL_COMMANDS += gitweb
ALL_COMMANDS += git-gui git-citool
.PHONY: check-docs
check-docs::
@(for v in $(ALL_COMMANDS); \
do \
@ -2514,6 +2539,7 @@ check-builtins::
### Test suite coverage testing
#
.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
.PHONY: coverage-untested-functions cover_db cover_db_html
.PHONY: coverage-clean-results
coverage:

View File

@ -1,19 +1,5 @@
////////////////////////////////////////////////////////////////
Git - the stupid content tracker
////////////////////////////////////////////////////////////////
"git" can mean anything, depending on your mood.
- random three-letter combination that is pronounceable, and not
actually used by any common UNIX command. The fact that it is a
mispronunciation of "get" may or may not be relevant.
- stupid. contemptible and despicable. simple. Take your pick from the
dictionary of slang.
- "global information tracker": you're in a good mood, and it actually
works for you. Angels sing, and a light suddenly fills the room.
- "goddamn idiotic truckload of sh*t": when it breaks
Git - fast, scalable, distributed revision control system
=========================================================
Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations
@ -24,27 +10,27 @@ License version 2 (some parts of it are under different licenses,
compatible with the GPLv2). It was originally written by Linus
Torvalds with help of a group of hackers around the net.
Please read the file INSTALL for installation instructions.
Please read the file [INSTALL][] for installation instructions.
See Documentation/gittutorial.txt to get started, then see
Documentation/giteveryday.txt for a useful minimum set of commands, and
Documentation/git-commandname.txt for documentation of each command.
Many Git online resources are accessible from http://git-scm.com/
including full documentation and Git related tools.
See [Documentation/gittutorial.txt][] to get started, then see
[Documentation/giteveryday.txt][] for a useful minimum set of commands, and
[Documentation/git-commandname.txt][] for documentation of each command.
If git has been correctly installed, then the tutorial can also be
read with "man gittutorial" or "git help tutorial", and the
documentation of each command with "man git-commandname" or "git help
commandname".
CVS users may also want to read Documentation/gitcvs-migration.txt
CVS users may also want to read [Documentation/gitcvs-migration.txt][]
("man gitcvs-migration" or "git help cvs-migration" if git is
installed).
Many Git online resources are accessible from http://git-scm.com/
including full documentation and Git related tools.
The user discussion and development of Git take place on the Git
mailing list -- everyone is welcome to post bug reports, feature
requests, comments and patches to git@vger.kernel.org (read
Documentation/SubmittingPatches for instructions on patch submission).
[Documentation/SubmittingPatches][] for instructions on patch submission).
To subscribe to the list, send an email with just "subscribe git" in
the body to majordomo@vger.kernel.org. The mailing list archives are
available at http://news.gmane.org/gmane.comp.version-control.git/,
@ -54,3 +40,23 @@ The maintainer frequently sends the "What's cooking" reports that
list the current status of various development topics to the mailing
list. The discussion following them give a good reference for
project status, development direction and remaining tasks.
The name "git" was given by Linus Torvalds when he wrote the very
first version. He described the tool as "the stupid content tracker"
and the name as (depending on your mood):
- random three-letter combination that is pronounceable, and not
actually used by any common UNIX command. The fact that it is a
mispronunciation of "get" may or may not be relevant.
- stupid. contemptible and despicable. simple. Take your pick from the
dictionary of slang.
- "global information tracker": you're in a good mood, and it actually
works for you. Angels sing, and a light suddenly fills the room.
- "goddamn idiotic truckload of sh*t": when it breaks
[INSTALL]: INSTALL
[Documentation/gittutorial.txt]: Documentation/gittutorial.txt
[Documentation/giteveryday.txt]: Documentation/giteveryday.txt
[Documentation/git-commandname.txt]: Documentation/git-commandname.txt
[Documentation/gitcvs-migration.txt]: Documentation/gitcvs-migration.txt
[Documentation/SubmittingPatches]: Documentation/SubmittingPatches

View File

@ -1 +1 @@
Documentation/RelNotes/2.7.0.txt
Documentation/RelNotes/2.8.0.txt

View File

@ -23,7 +23,7 @@ int split_cmdline(char *cmdline, const char ***argv)
int src, dst, count = 0, size = 16;
char quoted = 0;
*argv = xmalloc(sizeof(**argv) * size);
ALLOC_ARRAY(*argv, size);
/* split alias_string */
(*argv)[count++] = cmdline;

View File

@ -171,8 +171,8 @@ static void queue_directory(const unsigned char *sha1,
unsigned mode, int stage, struct archiver_context *c)
{
struct directory *d;
size_t len = base->len + 1 + strlen(filename) + 1;
d = xmalloc(sizeof(*d) + len);
size_t len = st_add4(base->len, 1, strlen(filename), 1);
d = xmalloc(st_add(sizeof(*d), len));
d->up = c->bottom;
d->baselen = base->len;
d->mode = mode;

View File

@ -74,3 +74,14 @@ void argv_array_clear(struct argv_array *array)
}
argv_array_init(array);
}
const char **argv_array_detach(struct argv_array *array)
{
if (array->argv == empty_argv)
return xcalloc(1, sizeof(const char *));
else {
const char **ret = array->argv;
argv_array_init(array);
return ret;
}
}

View File

@ -20,5 +20,6 @@ void argv_array_pushl(struct argv_array *, ...);
void argv_array_pushv(struct argv_array *, const char **);
void argv_array_pop(struct argv_array *);
void argv_array_clear(struct argv_array *);
const char **argv_array_detach(struct argv_array *);
#endif /* ARGV_ARRAY_H */

6
attr.c
View File

@ -93,9 +93,7 @@ static struct git_attr *git_attr_internal(const char *name, int len)
if (invalid_attr_name(name, len))
return NULL;
a = xmalloc(sizeof(*a) + len + 1);
memcpy(a->name, name, len);
a->name[len] = 0;
FLEX_ALLOC_MEM(a, name, name, len);
a->h = hval;
a->next = git_attr_hash[pos];
a->attr_nr = attr_nr++;
@ -799,7 +797,7 @@ int git_all_attrs(const char *path, int *num, struct git_attr_check **check)
++count;
}
*num = count;
*check = xmalloc(sizeof(**check) * count);
ALLOC_ARRAY(*check, count);
j = 0;
for (i = 0; i < attr_nr; i++) {
const char *value = check_all_attr[i].value;

View File

@ -440,7 +440,7 @@ static void read_bisect_paths(struct argv_array *array)
if (!fp)
die_errno("Could not open file '%s'", filename);
while (strbuf_getline(&str, fp, '\n') != EOF) {
while (strbuf_getline_lf(&str, fp) != EOF) {
strbuf_trim(&str);
if (sq_dequote_to_argv_array(str.buf, array))
die("Badly quoted content in file '%s': %s",
@ -668,7 +668,7 @@ static int is_expected_rev(const struct object_id *oid)
if (!fp)
return 0;
if (strbuf_getline(&str, fp, '\n') != EOF)
if (strbuf_getline_lf(&str, fp) != EOF)
res = !strcmp(str.buf, oid_to_hex(oid));
strbuf_release(&str);
@ -708,10 +708,10 @@ static struct commit *get_commit_reference(const unsigned char *sha1)
static struct commit **get_bad_and_good_commits(int *rev_nr)
{
int len = 1 + good_revs.nr;
struct commit **rev = xmalloc(len * sizeof(*rev));
struct commit **rev;
int i, n = 0;
ALLOC_ARRAY(rev, 1 + good_revs.nr);
rev[n++] = get_commit_reference(current_bad_oid->hash);
for (i = 0; i < good_revs.nr; i++)
rev[n++] = get_commit_reference(good_revs.sha1[i]);
@ -914,9 +914,9 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
strerror(errno));
}
} else {
strbuf_getline(&str, fp, '\n');
strbuf_getline_lf(&str, fp);
*read_bad = strbuf_detach(&str, NULL);
strbuf_getline(&str, fp, '\n');
strbuf_getline_lf(&str, fp);
*read_good = strbuf_detach(&str, NULL);
}
strbuf_release(&str);

View File

@ -49,7 +49,13 @@ static int should_setup_rebase(const char *origin)
return 0;
}
void install_branch_config(int flag, const char *local, const char *origin, const char *remote)
static const char tracking_advice[] =
N_("\n"
"After fixing the error cause you may try to fix up\n"
"the remote tracking information by invoking\n"
"\"git branch --set-upstream-to=%s%s%s\".");
int install_branch_config(int flag, const char *local, const char *origin, const char *remote)
{
const char *shortname = NULL;
struct strbuf key = STRBUF_INIT;
@ -60,20 +66,23 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
&& !origin) {
warning(_("Not setting branch %s as its own upstream."),
local);
return;
return 0;
}
strbuf_addf(&key, "branch.%s.remote", local);
git_config_set(key.buf, origin ? origin : ".");
if (git_config_set_gently(key.buf, origin ? origin : ".") < 0)
goto out_err;
strbuf_reset(&key);
strbuf_addf(&key, "branch.%s.merge", local);
git_config_set(key.buf, remote);
if (git_config_set_gently(key.buf, remote) < 0)
goto out_err;
if (rebasing) {
strbuf_reset(&key);
strbuf_addf(&key, "branch.%s.rebase", local);
git_config_set(key.buf, "true");
if (git_config_set_gently(key.buf, "true") < 0)
goto out_err;
}
strbuf_release(&key);
@ -102,6 +111,19 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
local, remote);
}
}
return 0;
out_err:
strbuf_release(&key);
error(_("Unable to write upstream branch configuration"));
advise(_(tracking_advice),
origin ? origin : "",
origin ? "/" : "",
shortname ? shortname : remote);
return -1;
}
/*
@ -109,8 +131,8 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
* to infer the settings for branch.<new_ref>.{remote,merge} from the
* config.
*/
static int setup_tracking(const char *new_ref, const char *orig_ref,
enum branch_track track, int quiet)
static void setup_tracking(const char *new_ref, const char *orig_ref,
enum branch_track track, int quiet)
{
struct tracking tracking;
int config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;
@ -118,7 +140,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,
memset(&tracking, 0, sizeof(tracking));
tracking.spec.dst = (char *)orig_ref;
if (for_each_remote(find_tracked_branch, &tracking))
return 1;
return;
if (!tracking.matches)
switch (track) {
@ -127,18 +149,18 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,
case BRANCH_TRACK_OVERRIDE:
break;
default:
return 1;
return;
}
if (tracking.matches > 1)
return error(_("Not tracking: ambiguous information for ref %s"),
orig_ref);
die(_("Not tracking: ambiguous information for ref %s"),
orig_ref);
install_branch_config(config_flags, new_ref, tracking.remote,
tracking.src ? tracking.src : orig_ref);
if (install_branch_config(config_flags, new_ref, tracking.remote,
tracking.src ? tracking.src : orig_ref) < 0)
exit(-1);
free(tracking.src);
return 0;
}
int read_branch_desc(struct strbuf *buf, const char *branch_name)

View File

@ -43,9 +43,10 @@ void remove_branch_state(void);
/*
* Configure local branch "local" as downstream to branch "remote"
* from remote "origin". Used by git branch --set-upstream.
* Returns 0 on success.
*/
#define BRANCH_CONFIG_VERBOSE 01
extern void install_branch_config(int flag, const char *local, const char *origin, const char *remote);
extern int install_branch_config(int flag, const char *local, const char *origin, const char *remote);
/*
* Read branch description

View File

@ -45,21 +45,6 @@ static int is_empty_file(const char *filename)
return !st.st_size;
}
/**
* Like strbuf_getline(), but treats both '\n' and "\r\n" as line terminators.
*/
static int strbuf_getline_crlf(struct strbuf *sb, FILE *fp)
{
if (strbuf_getwholeline(sb, fp, '\n'))
return EOF;
if (sb->buf[sb->len - 1] == '\n') {
strbuf_setlen(sb, sb->len - 1);
if (sb->len > 0 && sb->buf[sb->len - 1] == '\r')
strbuf_setlen(sb, sb->len - 1);
}
return 0;
}
/**
* Returns the length of the first line of msg.
*/
@ -284,7 +269,7 @@ static char *read_shell_var(FILE *fp, const char *key)
struct strbuf sb = STRBUF_INIT;
const char *str;
if (strbuf_getline(&sb, fp, '\n'))
if (strbuf_getline_lf(&sb, fp))
goto fail;
if (!skip_prefix(sb.buf, key, &str))
@ -573,7 +558,7 @@ static int copy_notes_for_rebase(const struct am_state *state)
fp = xfopen(am_path(state, "rewritten"), "r");
while (!strbuf_getline(&sb, fp, '\n')) {
while (!strbuf_getline_lf(&sb, fp)) {
unsigned char from_obj[GIT_SHA1_RAWSZ], to_obj[GIT_SHA1_RAWSZ];
if (sb.len != GIT_SHA1_HEXSZ * 2 + 1) {
@ -628,7 +613,7 @@ static int is_mail(FILE *fp)
if (regcomp(&regex, header_regex, REG_NOSUB | REG_EXTENDED))
die("invalid pattern: %s", header_regex);
while (!strbuf_getline_crlf(&sb, fp)) {
while (!strbuf_getline(&sb, fp)) {
if (!sb.len)
break; /* End of header */
@ -675,7 +660,7 @@ static int detect_patch_format(const char **paths)
fp = xfopen(*paths, "r");
while (!strbuf_getline_crlf(&l1, fp)) {
while (!strbuf_getline(&l1, fp)) {
if (l1.len)
break;
}
@ -696,9 +681,9 @@ static int detect_patch_format(const char **paths)
}
strbuf_reset(&l2);
strbuf_getline_crlf(&l2, fp);
strbuf_getline(&l2, fp);
strbuf_reset(&l3);
strbuf_getline_crlf(&l3, fp);
strbuf_getline(&l3, fp);
/*
* If the second line is empty and the third is a From, Author or Date
@ -817,7 +802,7 @@ static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr)
struct strbuf sb = STRBUF_INIT;
int subject_printed = 0;
while (!strbuf_getline(&sb, in, '\n')) {
while (!strbuf_getline_lf(&sb, in)) {
const char *str;
if (str_isspace(sb.buf))
@ -875,7 +860,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
return error(_("could not open '%s' for reading: %s"), *paths,
strerror(errno));
while (!strbuf_getline(&sb, fp, '\n')) {
while (!strbuf_getline_lf(&sb, fp)) {
if (*sb.buf == '#')
continue; /* skip comment lines */
@ -900,7 +885,7 @@ static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr)
{
struct strbuf sb = STRBUF_INIT;
while (!strbuf_getline(&sb, in, '\n')) {
while (!strbuf_getline_lf(&sb, in)) {
const char *str;
if (skip_prefix(sb.buf, "# User ", &str))
@ -1317,7 +1302,7 @@ static int parse_mail(struct am_state *state, const char *mail)
/* Extract message and author information */
fp = xfopen(am_path(state, "info"), "r");
while (!strbuf_getline(&sb, fp, '\n')) {
while (!strbuf_getline_lf(&sb, fp)) {
const char *x;
if (skip_prefix(sb.buf, "Subject: ", &x)) {
@ -1383,7 +1368,7 @@ static int get_mail_commit_sha1(unsigned char *commit_id, const char *mail)
FILE *fp = xfopen(mail, "r");
const char *x;
if (strbuf_getline(&sb, fp, '\n'))
if (strbuf_getline_lf(&sb, fp))
return -1;
if (!skip_prefix(sb.buf, "From ", &x))
@ -1657,7 +1642,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
init_revisions(&rev_info, NULL);
rev_info.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1);
diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1, rev_info.prefix);
add_pending_sha1(&rev_info, "HEAD", our_tree, 0);
diff_setup_done(&rev_info.diffopt);
run_diff_index(&rev_info, 1);
@ -1821,7 +1806,7 @@ static int do_interactive(struct am_state *state)
if (!pager)
pager = "cat";
argv_array_push(&cp.args, pager);
prepare_pager_args(&cp, pager);
argv_array_push(&cp.args, am_path(state, "patch"));
run_command(&cp);
}
@ -1939,6 +1924,7 @@ next:
*/
if (!state->rebasing) {
am_destroy(state);
close_all_packs();
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
}
}

View File

@ -2632,7 +2632,7 @@ static void update_image(struct image *img,
insert_count = postimage->len;
/* Adjust the contents */
result = xmalloc(img->len + insert_count - remove_count + 1);
result = xmalloc(st_add3(st_sub(img->len, remove_count), insert_count, 1));
memcpy(result, img->buf, applied_at);
memcpy(result + applied_at, postimage->buf, postimage->len);
memcpy(result + applied_at + postimage->len,
@ -4464,16 +4464,6 @@ static int option_parse_p(const struct option *opt,
return 0;
}
static int option_parse_z(const struct option *opt,
const char *arg, int unset)
{
if (unset)
line_termination = '\n';
else
line_termination = 0;
return 0;
}
static int option_parse_space_change(const struct option *opt,
const char *arg, int unset)
{
@ -4546,9 +4536,9 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
N_( "attempt three-way merge if a patch does not apply")),
OPT_FILENAME(0, "build-fake-ancestor", &fake_ancestor,
N_("build a temporary index based on embedded index information")),
{ OPTION_CALLBACK, 'z', NULL, NULL, NULL,
N_("paths are separated with NUL character"),
PARSE_OPT_NOARG, option_parse_z },
/* Think twice before adding "--nul" synonym to this */
OPT_SET_INT('z', NULL, &line_termination,
N_("paths are separated with NUL character"), '\0'),
OPT_INTEGER('C', NULL, &p_context,
N_("ensure at least <n> lines of context match")),
{ OPTION_CALLBACK, 0, "whitespace", &whitespace_option, N_("action"),

View File

@ -28,6 +28,7 @@
#include "line-range.h"
#include "line-log.h"
#include "dir.h"
#include "progress.h"
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
@ -50,6 +51,7 @@ static int incremental;
static int xdl_opts;
static int abbrev = -1;
static int no_whole_file_rename;
static int show_progress;
static struct date_mode blame_date_mode = { DATE_ISO8601 };
static size_t blame_date_width;
@ -127,6 +129,11 @@ struct origin {
char path[FLEX_ARRAY];
};
struct progress_info {
struct progress *progress;
int blamed_lines;
};
static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)
{
@ -459,13 +466,11 @@ static void queue_blames(struct scoreboard *sb, struct origin *porigin,
static struct origin *make_origin(struct commit *commit, const char *path)
{
struct origin *o;
size_t pathlen = strlen(path) + 1;
o = xcalloc(1, sizeof(*o) + pathlen);
FLEX_ALLOC_STR(o, path, path);
o->commit = commit;
o->refcnt = 1;
o->next = commit->util;
commit->util = o;
memcpy(o->path, path, pathlen); /* includes NUL */
return o;
}
@ -1746,7 +1751,8 @@ static int emit_one_suspect_detail(struct origin *suspect, int repeat)
* The blame_entry is found to be guilty for the range.
* Show it in incremental output.
*/
static void found_guilty_entry(struct blame_entry *ent)
static void found_guilty_entry(struct blame_entry *ent,
struct progress_info *pi)
{
if (incremental) {
struct origin *suspect = ent->suspect;
@ -1758,6 +1764,8 @@ static void found_guilty_entry(struct blame_entry *ent)
write_filename_info(suspect->path);
maybe_flush_or_die(stdout, "stdout");
}
pi->blamed_lines += ent->num_lines;
display_progress(pi->progress, pi->blamed_lines);
}
/*
@ -1768,6 +1776,11 @@ static void assign_blame(struct scoreboard *sb, int opt)
{
struct rev_info *revs = sb->revs;
struct commit *commit = prio_queue_get(&sb->commits);
struct progress_info pi = { NULL, 0 };
if (show_progress)
pi.progress = start_progress_delay(_("Blaming lines"),
sb->num_lines, 50, 1);
while (commit) {
struct blame_entry *ent;
@ -1809,7 +1822,7 @@ static void assign_blame(struct scoreboard *sb, int opt)
suspect->guilty = 1;
for (;;) {
struct blame_entry *next = ent->next;
found_guilty_entry(ent);
found_guilty_entry(ent, &pi);
if (next) {
ent = next;
continue;
@ -1825,6 +1838,8 @@ static void assign_blame(struct scoreboard *sb, int opt)
if (DEBUG) /* sanity */
sanity_check_refcnt(sb);
}
stop_progress(&pi.progress);
}
static const char *format_time(unsigned long time, const char *tz_str,
@ -2042,7 +2057,8 @@ static int prepare_lines(struct scoreboard *sb)
for (p = buf; p < end; p = get_next_line(p, end))
num++;
sb->lineno = lineno = xmalloc(sizeof(*sb->lineno) * (num + 1));
ALLOC_ARRAY(sb->lineno, num + 1);
lineno = sb->lineno;
for (p = buf; p < end; p = get_next_line(p, end))
*lineno++ = p - buf;
@ -2392,11 +2408,6 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
ce->ce_mode = create_ce_mode(mode);
add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
/*
* We are not going to write this out, so this does not matter
* right now, but someday we might optimize diff-index --cached
* with cache-tree information.
*/
cache_tree_invalidate_path(&the_index, path);
return commit;
@ -2520,6 +2531,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
OPT_BOOL(0, "show-stats", &show_stats, N_("Show work cost statistics")),
OPT_BOOL(0, "progress", &show_progress, N_("Force progress reporting")),
OPT_BIT(0, "score-debug", &output_option, N_("Show output score for blame entries"), OUTPUT_SHOW_SCORE),
OPT_BIT('f', "show-name", &output_option, N_("Show original filename (Default: auto)"), OUTPUT_SHOW_NAME),
OPT_BIT('n', "show-number", &output_option, N_("Show original linenumber (Default: off)"), OUTPUT_SHOW_NUMBER),
@ -2555,6 +2567,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
save_commit_buffer = 0;
dashdash_pos = 0;
show_progress = -1;
parse_options_start(&ctx, argc, argv, prefix, options,
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0);
@ -2579,6 +2592,13 @@ parse_done:
DIFF_OPT_CLR(&revs.diffopt, FOLLOW_RENAMES);
argc = parse_options_end(&ctx);
if (incremental || (output_option & OUTPUT_PORCELAIN)) {
if (show_progress > 0)
die("--progress can't be used with --incremental or porcelain formats");
show_progress = 0;
} else if (show_progress < 0)
show_progress = isatty(2);
if (0 < abbrev)
/* one more abbrev length is needed for the boundary commit */
abbrev++;
@ -2828,11 +2848,11 @@ parse_done:
read_mailmap(&mailmap, NULL);
assign_blame(&sb, opt);
if (!incremental)
setup_pager();
assign_blame(&sb, opt);
free(final_commit_name);
if (incremental)

View File

@ -570,7 +570,6 @@ static const char edit_description[] = "BRANCH_DESCRIPTION";
static int edit_branch_description(const char *branch_name)
{
int status;
struct strbuf buf = STRBUF_INIT;
struct strbuf name = STRBUF_INIT;
@ -595,11 +594,11 @@ static int edit_branch_description(const char *branch_name)
strbuf_stripspace(&buf, 1);
strbuf_addf(&name, "branch.%s.description", branch_name);
status = git_config_set(name.buf, buf.len ? buf.buf : NULL);
git_config_set(name.buf, buf.len ? buf.buf : NULL);
strbuf_release(&name);
strbuf_release(&buf);
return status;
return 0;
}
int cmd_branch(int argc, const char **argv, const char *prefix)

View File

@ -401,7 +401,7 @@ static int batch_objects(struct batch_options *opt)
save_warning = warn_on_object_refname_ambiguity;
warn_on_object_refname_ambiguity = 0;
while (strbuf_getline(&buf, stdin, '\n') != EOF) {
while (strbuf_getline(&buf, stdin) != EOF) {
if (data.split_on_whitespace) {
/*
* Split at first whitespace, tying off the beginning

View File

@ -72,23 +72,23 @@ static void check_attr(const char *prefix, int cnt,
static void check_attr_stdin_paths(const char *prefix, int cnt,
struct git_attr_check *check)
{
struct strbuf buf, nbuf;
int line_termination = nul_term_line ? 0 : '\n';
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
strbuf_getline_fn getline_fn;
strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0);
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
if (line_termination && buf.buf[0] == '"') {
strbuf_reset(&nbuf);
if (unquote_c_style(&nbuf, buf.buf, NULL))
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
while (getline_fn(&buf, stdin) != EOF) {
if (!nul_term_line && buf.buf[0] == '"') {
strbuf_reset(&unquoted);
if (unquote_c_style(&unquoted, buf.buf, NULL))
die("line is badly quoted");
strbuf_swap(&buf, &nbuf);
strbuf_swap(&buf, &unquoted);
}
check_attr(prefix, cnt, check, buf.buf);
maybe_flush_or_die(stdout, "attribute to stdout");
}
strbuf_release(&buf);
strbuf_release(&nbuf);
strbuf_release(&unquoted);
}
static NORETURN void error_with_usage(const char *msg)

View File

@ -115,19 +115,19 @@ static int check_ignore(struct dir_struct *dir,
static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix)
{
struct strbuf buf, nbuf;
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
char *pathspec[2] = { NULL, NULL };
int line_termination = nul_term_line ? 0 : '\n';
strbuf_getline_fn getline_fn;
int num_ignored = 0;
strbuf_init(&buf, 0);
strbuf_init(&nbuf, 0);
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
if (line_termination && buf.buf[0] == '"') {
strbuf_reset(&nbuf);
if (unquote_c_style(&nbuf, buf.buf, NULL))
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
while (getline_fn(&buf, stdin) != EOF) {
if (!nul_term_line && buf.buf[0] == '"') {
strbuf_reset(&unquoted);
if (unquote_c_style(&unquoted, buf.buf, NULL))
die("line is badly quoted");
strbuf_swap(&buf, &nbuf);
strbuf_swap(&buf, &unquoted);
}
pathspec[0] = buf.buf;
num_ignored += check_ignore(dir, prefix,
@ -135,7 +135,7 @@ static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix)
maybe_flush_or_die(stdout, "check-ignore to stdout");
}
strbuf_release(&buf);
strbuf_release(&nbuf);
strbuf_release(&unquoted);
return num_ignored;
}

View File

@ -54,7 +54,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix)
if (use_stdin) {
struct strbuf buf = STRBUF_INIT;
while (strbuf_getline(&buf, stdin, '\n') != EOF) {
while (strbuf_getline_lf(&buf, stdin) != EOF) {
check_mailmap(&mailmap, buf.buf);
maybe_flush_or_die(stdout, "stdout");
}

View File

@ -20,7 +20,7 @@ static const char builtin_check_ref_format_usage[] =
*/
static char *collapse_slashes(const char *refname)
{
char *ret = xmalloc(strlen(refname) + 1);
char *ret = xmallocz(strlen(refname));
char ch;
char prev = '/';
char *cp = ret;

View File

@ -11,7 +11,7 @@
#include "parse-options.h"
#define CHECKOUT_ALL 4
static int line_termination = '\n';
static int nul_term_line;
static int checkout_stage; /* default to checkout stage0 */
static int to_tempfile;
static char topath[4][TEMPORARY_FILENAME_LENGTH + 1];
@ -35,7 +35,8 @@ static void write_tempfile_record(const char *name, const char *prefix)
fputs(topath[checkout_stage], stdout);
putchar('\t');
write_name_quoted_relative(name, prefix, stdout, line_termination);
write_name_quoted_relative(name, prefix, stdout,
nul_term_line ? '\0' : '\n');
for (i = 0; i < 4; i++) {
topath[i][0] = 0;
@ -129,36 +130,6 @@ static const char * const builtin_checkout_index_usage[] = {
static struct lock_file lock_file;
static int option_parse_u(const struct option *opt,
const char *arg, int unset)
{
int *newfd = opt->value;
state.refresh_cache = 1;
state.istate = &the_index;
if (*newfd < 0)
*newfd = hold_locked_index(&lock_file, 1);
return 0;
}
static int option_parse_z(const struct option *opt,
const char *arg, int unset)
{
if (unset)
line_termination = '\n';
else
line_termination = 0;
return 0;
}
static int option_parse_prefix(const struct option *opt,
const char *arg, int unset)
{
state.base_dir = arg;
state.base_dir_len = strlen(arg);
return 0;
}
static int option_parse_stage(const struct option *opt,
const char *arg, int unset)
{
@ -170,7 +141,7 @@ static int option_parse_stage(const struct option *opt,
if ('1' <= ch && ch <= '3')
checkout_stage = arg[0] - '0';
else
die("stage should be between 1 and 3 or all");
die(_("stage should be between 1 and 3 or all"));
}
return 0;
}
@ -183,6 +154,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
int read_from_stdin = 0;
int prefix_length;
int force = 0, quiet = 0, not_new = 0;
int index_opt = 0;
struct option builtin_checkout_index_options[] = {
OPT_BOOL('a', "all", &all,
N_("check out all files in the index")),
@ -191,22 +163,19 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
N_("no warning for existing files and files not in index")),
OPT_BOOL('n', "no-create", &not_new,
N_("don't checkout new files")),
{ OPTION_CALLBACK, 'u', "index", &newfd, NULL,
N_("update stat information in the index file"),
PARSE_OPT_NOARG, option_parse_u },
{ OPTION_CALLBACK, 'z', NULL, NULL, NULL,
N_("paths are separated with NUL character"),
PARSE_OPT_NOARG, option_parse_z },
OPT_BOOL('u', "index", &index_opt,
N_("update stat information in the index file")),
OPT_BOOL('z', NULL, &nul_term_line,
N_("paths are separated with NUL character")),
OPT_BOOL(0, "stdin", &read_from_stdin,
N_("read list of paths from the standard input")),
OPT_BOOL(0, "temp", &to_tempfile,
N_("write the content to temporary files")),
OPT_CALLBACK(0, "prefix", NULL, N_("string"),
N_("when creating files, prepend <string>"),
option_parse_prefix),
OPT_CALLBACK(0, "stage", NULL, NULL,
OPT_STRING(0, "prefix", &state.base_dir, N_("string"),
N_("when creating files, prepend <string>")),
{ OPTION_CALLBACK, 0, "stage", NULL, "1-3|all",
N_("copy out the files from named stage"),
option_parse_stage),
PARSE_OPT_NONEG, option_parse_stage },
OPT_END()
};
@ -214,7 +183,6 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
usage_with_options(builtin_checkout_index_usage,
builtin_checkout_index_options);
git_config(git_default_config, NULL);
state.base_dir = "";
prefix_length = prefix ? strlen(prefix) : 0;
if (read_cache() < 0) {
@ -227,15 +195,17 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
state.quiet = quiet;
state.not_new = not_new;
if (state.base_dir_len || to_tempfile) {
/* when --prefix is specified we do not
* want to update cache.
*/
if (state.refresh_cache) {
rollback_lock_file(&lock_file);
newfd = -1;
}
state.refresh_cache = 0;
if (!state.base_dir)
state.base_dir = "";
state.base_dir_len = strlen(state.base_dir);
/*
* when --prefix is specified we do not want to update cache.
*/
if (index_opt && !state.base_dir_len && !to_tempfile) {
state.refresh_cache = 1;
state.istate = &the_index;
newfd = hold_locked_index(&lock_file, 1);
}
/* Check out named files first */
@ -253,24 +223,27 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
}
if (read_from_stdin) {
struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
strbuf_getline_fn getline_fn;
if (all)
die("git checkout-index: don't mix '--all' and '--stdin'");
while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
while (getline_fn(&buf, stdin) != EOF) {
char *p;
if (line_termination && buf.buf[0] == '"') {
strbuf_reset(&nbuf);
if (unquote_c_style(&nbuf, buf.buf, NULL))
if (!nul_term_line && buf.buf[0] == '"') {
strbuf_reset(&unquoted);
if (unquote_c_style(&unquoted, buf.buf, NULL))
die("line is badly quoted");
strbuf_swap(&buf, &nbuf);
strbuf_swap(&buf, &unquoted);
}
p = prefix_path(prefix, prefix_length, buf.buf);
checkout_file(p, prefix);
free(p);
}
strbuf_release(&nbuf);
strbuf_release(&unquoted);
strbuf_release(&buf);
}

View File

@ -661,7 +661,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
describe_detached_head(_("HEAD is now at"), new->commit);
}
} else if (new->path) { /* Switch branches. */
create_symref("HEAD", new->path, msg.buf);
if (create_symref("HEAD", new->path, msg.buf) < 0)
die(_("unable to update HEAD"));
if (!opts->quiet) {
if (old->path && !strcmp(new->path, old->path)) {
if (opts->new_branch_force)
@ -981,7 +982,8 @@ static int parse_branchname_arg(int argc, const char **argv,
*/
int recover_with_dwim = dwim_new_local_branch_ok;
if (check_filename(NULL, arg) && !has_dash_dash)
if (!has_dash_dash &&
(check_filename(NULL, arg) || !no_wildcard(arg)))
recover_with_dwim = 0;
/*
* Accept "git checkout foo" and "git checkout foo --"

View File

@ -147,30 +147,6 @@ static int exclude_cb(const struct option *opt, const char *arg, int unset)
return 0;
}
/*
* Return 1 if the given path is the root of a git repository or
* submodule else 0. Will not return 1 for bare repositories with the
* exception of creating a bare repository in "foo/.git" and calling
* is_git_repository("foo").
*/
static int is_git_repository(struct strbuf *path)
{
int ret = 0;
int gitfile_error;
size_t orig_path_len = path->len;
assert(orig_path_len != 0);
strbuf_complete(path, '/');
strbuf_addstr(path, ".git");
if (read_gitfile_gently(path->buf, &gitfile_error) || is_git_directory(path->buf))
ret = 1;
if (gitfile_error == READ_GITFILE_ERR_OPEN_FAILED ||
gitfile_error == READ_GITFILE_ERR_READ_FAILED)
ret = 1; /* This could be a real .git file, take the
* safe option and avoid cleaning */
strbuf_setlen(path, orig_path_len);
return ret;
}
static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
int dry_run, int quiet, int *dir_gone)
{
@ -182,7 +158,7 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
*dir_gone = 1;
if ((force_flag & REMOVE_DIR_KEEP_NESTED_GIT) && is_git_repository(path)) {
if ((force_flag & REMOVE_DIR_KEEP_NESTED_GIT) && is_nonbare_repository_dir(path)) {
if (!quiet) {
quote_path_relative(path->buf, prefix, &quoted);
printf(dry_run ? _(msg_would_skip_git_dir) : _(msg_skip_git_dir),
@ -567,7 +543,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
int eof = 0;
int i;
chosen = xmalloc(sizeof(int) * stuff->nr);
ALLOC_ARRAY(chosen, stuff->nr);
/* set chosen as uninitialized */
for (i = 0; i < stuff->nr; i++)
chosen[i] = -1;
@ -594,7 +570,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
clean_get_color(CLEAN_COLOR_RESET));
}
if (strbuf_getline(&choice, stdin, '\n') != EOF) {
if (strbuf_getline_lf(&choice, stdin) != EOF) {
strbuf_trim(&choice);
} else {
eof = 1;
@ -639,7 +615,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
nr += chosen[i];
}
result = xcalloc(nr + 1, sizeof(int));
result = xcalloc(st_add(nr, 1), sizeof(int));
for (i = 0; i < stuff->nr && j < nr; i++) {
if (chosen[i])
result[j++] = i;
@ -676,7 +652,7 @@ static int filter_by_patterns_cmd(void)
clean_print_color(CLEAN_COLOR_PROMPT);
printf(_("Input ignore patterns>> "));
clean_print_color(CLEAN_COLOR_RESET);
if (strbuf_getline(&confirm, stdin, '\n') != EOF)
if (strbuf_getline_lf(&confirm, stdin) != EOF)
strbuf_trim(&confirm);
else
putchar('\n');
@ -774,7 +750,7 @@ static int ask_each_cmd(void)
qname = quote_path_relative(item->string, NULL, &buf);
/* TRANSLATORS: Make sure to keep [y/N] as is */
printf(_("Remove %s [y/N]? "), qname);
if (strbuf_getline(&confirm, stdin, '\n') != EOF) {
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
strbuf_trim(&confirm);
} else {
putchar('\n');

View File

@ -47,6 +47,7 @@ static const char *real_git_dir;
static char *option_upload_pack = "git-upload-pack";
static int option_verbosity;
static int option_progress = -1;
static enum transport_family family;
static struct string_list option_config;
static struct string_list option_reference;
static int option_dissociate;
@ -95,6 +96,10 @@ static struct option builtin_clone_options[] = {
N_("separate git dir from working tree")),
OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
N_("set config inside the new repository")),
OPT_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"),
TRANSPORT_FAMILY_IPV4),
OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
TRANSPORT_FAMILY_IPV6),
OPT_END()
};
@ -230,8 +235,8 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
strip_suffix_mem(start, &len, is_bundle ? ".bundle" : ".git");
if (!len || (len == 1 && *start == '/'))
die("No directory name could be guessed.\n"
"Please specify a directory on the command line");
die(_("No directory name could be guessed.\n"
"Please specify a directory on the command line"));
if (is_bare)
dir = xstrfmt("%.*s.git", (int)len, start);
@ -338,7 +343,7 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
FILE *in = fopen(src->buf, "r");
struct strbuf line = STRBUF_INIT;
while (strbuf_getline(&line, in, '\n') != EOF) {
while (strbuf_getline(&line, in) != EOF) {
char *abs_path;
if (!line.len || line.buf[0] == '#')
continue;
@ -635,9 +640,11 @@ static void update_remote_refs(const struct ref *refs,
struct strbuf head_ref = STRBUF_INIT;
strbuf_addstr(&head_ref, branch_top);
strbuf_addstr(&head_ref, "HEAD");
create_symref(head_ref.buf,
remote_head_points_at->peer_ref->name,
msg);
if (create_symref(head_ref.buf,
remote_head_points_at->peer_ref->name,
msg) < 0)
die(_("unable to update %s"), head_ref.buf);
strbuf_release(&head_ref);
}
}
@ -647,7 +654,8 @@ static void update_head(const struct ref *our, const struct ref *remote,
const char *head;
if (our && skip_prefix(our->name, "refs/heads/", &head)) {
/* Local default branch link */
create_symref("HEAD", our->name, NULL);
if (create_symref("HEAD", our->name, NULL) < 0)
die(_("unable to update HEAD"));
if (!option_bare) {
update_ref(msg, "HEAD", our->old_oid.hash, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
@ -739,7 +747,7 @@ static int checkout(void)
static int write_one_config(const char *key, const char *value, void *data)
{
return git_config_set_multivar(key, value ? value : "true", "^$", 0);
return git_config_set_multivar_gently(key, value ? value : "true", "^$", 0);
}
static void write_config(struct string_list *config)
@ -749,7 +757,7 @@ static void write_config(struct string_list *config)
for (i = 0; i < config->nr; i++) {
if (git_config_parse_parameter(config->items[i].string,
write_one_config, NULL) < 0)
die("unable to write parameters to config file");
die(_("unable to write parameters to config file"));
}
}
@ -974,6 +982,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
remote = remote_get(option_origin);
transport = transport_get(remote, remote->url[0]);
transport_set_verbosity(transport, option_verbosity, option_progress);
transport->family = family;
path = get_repo_path(remote->url[0], &is_bundle);
is_local = option_local != 0 && path && !is_bundle;

View File

@ -51,7 +51,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
die(_("--command must be the first argument"));
}
finalize_colopts(&colopts, -1);
while (!strbuf_getline(&sb, stdin, '\n'))
while (!strbuf_getline(&sb, stdin))
string_list_append(&list, sb.buf);
print_columns(&list, colopts, &copts);

View File

@ -761,7 +761,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
hook_arg2 = "";
}
s->fp = fopen(git_path(commit_editmsg), "w");
s->fp = fopen_for_writing(git_path(commit_editmsg));
if (s->fp == NULL)
die_errno(_("could not open '%s'"), git_path(commit_editmsg));
@ -1690,7 +1690,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (fp == NULL)
die_errno(_("could not open '%s' for reading"),
git_path_merge_head());
while (strbuf_getline(&m, fp, '\n') != EOF) {
while (strbuf_getline_lf(&m, fp) != EOF) {
struct commit *parent;
parent = get_merge_parent(m.buf);

View File

@ -3,6 +3,7 @@
#include "color.h"
#include "parse-options.h"
#include "urlmatch.h"
#include "quote.h"
static const char *const builtin_config_usage[] = {
N_("git config [<options>]"),
@ -27,6 +28,7 @@ static int actions, types;
static const char *get_color_slot, *get_colorbool_slot;
static int end_null;
static int respect_includes = -1;
static int show_origin;
#define ACTION_GET (1<<0)
#define ACTION_GET_ALL (1<<1)
@ -81,6 +83,7 @@ static struct option builtin_config_options[] = {
OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")),
OPT_BOOL(0, "name-only", &omit_values, N_("show variable names only")),
OPT_BOOL(0, "includes", &respect_includes, N_("respect include directives on lookup")),
OPT_BOOL(0, "show-origin", &show_origin, N_("show origin of config (file, standard input, blob, command line)")),
OPT_END(),
};
@ -91,8 +94,28 @@ static void check_argc(int argc, int min, int max) {
usage_with_options(builtin_config_usage, builtin_config_options);
}
static void show_config_origin(struct strbuf *buf)
{
const char term = end_null ? '\0' : '\t';
strbuf_addstr(buf, current_config_origin_type());
strbuf_addch(buf, ':');
if (end_null)
strbuf_addstr(buf, current_config_name());
else
quote_c_style(current_config_name(), buf, NULL, 0);
strbuf_addch(buf, term);
}
static int show_all_config(const char *key_, const char *value_, void *cb)
{
if (show_origin) {
struct strbuf buf = STRBUF_INIT;
show_config_origin(&buf);
/* Use fwrite as "buf" can contain \0's if "end_null" is set. */
fwrite(buf.buf, 1, buf.len, stdout);
strbuf_release(&buf);
}
if (!omit_values && value_)
printf("%s%c%s%c", key_, delim, value_, term);
else
@ -108,6 +131,8 @@ struct strbuf_list {
static int format_config(struct strbuf *buf, const char *key_, const char *value_)
{
if (show_origin)
show_config_origin(buf);
if (show_keys)
strbuf_addstr(buf, key_);
if (!omit_values) {
@ -352,6 +377,9 @@ static int get_colorbool(const char *var, int print)
static void check_write(void)
{
if (!given_config_source.file && !startup_info->have_repository)
die("not in a git directory");
if (given_config_source.use_stdin)
die("writing to stdin is not supported");
@ -538,6 +566,14 @@ int cmd_config(int argc, const char **argv, const char *prefix)
error("--name-only is only applicable to --list or --get-regexp");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (show_origin && !(actions &
(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
error("--show-origin is only applicable to --get, --get-all, "
"--get-regexp, and --list.");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (actions == ACTION_LIST) {
check_argc(argc, 0, 0);
if (git_config_with_options(show_all_config, NULL,
@ -582,7 +618,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
ret = git_config_set_in_file(given_config_source.file, argv[0], value);
ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value);
if (ret == CONFIG_NOTHING_SET)
error("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s.", argv[0]);
@ -592,23 +628,23 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
return git_config_set_multivar_in_file(given_config_source.file,
argv[0], value, argv[2], 0);
return git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value, argv[2], 0);
}
else if (actions == ACTION_ADD) {
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
return git_config_set_multivar_in_file(given_config_source.file,
argv[0], value,
CONFIG_REGEX_NONE, 0);
return git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value,
CONFIG_REGEX_NONE, 0);
}
else if (actions == ACTION_REPLACE_ALL) {
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
return git_config_set_multivar_in_file(given_config_source.file,
argv[0], value, argv[2], 1);
return git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], value, argv[2], 1);
}
else if (actions == ACTION_GET) {
check_argc(argc, 1, 2);
@ -634,17 +670,17 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_write();
check_argc(argc, 1, 2);
if (argc == 2)
return git_config_set_multivar_in_file(given_config_source.file,
argv[0], NULL, argv[1], 0);
return git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], NULL, argv[1], 0);
else
return git_config_set_in_file(given_config_source.file,
argv[0], NULL);
return git_config_set_in_file_gently(given_config_source.file,
argv[0], NULL);
}
else if (actions == ACTION_UNSET_ALL) {
check_write();
check_argc(argc, 1, 2);
return git_config_set_multivar_in_file(given_config_source.file,
argv[0], NULL, argv[1], 1);
return git_config_set_multivar_in_file_gently(given_config_source.file,
argv[0], NULL, argv[1], 1);
}
else if (actions == ACTION_RENAME_SECTION) {
int ret;

View File

@ -341,7 +341,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
}
if (no_index)
/* If this is a no-index diff, just run it and exit there. */
diff_no_index(&rev, argc, argv, prefix);
diff_no_index(&rev, argc, argv);
/* Otherwise, we are doing the usual "git" diff */
rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;

View File

@ -880,7 +880,7 @@ static void export_marks(char *file)
FILE *f;
int e = 0;
f = fopen(file, "w");
f = fopen_for_writing(file);
if (!f)
die_errno("Unable to open marks file %s for writing.", file);
@ -1021,7 +1021,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
const char **refspecs_str;
int i;
refspecs_str = xmalloc(sizeof(*refspecs_str) * refspecs_list.nr);
ALLOC_ARRAY(refspecs_str, refspecs_list.nr);
for (i = 0; i < refspecs_list.nr; i++)
refspecs_str[i] = refspecs_list.items[i].string;

View File

@ -10,33 +10,24 @@ static const char fetch_pack_usage[] =
"[--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] "
"[--no-progress] [--diag-url] [-v] [<host>:]<directory> [<refs>...]";
static void add_sought_entry_mem(struct ref ***sought, int *nr, int *alloc,
const char *name, int namelen)
static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
const char *name)
{
struct ref *ref = xcalloc(1, sizeof(*ref) + namelen + 1);
struct ref *ref;
struct object_id oid;
const int chunksz = GIT_SHA1_HEXSZ + 1;
if (namelen > chunksz && name[chunksz - 1] == ' ' &&
!get_oid_hex(name, &oid)) {
oidcpy(&ref->old_oid, &oid);
name += chunksz;
namelen -= chunksz;
}
if (!get_oid_hex(name, &oid) && name[GIT_SHA1_HEXSZ] == ' ')
name += GIT_SHA1_HEXSZ + 1;
else
oidclr(&oid);
memcpy(ref->name, name, namelen);
ref->name[namelen] = '\0';
ref = alloc_ref(name);
oidcpy(&ref->old_oid, &oid);
(*nr)++;
ALLOC_GROW(*sought, *nr, *alloc);
(*sought)[*nr - 1] = ref;
}
static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
const char *string)
{
add_sought_entry_mem(sought, nr, alloc, string, strlen(string));
}
int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
{
int i, ret;
@ -158,7 +149,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
else {
/* read from stdin one ref per line, until EOF */
struct strbuf line = STRBUF_INIT;
while (strbuf_getline(&line, stdin, '\n') != EOF)
while (strbuf_getline_lf(&line, stdin) != EOF)
add_sought_entry(&sought, &nr_sought, &alloc_sought, line.buf);
strbuf_release(&line);
}

View File

@ -38,6 +38,7 @@ static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosit
static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
static int tags = TAGS_DEFAULT, unshallow, update_shallow;
static int max_children = -1;
static enum transport_family family;
static const char *depth;
static const char *upload_pack;
static struct strbuf default_rla = STRBUF_INIT;
@ -127,6 +128,10 @@ static struct option builtin_fetch_options[] = {
N_("accept refs that update .git/shallow")),
{ OPTION_CALLBACK, 0, "refmap", NULL, N_("refmap"),
N_("specify fetch refmap"), PARSE_OPT_NONEG, parse_refmap_arg },
OPT_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"),
TRANSPORT_FAMILY_IPV4),
OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
TRANSPORT_FAMILY_IPV6),
OPT_END()
};
@ -840,7 +845,7 @@ static void check_not_current_branch(struct ref *ref_map)
static int truncate_fetch_head(void)
{
const char *filename = git_path_fetch_head();
FILE *fp = fopen(filename, "w");
FILE *fp = fopen_for_writing(filename);
if (!fp)
return error(_("cannot open %s: %s\n"), filename, strerror(errno));
@ -864,6 +869,7 @@ static struct transport *prepare_transport(struct remote *remote)
struct transport *transport;
transport = transport_get(remote, NULL);
transport_set_verbosity(transport, verbosity, progress);
transport->family = family;
if (upload_pack)
set_option(transport, TRANS_OPT_UPLOADPACK, upload_pack);
if (keep)
@ -1016,10 +1022,9 @@ static int add_remote_or_group(const char *name, struct string_list *list)
git_config(get_remote_group, &g);
if (list->nr == prev_nr) {
struct remote *remote;
if (!remote_is_configured(name))
struct remote *remote = remote_get(name);
if (!remote_is_configured(remote))
return 0;
remote = remote_get(name);
string_list_append(list, remote->name);
}
return 1;
@ -1110,7 +1115,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
if (argc > 0) {
int j = 0;
int i;
refs = xcalloc(argc + 1, sizeof(const char *));
refs = xcalloc(st_add(argc, 1), sizeof(const char *));
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "tag")) {
i++;
@ -1225,6 +1230,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
list.strdup_strings = 1;
string_list_clear(&list, 0);
close_all_packs();
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
if (verbosity < 0)
argv_array_push(&argv_gc_auto, "--quiet");

View File

@ -24,11 +24,11 @@ static char const * const grep_usage[] = {
NULL
};
static int use_threads = 1;
#define GREP_NUM_THREADS_DEFAULT 8
static int num_threads;
#ifndef NO_PTHREADS
#define THREADS 8
static pthread_t threads[THREADS];
static pthread_t *threads;
/* We use one producer thread and THREADS consumer
* threads. The producer adds struct work_items to 'todo' and the
@ -63,13 +63,13 @@ static pthread_mutex_t grep_mutex;
static inline void grep_lock(void)
{
if (use_threads)
if (num_threads)
pthread_mutex_lock(&grep_mutex);
}
static inline void grep_unlock(void)
{
if (use_threads)
if (num_threads)
pthread_mutex_unlock(&grep_mutex);
}
@ -206,7 +206,8 @@ static void start_threads(struct grep_opt *opt)
strbuf_init(&todo[i].out, 0);
}
for (i = 0; i < ARRAY_SIZE(threads); i++) {
threads = xcalloc(num_threads, sizeof(*threads));
for (i = 0; i < num_threads; i++) {
int err;
struct grep_opt *o = grep_opt_dup(opt);
o->output = strbuf_out;
@ -238,12 +239,14 @@ static int wait_all(void)
pthread_cond_broadcast(&cond_add);
grep_unlock();
for (i = 0; i < ARRAY_SIZE(threads); i++) {
for (i = 0; i < num_threads; i++) {
void *h;
pthread_join(threads[i], &h);
hit |= (int) (intptr_t) h;
}
free(threads);
pthread_mutex_destroy(&grep_mutex);
pthread_mutex_destroy(&grep_read_mutex);
pthread_mutex_destroy(&grep_attr_mutex);
@ -267,6 +270,14 @@ static int grep_cmd_config(const char *var, const char *value, void *cb)
int st = grep_config(var, value, cb);
if (git_color_default_config(var, value, cb) < 0)
st = -1;
if (!strcmp(var, "grep.threads")) {
num_threads = git_config_int(var, value);
if (num_threads < 0)
die(_("invalid number of threads specified (%d) for %s"),
num_threads, var);
}
return st;
}
@ -294,7 +305,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1,
}
#ifndef NO_PTHREADS
if (use_threads) {
if (num_threads) {
add_work(opt, GREP_SOURCE_SHA1, pathbuf.buf, path, sha1);
strbuf_release(&pathbuf);
return 0;
@ -323,7 +334,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
strbuf_addstr(&buf, filename);
#ifndef NO_PTHREADS
if (use_threads) {
if (num_threads) {
add_work(opt, GREP_SOURCE_FILE, buf.buf, filename, filename);
strbuf_release(&buf);
return 0;
@ -354,17 +365,17 @@ static void append_path(struct grep_opt *opt, const void *data, size_t len)
static void run_pager(struct grep_opt *opt, const char *prefix)
{
struct string_list *path_list = opt->output_priv;
const char **argv = xmalloc(sizeof(const char *) * (path_list->nr + 1));
struct child_process child = CHILD_PROCESS_INIT;
int i, status;
for (i = 0; i < path_list->nr; i++)
argv[i] = path_list->items[i].string;
argv[path_list->nr] = NULL;
argv_array_push(&child.args, path_list->items[i].string);
child.dir = prefix;
child.use_shell = 1;
status = run_command_v_opt_cd_env(argv, RUN_USING_SHELL, prefix, NULL);
status = run_command(&child);
if (status)
exit(status);
free(argv);
}
static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int cached)
@ -375,7 +386,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
for (nr = 0; nr < active_nr; nr++) {
const struct cache_entry *ce = active_cache[nr];
if (!S_ISREG(ce->ce_mode))
if (!S_ISREG(ce->ce_mode) || ce_intent_to_add(ce))
continue;
if (!ce_path_match(ce, pathspec, NULL))
continue;
@ -562,7 +573,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
patterns = from_stdin ? stdin : fopen(arg, "r");
if (!patterns)
die_errno(_("cannot open '%s'"), arg);
while (strbuf_getline(&sb, patterns, '\n') == 0) {
while (strbuf_getline(&sb, patterns) == 0) {
/* ignore empty line like grep does */
if (sb.len == 0)
continue;
@ -697,6 +708,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
N_("show <n> context lines before matches")),
OPT_INTEGER('A', "after-context", &opt.post_context,
N_("show <n> context lines after matches")),
OPT_INTEGER(0, "threads", &num_threads,
N_("use <n> worker threads")),
OPT_NUMBER_CALLBACK(&opt, N_("shortcut for -C NUM"),
context_callback),
OPT_BOOL('p', "show-function", &opt.funcname,
@ -755,9 +768,15 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
PARSE_OPT_STOP_AT_NON_OPTION);
grep_commit_pattern_type(pattern_type_arg, &opt);
if (use_index && !startup_info->have_repository)
/* die the same way as if we did it at the beginning */
setup_git_directory();
if (use_index && !startup_info->have_repository) {
int fallback = 0;
git_config_get_bool("grep.fallbacktonoindex", &fallback);
if (fallback)
use_index = 0;
else
/* die the same way as if we did it at the beginning */
setup_git_directory();
}
/*
* skip a -- separator; we know it cannot be
@ -786,7 +805,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
opt.output_priv = &path_list;
opt.output = append_path;
string_list_append(&path_list, show_in_pager);
use_threads = 0;
}
if (!opt.pattern_list)
@ -817,14 +835,18 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
}
#ifndef NO_PTHREADS
if (list.nr || cached || online_cpus() == 1)
use_threads = 0;
if (list.nr || cached || show_in_pager)
num_threads = 0;
else if (num_threads == 0)
num_threads = GREP_NUM_THREADS_DEFAULT;
else if (num_threads < 0)
die(_("invalid number of threads specified (%d)"), num_threads);
#else
use_threads = 0;
num_threads = 0;
#endif
#ifndef NO_PTHREADS
if (use_threads) {
if (num_threads) {
if (!(opt.name_only || opt.unmatch_name_only || opt.count)
&& (opt.pre_context || opt.post_context ||
opt.file_break || opt.funcbody))
@ -894,7 +916,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
hit = grep_objects(&opt, &pathspec, &list);
}
if (use_threads)
if (num_threads)
hit |= wait_all();
if (hit && show_in_pager)
run_pager(&opt, prefix);

View File

@ -58,20 +58,21 @@ static void hash_object(const char *path, const char *type, const char *vpath,
static void hash_stdin_paths(const char *type, int no_filters, unsigned flags,
int literally)
{
struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
while (strbuf_getline(&buf, stdin, '\n') != EOF) {
while (strbuf_getline(&buf, stdin) != EOF) {
if (buf.buf[0] == '"') {
strbuf_reset(&nbuf);
if (unquote_c_style(&nbuf, buf.buf, NULL))
strbuf_reset(&unquoted);
if (unquote_c_style(&unquoted, buf.buf, NULL))
die("line is badly quoted");
strbuf_swap(&buf, &nbuf);
strbuf_swap(&buf, &unquoted);
}
hash_object(buf.buf, type, no_filters ? NULL : buf.buf, flags,
literally);
}
strbuf_release(&buf);
strbuf_release(&nbuf);
strbuf_release(&unquoted);
}
int cmd_hash_object(int argc, const char **argv, const char *prefix)

View File

@ -171,12 +171,10 @@ static void exec_man_cmd(const char *cmd, const char *page)
static void add_man_viewer(const char *name)
{
struct man_viewer_list **p = &man_viewer_list;
size_t len = strlen(name);
while (*p)
p = &((*p)->next);
*p = xcalloc(1, (sizeof(**p) + len + 1));
memcpy((*p)->name, name, len); /* NUL-terminated by xcalloc */
FLEX_ALLOC_STR(*p, name, name);
}
static int supported_man_viewer(const char *name, size_t len)
@ -190,9 +188,8 @@ static void do_add_man_viewer_info(const char *name,
size_t len,
const char *value)
{
struct man_viewer_info_list *new = xcalloc(1, sizeof(*new) + len + 1);
memcpy(new->name, name, len); /* NUL-terminated by xcalloc */
struct man_viewer_info_list *new;
FLEX_ALLOC_MEM(new, name, name, len);
new->info = xstrdup(value);
new->next = man_viewer_info_list;
man_viewer_info_list = new;

View File

@ -1346,7 +1346,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
* before deltas depending on them, a good heuristic is to start
* resolving deltas in the same order as their position in the pack.
*/
sorted_by_pos = xmalloc(nr_ref_deltas * sizeof(*sorted_by_pos));
ALLOC_ARRAY(sorted_by_pos, nr_ref_deltas);
for (i = 0; i < nr_ref_deltas; i++)
sorted_by_pos[i] = &ref_deltas[i];
qsort(sorted_by_pos, nr_ref_deltas, sizeof(*sorted_by_pos), delta_pos_compare);
@ -1514,6 +1514,7 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
if (!(off & 0x80000000))
continue;
off = off & 0x7fffffff;
check_pack_index_ptr(p, &idx2[off * 2]);
if (idx2[off * 2])
continue;
/*
@ -1744,9 +1745,9 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
curr_pack = open_pack_file(pack_name);
parse_pack_header();
objects = xcalloc(nr_objects + 1, sizeof(struct object_entry));
objects = xcalloc(st_add(nr_objects, 1), sizeof(struct object_entry));
if (show_stat)
obj_stat = xcalloc(nr_objects + 1, sizeof(struct object_stat));
obj_stat = xcalloc(st_add(nr_objects, 1), sizeof(struct object_stat));
ofs_deltas = xcalloc(nr_objects, sizeof(struct ofs_delta_entry));
parse_pack_objects(pack_sha1);
resolve_deltas();
@ -1759,7 +1760,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
if (show_stat)
show_pack_info(stat_only);
idx_objects = xmalloc((nr_objects) * sizeof(struct pack_idx_entry *));
ALLOC_ARRAY(idx_objects, nr_objects);
for (i = 0; i < nr_objects; i++)
idx_objects[i] = &objects[i].idx;
curr_index = write_idx_file(index_name, idx_objects, nr_objects, &opts, pack_sha1);

View File

@ -250,7 +250,7 @@ static int create_default_files(const char *template_path)
git_config_set("core.bare", "false");
/* allow template config file to override the default */
if (log_all_ref_updates == -1)
git_config_set("core.logallrefupdates", "true");
git_config_set("core.logallrefupdates", "true");
if (needs_work_tree_config(get_git_dir(), work_tree))
git_config_set("core.worktree", work_tree);
}

View File

@ -12,16 +12,18 @@
#include "trailer.h"
static const char * const git_interpret_trailers_usage[] = {
N_("git interpret-trailers [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"),
N_("git interpret-trailers [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"),
NULL
};
int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
{
int in_place = 0;
int trim_empty = 0;
struct string_list trailers = STRING_LIST_INIT_DUP;
struct option options[] = {
OPT_BOOL(0, "in-place", &in_place, N_("edit files in place")),
OPT_BOOL(0, "trim-empty", &trim_empty, N_("trim empty trailers")),
OPT_STRING_LIST(0, "trailer", &trailers, N_("trailer"),
N_("trailer(s) to add")),
@ -34,9 +36,12 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
if (argc) {
int i;
for (i = 0; i < argc; i++)
process_trailers(argv[i], trim_empty, &trailers);
} else
process_trailers(NULL, trim_empty, &trailers);
process_trailers(argv[i], in_place, trim_empty, &trailers);
} else {
if (in_place)
die(_("no input file given for in-place editing"));
process_trailers(NULL, in_place, trim_empty, &trailers);
}
string_list_clear(&trailers, 0);

View File

@ -699,6 +699,7 @@ static int do_signoff;
static const char *signature = git_version_string;
static const char *signature_file;
static int config_cover_letter;
static const char *config_output_directory;
enum {
COVER_UNSET,
@ -777,6 +778,8 @@ static int git_format_config(const char *var, const char *value, void *cb)
config_cover_letter = git_config_bool(var, value) ? COVER_ON : COVER_OFF;
return 0;
}
if (!strcmp(var, "format.outputdirectory"))
return git_config_string(&config_output_directory, var, value);
return git_log_config(var, value, cb);
}
@ -1196,6 +1199,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
int cover_letter = -1;
int boundary_count = 0;
int no_binary_diff = 0;
int zero_commit = 0;
struct commit *origin = NULL;
const char *in_reply_to = NULL;
struct patch_ids ids;
@ -1236,6 +1240,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
PARSE_OPT_NOARG | PARSE_OPT_NONEG, keep_callback },
OPT_BOOL(0, "no-binary", &no_binary_diff,
N_("don't output binary diffs")),
OPT_BOOL(0, "zero-commit", &zero_commit,
N_("output all-zero hash in From header")),
OPT_BOOL(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
N_("don't include a patch matching a commit upstream")),
{ OPTION_SET_INT, 'p', "no-stat", &use_patch_format, NULL,
@ -1380,12 +1386,17 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
/* Always generate a patch */
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.zero_commit = zero_commit;
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
DIFF_OPT_SET(&rev.diffopt, BINARY);
if (rev.show_notes)
init_display_notes(&rev.notes_opt);
if (!output_directory && !use_stdout)
output_directory = config_output_directory;
if (!use_stdout)
output_directory = set_outdir(prefix, output_directory);
else

View File

@ -27,6 +27,7 @@ static int show_killed;
static int show_valid_bit;
static int line_terminator = '\n';
static int debug_mode;
static int show_eol;
static const char *prefix;
static int max_prefix_len;
@ -47,6 +48,23 @@ static const char *tag_modified = "";
static const char *tag_skip_worktree = "";
static const char *tag_resolve_undo = "";
static void write_eolinfo(const struct cache_entry *ce, const char *path)
{
if (!show_eol)
return;
else {
struct stat st;
const char *i_txt = "";
const char *w_txt = "";
const char *a_txt = get_convert_attr_ascii(path);
if (ce && S_ISREG(ce->ce_mode))
i_txt = get_cached_convert_stats_ascii(ce->name);
if (!lstat(path, &st) && S_ISREG(st.st_mode))
w_txt = get_wt_convert_stats_ascii(path);
printf("i/%-5s w/%-5s attr/%-17s\t", i_txt, w_txt, a_txt);
}
}
static void write_name(const char *name)
{
/*
@ -68,6 +86,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
return;
fputs(tag, stdout);
write_eolinfo(NULL, ent->name);
write_name(ent->name);
}
@ -170,6 +189,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
find_unique_abbrev(ce->sha1,abbrev),
ce_stage(ce));
}
write_eolinfo(ce, ce->name);
write_name(ce->name);
if (debug_mode) {
const struct stat_data *sd = &ce->ce_stat_data;
@ -359,14 +379,6 @@ static const char * const ls_files_usage[] = {
NULL
};
static int option_parse_z(const struct option *opt,
const char *arg, int unset)
{
line_terminator = unset ? '\n' : '\0';
return 0;
}
static int option_parse_exclude(const struct option *opt,
const char *arg, int unset)
{
@ -408,9 +420,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
struct exclude_list *el;
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
struct option builtin_ls_files_options[] = {
{ OPTION_CALLBACK, 'z', NULL, NULL, NULL,
N_("paths are separated with NUL character"),
PARSE_OPT_NOARG, option_parse_z },
/* Think twice before adding "--nul" synonym to this */
OPT_SET_INT('z', NULL, &line_terminator,
N_("paths are separated with NUL character"), '\0'),
OPT_BOOL('t', NULL, &show_tag,
N_("identify the file status with tags")),
OPT_BOOL('v', NULL, &show_valid_bit,
@ -433,6 +445,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
OPT_BIT(0, "directory", &dir.flags,
N_("show 'other' directories' names only"),
DIR_SHOW_OTHER_DIRECTORIES),
OPT_BOOL(0, "eol", &show_eol, N_("show line endings of files")),
OPT_NEGBIT(0, "empty-directory", &dir.flags,
N_("don't show empty directories"),
DIR_HIDE_EMPTY_DIRECTORIES),

View File

@ -3,9 +3,12 @@
#include "transport.h"
#include "remote.h"
static const char ls_remote_usage[] =
"git ls-remote [--heads] [--tags] [--upload-pack=<exec>]\n"
" [-q | --quiet] [--exit-code] [--get-url] [<repository> [<refs>...]]";
static const char * const ls_remote_usage[] = {
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
" [-q | --quiet] [--exit-code] [--get-url]\n"
" [--symref] [<repository> [<refs>...]]"),
NULL
};
/*
* Is there one among the list of patterns that match the tail part
@ -30,12 +33,12 @@ static int tail_match(const char **pattern, const char *path)
int cmd_ls_remote(int argc, const char **argv, const char *prefix)
{
int i;
const char *dest = NULL;
unsigned flags = 0;
int get_url = 0;
int quiet = 0;
int status = 0;
int show_symref_target = 0;
const char *uploadpack = NULL;
const char **pattern = NULL;
@ -43,59 +46,36 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
struct transport *transport;
const struct ref *ref;
if (argc == 2 && !strcmp("-h", argv[1]))
usage(ls_remote_usage);
struct option options[] = {
OPT__QUIET(&quiet, N_("do not print remote URL")),
OPT_STRING(0, "upload-pack", &uploadpack, N_("exec"),
N_("path of git-upload-pack on the remote host")),
{ OPTION_STRING, 0, "exec", &uploadpack, N_("exec"),
N_("path of git-upload-pack on the remote host"),
PARSE_OPT_HIDDEN },
OPT_BIT('t', "tags", &flags, N_("limit to tags"), REF_TAGS),
OPT_BIT('h', "heads", &flags, N_("limit to heads"), REF_HEADS),
OPT_BIT(0, "refs", &flags, N_("do not show peeled tags"), REF_NORMAL),
OPT_BOOL(0, "get-url", &get_url,
N_("take url.<base>.insteadOf into account")),
OPT_SET_INT(0, "exit-code", &status,
N_("exit with exit code 2 if no matching refs are found"), 2),
OPT_BOOL(0, "symref", &show_symref_target,
N_("show underlying ref in addition to the object pointed by it")),
OPT_END()
};
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
argc = parse_options(argc, argv, prefix, options, ls_remote_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
dest = argv[0];
if (*arg == '-') {
if (starts_with(arg, "--upload-pack=")) {
uploadpack = arg + 14;
continue;
}
if (starts_with(arg, "--exec=")) {
uploadpack = arg + 7;
continue;
}
if (!strcmp("--tags", arg) || !strcmp("-t", arg)) {
flags |= REF_TAGS;
continue;
}
if (!strcmp("--heads", arg) || !strcmp("-h", arg)) {
flags |= REF_HEADS;
continue;
}
if (!strcmp("--refs", arg)) {
flags |= REF_NORMAL;
continue;
}
if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) {
quiet = 1;
continue;
}
if (!strcmp("--get-url", arg)) {
get_url = 1;
continue;
}
if (!strcmp("--exit-code", arg)) {
/* return this code if no refs are reported */
status = 2;
continue;
}
usage(ls_remote_usage);
}
dest = arg;
i++;
break;
if (argc > 1) {
int i;
pattern = xcalloc(argc, sizeof(const char *));
for (i = 1; i < argc; i++)
pattern[i - 1] = xstrfmt("*/%s", argv[i]);
}
if (argv[i]) {
int j;
pattern = xcalloc(argc - i + 1, sizeof(const char *));
for (j = i; j < argc; j++)
pattern[j - i] = xstrfmt("*/%s", argv[j]);
}
remote = remote_get(dest);
if (!remote) {
if (dest)
@ -125,7 +105,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
continue;
if (!tail_match(pattern, ref->name))
continue;
printf("%s %s\n", oid_to_hex(&ref->old_oid), ref->name);
if (show_symref_target && ref->symref)
printf("ref: %s\t%s\n", ref->symref, ref->name);
printf("%s\t%s\n", oid_to_hex(&ref->old_oid), ref->name);
status = 0; /* we found something */
}
return status;

View File

@ -252,7 +252,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
if (argc < 2)
usage_with_options(merge_base_usage, options);
rev = xmalloc(argc * sizeof(*rev));
ALLOC_ARRAY(rev, argc);
while (argc-- > 0)
rev[rev_nr++] = get_commit_reference(*argv++);
return show_merge_base(rev, rev_nr, show_all);

View File

@ -174,7 +174,7 @@ static struct merge_list *create_entry(unsigned stage, unsigned mode, const unsi
static char *traverse_path(const struct traverse_info *info, const struct name_entry *n)
{
char *path = xmalloc(traverse_path_len(info, n) + 1);
char *path = xmallocz(traverse_path_len(info, n));
return make_traverse_path(path, info, n);
}

View File

@ -404,6 +404,7 @@ static void finish(struct commit *head_commit,
* We ignore errors in 'gc --auto', since the
* user should see them.
*/
close_all_packs();
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
}
}
@ -938,7 +939,7 @@ static int setup_with_upstream(const char ***argv)
if (!branch->merge_nr)
die(_("No default upstream defined for the current branch."));
args = xcalloc(branch->merge_nr + 1, sizeof(char *));
args = xcalloc(st_add(branch->merge_nr, 1), sizeof(char *));
for (i = 0; i < branch->merge_nr; i++) {
if (!branch->merge[i]->dst)
die(_("No remote-tracking branch for %s from %s"),

View File

@ -19,16 +19,17 @@ static int alloc, used;
static void append_to_tree(unsigned mode, unsigned char *sha1, char *path)
{
struct treeent *ent;
int len = strlen(path);
size_t len = strlen(path);
if (strchr(path, '/'))
die("path %s contains slash", path);
ALLOC_GROW(entries, used + 1, alloc);
ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1);
FLEX_ALLOC_MEM(ent, name, path, len);
ent->mode = mode;
ent->len = len;
hashcpy(ent->sha1, sha1);
memcpy(ent->name, path, len+1);
ALLOC_GROW(entries, used + 1, alloc);
entries[used++] = ent;
}
static int ent_compare(const void *a_, const void *b_)
@ -65,7 +66,7 @@ static const char *mktree_usage[] = {
NULL
};
static void mktree_line(char *buf, size_t len, int line_termination, int allow_missing)
static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_missing)
{
char *ptr, *ntr;
unsigned mode;
@ -97,7 +98,7 @@ static void mktree_line(char *buf, size_t len, int line_termination, int allow_m
*ntr++ = 0; /* now at the beginning of SHA1 */
path = ntr + 41; /* at the beginning of name */
if (line_termination && path[0] == '"') {
if (!nul_term_line && path[0] == '"') {
struct strbuf p_uq = STRBUF_INIT;
if (unquote_c_style(&p_uq, path, NULL))
die("invalid quoting");
@ -141,23 +142,25 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
{
struct strbuf sb = STRBUF_INIT;
unsigned char sha1[20];
int line_termination = '\n';
int nul_term_line = 0;
int allow_missing = 0;
int is_batch_mode = 0;
int got_eof = 0;
strbuf_getline_fn getline_fn;
const struct option option[] = {
OPT_SET_INT('z', NULL, &line_termination, N_("input is NUL terminated"), '\0'),
OPT_BOOL('z', NULL, &nul_term_line, N_("input is NUL terminated")),
OPT_SET_INT( 0 , "missing", &allow_missing, N_("allow missing objects"), 1),
OPT_SET_INT( 0 , "batch", &is_batch_mode, N_("allow creation of more than one tree"), 1),
OPT_END()
};
ac = parse_options(ac, av, prefix, option, mktree_usage, 0);
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
while (!got_eof) {
while (1) {
if (strbuf_getline(&sb, stdin, line_termination) == EOF) {
if (getline_fn(&sb, stdin) == EOF) {
got_eof = 1;
break;
}
@ -167,7 +170,7 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
break;
die("input format error: (blank line only valid in batch mode)");
}
mktree_line(sb.buf, sb.len, line_termination, allow_missing);
mktree_line(sb.buf, sb.len, nul_term_line, allow_missing);
}
if (is_batch_mode && got_eof && used < 1) {
/*

Some files were not shown because too many files have changed in this diff Show More