mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Merge branch 'master' of git://repo.or.cz/alt-git
This commit is contained in:
36
Documentation/RelNotes-1.6.0.1.txt
Normal file
36
Documentation/RelNotes-1.6.0.1.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
GIT v1.6.0.1 Release Notes
|
||||
==========================
|
||||
|
||||
Fixes since v1.6.0
|
||||
------------------
|
||||
|
||||
* "git diff --cc" did not honor content mangling specified by
|
||||
gitattributes and core.autocrlf when reading from the work tree.
|
||||
|
||||
* "git diff --check" incorrectly detected new trailing blank lines when
|
||||
whitespace check was in effect.
|
||||
|
||||
* "git for-each-ref" tried to dereference NULL when asked for '%(body)" on
|
||||
a tag with a single incomplete line as its payload.
|
||||
|
||||
* "git format-patch" peeked before the beginning of a string when
|
||||
"format.headers" variable is empty (a misconfiguration).
|
||||
|
||||
* "git help help" did not work correctly.
|
||||
|
||||
* "git mailinfo" (hence "git am") was unhappy when MIME multipart message
|
||||
contained garbage after the finishing boundary.
|
||||
|
||||
* "git mailinfo" also was unhappy when the "From: " line only had a bare
|
||||
e-mail address.
|
||||
|
||||
* "git merge" did not refresh the index correctly when a merge resulted in
|
||||
a fast-forward.
|
||||
|
||||
* "git merge" did not resolve a truly trivial merges that can be done
|
||||
without content level merges.
|
||||
|
||||
* "git svn dcommit" to a repository with URL that has embedded usernames
|
||||
did not work correctly.
|
||||
|
||||
Contains other various documentation fixes.
|
||||
58
Documentation/RelNotes-1.6.1.txt
Normal file
58
Documentation/RelNotes-1.6.1.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
GIT v1.6.1 Release Notes
|
||||
========================
|
||||
|
||||
Updates since v1.6.0
|
||||
--------------------
|
||||
|
||||
When some commands (e.g. "git log", "git diff") spawn pager internally, we
|
||||
used to make the pager the parent process of the git command that produces
|
||||
output. This meant that the exit status of the whole thing comes from the
|
||||
pager, not the underlying git command. We swapped the order of the
|
||||
processes around and you will see the exit code from the command from now
|
||||
on.
|
||||
|
||||
(subsystems)
|
||||
|
||||
* ...
|
||||
|
||||
(portability)
|
||||
|
||||
* ...
|
||||
|
||||
(documentation)
|
||||
|
||||
* ...
|
||||
|
||||
(performance)
|
||||
|
||||
* The underlying diff machinery to produce textual output has been
|
||||
optimized, which would result in faster "git blame" processing.
|
||||
|
||||
(usability, bells and whistles)
|
||||
|
||||
* "git checkout --track origin/hack" used to be a syntax error. It now
|
||||
DWIMs to create a corresponding local branch "hack", i.e. acts as if you
|
||||
said "git checkout --track -b hack origin/hack".
|
||||
|
||||
* "git diff" learned to mimick --suppress-blank-empty from GNU diff via a
|
||||
configuration option.
|
||||
|
||||
* "git imap-send" can optionally talk SSL.
|
||||
|
||||
(internal)
|
||||
|
||||
* "git hash-object" learned to lie about the path being hashed, so that
|
||||
correct gitattributes processing can be done while hashing contents
|
||||
stored in a temporary file.
|
||||
|
||||
Fixes since v1.6.0
|
||||
------------------
|
||||
|
||||
All of the fixes in v1.6.0.X maintenance series are included in this
|
||||
release, unless otherwise noted.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.6.0-48-ge28a867
|
||||
echo O=$(git describe master)
|
||||
git shortlog --no-merges $O..master ^maint
|
||||
@@ -71,7 +71,7 @@ run git diff --check on your changes before you commit.
|
||||
|
||||
(1a) Try to be nice to older C compilers
|
||||
|
||||
We try to support wide range of C compilers to compile
|
||||
We try to support a wide range of C compilers to compile
|
||||
git with. That means that you should not use C99 initializers, even
|
||||
if a lot of compilers grok it.
|
||||
|
||||
|
||||
@@ -358,8 +358,13 @@ core.editor::
|
||||
`EDITOR` environment variables and then finally `vi`.
|
||||
|
||||
core.pager::
|
||||
The command that git will use to paginate output. Can be overridden
|
||||
with the `GIT_PAGER` environment variable.
|
||||
The command that git will use to paginate output. Can
|
||||
be overridden with the `GIT_PAGER` environment
|
||||
variable. Note that git sets the `LESS` environment
|
||||
variable to `FRSX` if it is unset when it runs the
|
||||
pager. One can change these settings by setting the
|
||||
`LESS` variable to some other value or by giving the
|
||||
`core.pager` option a value such as "`less -+FRSX`".
|
||||
|
||||
core.whitespace::
|
||||
A comma separated list of common whitespace problems to
|
||||
@@ -567,6 +572,10 @@ diff.autorefreshindex::
|
||||
affects only 'git-diff' Porcelain, and not lower level
|
||||
'diff' commands, such as 'git-diff-files'.
|
||||
|
||||
diff.suppress-blank-empty::
|
||||
A boolean to inhibit the standard behavior of printing a space
|
||||
before each empty output line. Defaults to false.
|
||||
|
||||
diff.external::
|
||||
If this config variable is set, diff generation is not
|
||||
performed using the internal diff machinery, but using the
|
||||
@@ -979,9 +988,11 @@ pack.packSizeLimit::
|
||||
linkgit:git-repack[1].
|
||||
|
||||
pager.<cmd>::
|
||||
Allows to set your own pager preferences for each command, overriding
|
||||
the default. If `\--pager` or `\--no-pager` is specified on the command
|
||||
line, it takes precedence over this option.
|
||||
Allows turning on or off pagination of the output of a
|
||||
particular git subcommand when writing to a tty. If
|
||||
`\--paginate` or `\--no-pager` is specified on the command line,
|
||||
it takes precedence over this option. To disable pagination for
|
||||
all commands, set `core.pager` or 'GIT_PAGER' to "`cat`".
|
||||
|
||||
pull.octopus::
|
||||
The default merge strategy to use when pulling multiple branches
|
||||
|
||||
@@ -107,9 +107,9 @@ endif::git-format-patch[]
|
||||
--exit-code.
|
||||
|
||||
--full-index::
|
||||
Instead of the first handful characters, show full
|
||||
object name of pre- and post-image blob on the "index"
|
||||
line when generating a patch format output.
|
||||
Instead of the first handful of characters, show the full
|
||||
pre- and post-image blob object names on the "index"
|
||||
line when generating patch format output.
|
||||
|
||||
--binary::
|
||||
In addition to --full-index, output "binary diff" that
|
||||
|
||||
@@ -8,7 +8,7 @@ git-checkout - Checkout a branch or paths to the working tree
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git checkout' [-q] [-f] [[--track | --no-track] -b <new_branch> [-l]] [-m] [<branch>]
|
||||
'git checkout' [-q] [-f] [--track | --no-track] [-b <new_branch> [-l]] [-m] [<branch>]
|
||||
'git checkout' [<tree-ish>] [--] <paths>...
|
||||
|
||||
DESCRIPTION
|
||||
@@ -21,6 +21,10 @@ specified, <new_branch>. Using -b will cause <new_branch> to
|
||||
be created; in this case you can use the --track or --no-track
|
||||
options, which will be passed to `git branch`.
|
||||
|
||||
As a convenience, --track will default to create a branch whose
|
||||
name is constructed from the specified branch name by stripping
|
||||
the first namespace level.
|
||||
|
||||
When <paths> are given, this command does *not* switch
|
||||
branches. It updates the named paths in the working tree from
|
||||
the index file (i.e. it runs `git checkout-index -f -u`), or
|
||||
@@ -59,6 +63,17 @@ OPTIONS
|
||||
'git-checkout' and 'git-branch' to always behave as if '--no-track' were
|
||||
given. Set it to `always` if you want this behavior when the
|
||||
start-point is either a local or remote branch.
|
||||
+
|
||||
If no '-b' option was given, the name of the new branch will be
|
||||
derived from the remote branch, by attempting to guess the name
|
||||
of the branch on remote system. If "remotes/" or "refs/remotes/"
|
||||
are prefixed, it is stripped away, and then the part up to the
|
||||
next slash (which would be the nickname of the remote) is removed.
|
||||
This would tell us to use "hack" as the local branch when branching
|
||||
off of "origin/hack" (or "remotes/origin/hack", or even
|
||||
"refs/remotes/origin/hack"). If the given name has no slash, or the above
|
||||
guessing results in an empty name, the guessing is aborted. You can
|
||||
exlicitly give a name with '-b' in such a case.
|
||||
|
||||
--no-track::
|
||||
Ignore the branch.autosetupmerge configuration variable.
|
||||
|
||||
@@ -21,8 +21,9 @@ OPTIONS
|
||||
--verbose::
|
||||
In addition to the number of loose objects and disk
|
||||
space consumed, it reports the number of in-pack
|
||||
objects, number of packs, and number of objects that can be
|
||||
removed by running `git prune-packed`.
|
||||
objects, number of packs, disk space consumed by those packs,
|
||||
and number of objects that can be removed by running
|
||||
`git prune-packed`.
|
||||
|
||||
|
||||
Author
|
||||
|
||||
@@ -11,7 +11,7 @@ SYNOPSIS
|
||||
SSH:
|
||||
|
||||
[verse]
|
||||
export CVS_SERVER=git-cvsserver
|
||||
export CVS_SERVER="git cvsserver"
|
||||
'cvs' -d :ext:user@server/path/repo.git co <HEAD_name>
|
||||
|
||||
pserver (/etc/inetd.conf):
|
||||
@@ -109,7 +109,7 @@ Note: Newer CVS versions (>= 1.12.11) also support specifying
|
||||
CVS_SERVER directly in CVSROOT like
|
||||
|
||||
------
|
||||
cvs -d ":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git" co <HEAD_name>
|
||||
cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co <HEAD_name>
|
||||
------
|
||||
This has the advantage that it will be saved in your 'CVS/Root' files and
|
||||
you don't need to worry about always setting the correct environment
|
||||
@@ -158,7 +158,7 @@ allowing access over SSH.
|
||||
--
|
||||
------
|
||||
export CVSROOT=:ext:user@server:/var/git/project.git
|
||||
export CVS_SERVER=git-cvsserver
|
||||
export CVS_SERVER="git cvsserver"
|
||||
------
|
||||
--
|
||||
4. For SSH clients that will make commits, make sure their server-side
|
||||
@@ -283,7 +283,7 @@ To get a checkout with the Eclipse CVS client:
|
||||
Protocol notes: If you are using anonymous access via pserver, just select that.
|
||||
Those using SSH access should choose the 'ext' protocol, and configure 'ext'
|
||||
access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to
|
||||
'git-cvsserver'. Note that password support is not good when using 'ext',
|
||||
"'git cvsserver'". Note that password support is not good when using 'ext',
|
||||
you will definitely want to have SSH keys setup.
|
||||
|
||||
Alternatively, you can just use the non-standard extssh protocol that Eclipse
|
||||
|
||||
@@ -49,13 +49,22 @@ include::diff-options.txt[]
|
||||
--stdin::
|
||||
When '--stdin' is specified, the command does not take
|
||||
<tree-ish> arguments from the command line. Instead, it
|
||||
reads either one <commit> or a list of <commit>
|
||||
separated with a single space from its standard input.
|
||||
reads lines containing either two <tree>, one <commit>, or a
|
||||
list of <commit> from its standard input. (Use a single space
|
||||
as separator.)
|
||||
+
|
||||
When a single commit is given on one line of such input, it compares
|
||||
the commit with its parents. The following flags further affects its
|
||||
behavior. The remaining commits, when given, are used as if they are
|
||||
When two trees are given, it compares the first tree with the second.
|
||||
When a single commit is given, it compares the commit with its
|
||||
parents. The remaining commits, when given, are used as if they are
|
||||
parents of the first commit.
|
||||
+
|
||||
When comparing two trees, the ID of both trees (separated by a space
|
||||
and terminated by a newline) is printed before the difference. When
|
||||
comparing commits, the ID of the first (or only) commit, followed by a
|
||||
newline, is printed.
|
||||
+
|
||||
The following flags further affects the behavior when comparing
|
||||
commits (but not trees).
|
||||
|
||||
-m::
|
||||
By default, 'git-diff-tree --stdin' does not show
|
||||
|
||||
@@ -8,7 +8,9 @@ git-hash-object - Compute object ID and optionally creates a blob from a file
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
'git hash-object' [-t <type>] [-w] [--stdin | --stdin-paths] [--] <file>...
|
||||
[verse]
|
||||
'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin] [--] <file>...
|
||||
'git hash-object' [-t <type>] [-w] --stdin-paths < <list-of-paths>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -35,6 +37,22 @@ OPTIONS
|
||||
--stdin-paths::
|
||||
Read file names from stdin instead of from the command-line.
|
||||
|
||||
--path::
|
||||
Hash object as it were located at the given path. The location of
|
||||
file does not directly influence on the hash value, but path is
|
||||
used to determine what git filters should be applied to the object
|
||||
before it can be placed to the object database, and, as result of
|
||||
applying filters, the actual blob put into the object database may
|
||||
differ from the given file. This option is mainly useful for hashing
|
||||
temporary files located outside of the working directory or files
|
||||
read from stdin.
|
||||
|
||||
--no-filters::
|
||||
Hash the contents as is, ignoring any input filter that would
|
||||
have been chosen by the attributes mechanism, including crlf
|
||||
conversion. If the file is read from standard input then this
|
||||
is always implied, unless the --path option is given.
|
||||
|
||||
Author
|
||||
------
|
||||
Written by Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
@@ -3,7 +3,7 @@ git-imap-send(1)
|
||||
|
||||
NAME
|
||||
----
|
||||
git-imap-send - Dump a mailbox from stdin into an imap folder
|
||||
git-imap-send - Send a collection of patches from stdin to an IMAP folder
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
@@ -13,9 +13,9 @@ SYNOPSIS
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This command uploads a mailbox generated with git-format-patch
|
||||
into an imap drafts folder. This allows patches to be sent as
|
||||
other email is sent with mail clients that cannot read mailbox
|
||||
This command uploads a mailbox generated with 'git-format-patch'
|
||||
into an IMAP drafts folder. This allows patches to be sent as
|
||||
other email is when using mail clients that cannot read mailbox
|
||||
files directly.
|
||||
|
||||
Typical usage is something like:
|
||||
@@ -26,21 +26,75 @@ git format-patch --signoff --stdout --attach origin | git imap-send
|
||||
CONFIGURATION
|
||||
-------------
|
||||
|
||||
'git-imap-send' requires the following values in the repository
|
||||
configuration file (shown with examples):
|
||||
To use the tool, imap.folder and either imap.tunnel or imap.host must be set
|
||||
to appropriate values.
|
||||
|
||||
Variables
|
||||
~~~~~~~~~
|
||||
|
||||
imap.folder::
|
||||
The folder to drop the mails into, which is typically the Drafts
|
||||
folder. For example: "INBOX.Drafts", "INBOX/Drafts" or
|
||||
"[Gmail]/Drafts". Required to use imap-send.
|
||||
|
||||
imap.tunnel::
|
||||
Command used to setup a tunnel to the IMAP server through which
|
||||
commands will be piped instead of using a direct network connection
|
||||
to the server. Required when imap.host is not set to use imap-send.
|
||||
|
||||
imap.host::
|
||||
A URL identifying the server. Use a `imap://` prefix for non-secure
|
||||
connections and a `imaps://` prefix for secure connections.
|
||||
Ignored when imap.tunnel is set, but required to use imap-send
|
||||
otherwise.
|
||||
|
||||
imap.user::
|
||||
The username to use when logging in to the server.
|
||||
|
||||
imap.password::
|
||||
The password to use when logging in to the server.
|
||||
|
||||
imap.port::
|
||||
An integer port number to connect to on the server.
|
||||
Defaults to 143 for imap:// hosts and 993 for imaps:// hosts.
|
||||
Ignored when imap.tunnel is set.
|
||||
|
||||
imap.sslverify::
|
||||
A boolean to enable/disable verification of the server certificate
|
||||
used by the SSL/TLS connection. Default is `true`. Ignored when
|
||||
imap.tunnel is set.
|
||||
|
||||
Examples
|
||||
~~~~~~~~
|
||||
|
||||
Using tunnel mode:
|
||||
|
||||
..........................
|
||||
[imap]
|
||||
Folder = "INBOX.Drafts"
|
||||
folder = "INBOX.Drafts"
|
||||
tunnel = "ssh -q -C user@example.com /usr/bin/imapd ./Maildir 2> /dev/null"
|
||||
..........................
|
||||
|
||||
[imap]
|
||||
Tunnel = "ssh -q user@server.com /usr/bin/imapd ./Maildir 2> /dev/null"
|
||||
Using direct mode:
|
||||
|
||||
.........................
|
||||
[imap]
|
||||
Host = imap.server.com
|
||||
User = bob
|
||||
Pass = pwd
|
||||
Port = 143
|
||||
folder = "INBOX.Drafts"
|
||||
host = imap://imap.example.com
|
||||
user = bob
|
||||
pass = p4ssw0rd
|
||||
..........................
|
||||
|
||||
Using direct mode with SSL:
|
||||
|
||||
.........................
|
||||
[imap]
|
||||
folder = "INBOX.Drafts"
|
||||
host = imaps://imap.example.com
|
||||
user = bob
|
||||
pass = p4ssw0rd
|
||||
port = 123
|
||||
sslverify = false
|
||||
..........................
|
||||
|
||||
|
||||
|
||||
@@ -8,26 +8,81 @@ git-merge-base - Find as good common ancestors as possible for a merge
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
'git merge-base' [--all] <commit> <commit>
|
||||
'git merge-base' [--all] <commit> <commit>...
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
'git-merge-base' finds as good a common ancestor as possible between
|
||||
the two commits. That is, given two commits A and B, `git merge-base A
|
||||
B` will output a commit which is reachable from both A and B through
|
||||
the parent relationship.
|
||||
'git-merge-base' finds best common ancestor(s) between two commits to use
|
||||
in a three-way merge. One common ancestor is 'better' than another common
|
||||
ancestor if the latter is an ancestor of the former. A common ancestor
|
||||
that does not have any better common ancestor than it is a 'best common
|
||||
ancestor', i.e. a 'merge base'. Note that there can be more than one
|
||||
merge bases between two commits.
|
||||
|
||||
Given a selection of equally good common ancestors it should not be
|
||||
relied on to decide in any particular way.
|
||||
|
||||
The 'git-merge-base' algorithm is still in flux - use the source...
|
||||
Among the two commits to compute their merge bases, one is specified by
|
||||
the first commit argument on the command line; the other commit is a
|
||||
(possibly hypothetical) commit that is a merge across all the remaining
|
||||
commits on the command line. As the most common special case, giving only
|
||||
two commits from the command line means computing the merge base between
|
||||
the given two commits.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
--all::
|
||||
Output all common ancestors for the two commits instead of
|
||||
just one.
|
||||
Output all merge bases for the commits, instead of just one.
|
||||
|
||||
DISCUSSION
|
||||
----------
|
||||
|
||||
Given two commits 'A' and 'B', `git merge-base A B` will output a commit
|
||||
which is reachable from both 'A' and 'B' through the parent relationship.
|
||||
|
||||
For example, with this topology:
|
||||
|
||||
o---o---o---B
|
||||
/
|
||||
---o---1---o---o---o---A
|
||||
|
||||
the merge base between 'A' and 'B' is '1'.
|
||||
|
||||
Given three commits 'A', 'B' and 'C', `git merge-base A B C` will compute the
|
||||
merge base between 'A' and an hypothetical commit 'M', which is a merge
|
||||
between 'B' and 'C'. For example, with this topology:
|
||||
|
||||
o---o---o---o---C
|
||||
/
|
||||
/ o---o---o---B
|
||||
/ /
|
||||
---2---1---o---o---o---A
|
||||
|
||||
the result of `git merge-base A B C` is '1'. This is because the
|
||||
equivalent topology with a merge commit 'M' between 'B' and 'C' is:
|
||||
|
||||
|
||||
o---o---o---o---o
|
||||
/ \
|
||||
/ o---o---o---o---M
|
||||
/ /
|
||||
---2---1---o---o---o---A
|
||||
|
||||
and the result of `git merge-base A M` is '1'. Commit '2' is also a
|
||||
common ancestor between 'A' and 'M', but '1' is a better common ancestor,
|
||||
because '2' is an ancestor of '1'. Hence, '2' is not a merge base.
|
||||
|
||||
When the history involves criss-cross merges, there can be more than one
|
||||
'best' common ancestors between two commits. For example, with this
|
||||
topology:
|
||||
|
||||
---1---o---A
|
||||
\ /
|
||||
X
|
||||
/ \
|
||||
---2---o---o---B
|
||||
|
||||
both '1' and '2' are merge-base of A and B. Neither one is better than
|
||||
the other (both are 'best' merge base). When `--all` option is not given,
|
||||
it is unspecified which best one is output.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
@@ -126,13 +126,25 @@ After seeing a conflict, you can do two things:
|
||||
up working tree changes made by 2. and 3.; 'git-reset --hard' can
|
||||
be used for this.
|
||||
|
||||
* Resolve the conflicts. `git diff` would report only the
|
||||
conflicting paths because of the above 2. and 3.
|
||||
Edit the working tree files into a desirable shape
|
||||
('git mergetool' can ease this task), 'git-add' or 'git-rm'
|
||||
them, to make the index file contain what the merge result
|
||||
should be, and run 'git-commit' to commit the result.
|
||||
* Resolve the conflicts. Git will mark the conflicts in
|
||||
the working tree. Edit the files into shape and
|
||||
'git-add' to the index. 'git-commit' to seal the deal.
|
||||
|
||||
You can work through the conflict with a number of tools:
|
||||
|
||||
* Use a mergetool. 'git mergetool' to launch a graphical
|
||||
mergetool which will work you through the merge.
|
||||
|
||||
* Look at the diffs. 'git diff' will show a three-way diff,
|
||||
highlighting changes from both the HEAD and remote versions.
|
||||
|
||||
* Look at the diffs on their own. 'git log --merge -p <path>'
|
||||
will show diffs first for the HEAD version and then the
|
||||
remote version.
|
||||
|
||||
* Look at the originals. 'git show :1:filename' shows the
|
||||
common ancestor, 'git show :2:filename' shows the HEAD
|
||||
version and 'git show :3:filename' shows the remote version.
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
@@ -15,6 +15,15 @@ Given one existing commit, revert the change the patch introduces, and record a
|
||||
new commit that records it. This requires your working tree to be clean (no
|
||||
modifications from the HEAD commit).
|
||||
|
||||
Note: 'git revert' is used to record a new commit to reverse the
|
||||
effect of an earlier commit (often a faulty one). If you want to
|
||||
throw away all uncommitted changes in your working directory, you
|
||||
should see linkgit:git-reset[1], particularly the '--hard' option. If
|
||||
you want to extract specific files as they were in another commit, you
|
||||
should see linkgit:git-checkout[1], specifically the 'git checkout
|
||||
<commit> -- <filename>' syntax. Take care with these alternatives as
|
||||
both will discard uncommitted changes in your working directory.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
<commit>::
|
||||
|
||||
@@ -14,6 +14,7 @@ SYNOPSIS
|
||||
'git submodule' [--quiet] init [--] [<path>...]
|
||||
'git submodule' [--quiet] update [--init] [--] [<path>...]
|
||||
'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
|
||||
'git submodule' [--quiet] foreach <command>
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
@@ -123,6 +124,22 @@ summary::
|
||||
in the submodule between the given super project commit and the
|
||||
index or working tree (switched by --cached) are shown.
|
||||
|
||||
foreach::
|
||||
Evaluates an arbitrary shell command in each checked out submodule.
|
||||
The command has access to the variables $path and $sha1:
|
||||
$path is the name of the submodule directory relative to the
|
||||
superproject, and $sha1 is the commit as recorded in the superproject.
|
||||
Any submodules defined in the superproject but not checked out are
|
||||
ignored by this command. Unless given --quiet, foreach prints the name
|
||||
of each submodule before evaluating the command.
|
||||
A non-zero return from the command in any submodule causes
|
||||
the processing to terminate. This can be overridden by adding '|| :'
|
||||
to the end of the command.
|
||||
+
|
||||
As an example, "git submodule foreach 'echo $path `git rev-parse HEAD`' will
|
||||
show the path and currently checked out commit for each submodule.
|
||||
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
-q::
|
||||
|
||||
@@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master'
|
||||
branch of the `git.git` repository.
|
||||
Documentation for older releases are available here:
|
||||
|
||||
* link:v1.6.0/git.html[documentation for release 1.6.0]
|
||||
* link:v1.6.1/git.html[documentation for release 1.6.1]
|
||||
|
||||
* release notes for
|
||||
link:RelNotes-1.6.1.txt[1.6.1],
|
||||
link:RelNotes-1.6.0.txt[1.6.0].
|
||||
|
||||
* link:v1.5.6.5/git.html[documentation for release 1.5.6.5]
|
||||
@@ -497,7 +498,8 @@ other
|
||||
'GIT_PAGER'::
|
||||
This environment variable overrides `$PAGER`. If it is set
|
||||
to an empty string or to the value "cat", git will not launch
|
||||
a pager.
|
||||
a pager. See also the `core.pager` option in
|
||||
linkgit:git-config[1].
|
||||
|
||||
'GIT_SSH'::
|
||||
If this environment variable is set then 'git-fetch'
|
||||
|
||||
@@ -316,10 +316,14 @@ patterns are available:
|
||||
|
||||
- `pascal` suitable for source code in the Pascal/Delphi language.
|
||||
|
||||
- `python` suitable for source code in the Python language.
|
||||
|
||||
- `ruby` suitable for source code in the Ruby language.
|
||||
|
||||
- `tex` suitable for source code for LaTeX documents.
|
||||
|
||||
- `html` suitable for HTML/XHTML documents.
|
||||
|
||||
|
||||
Performing a three-way merge
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
50
Makefile
50
Makefile
@@ -124,6 +124,9 @@ all::
|
||||
# Define USE_STDEV below if you want git to care about the underlying device
|
||||
# change being considered an inode change from the update-index perspective.
|
||||
#
|
||||
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
|
||||
# field that counts the on-disk footprint in 512-byte blocks.
|
||||
#
|
||||
# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
|
||||
#
|
||||
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
|
||||
@@ -333,7 +336,6 @@ endif
|
||||
export PERL_PATH
|
||||
|
||||
LIB_FILE=libgit.a
|
||||
COMPAT_LIB = compat/lib.a
|
||||
XDIFF_LIB=xdiff/lib.a
|
||||
|
||||
LIB_H += archive.h
|
||||
@@ -575,9 +577,11 @@ EXTLIBS =
|
||||
|
||||
ifeq ($(uname_S),Linux)
|
||||
NO_STRLCPY = YesPlease
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),GNU/kFreeBSD)
|
||||
NO_STRLCPY = YesPlease
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),UnixWare)
|
||||
CC = cc
|
||||
@@ -675,6 +679,7 @@ ifeq ($(uname_S),FreeBSD)
|
||||
BASIC_CFLAGS += -I/usr/local/include
|
||||
BASIC_LDFLAGS += -L/usr/local/lib
|
||||
DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),OpenBSD)
|
||||
NO_STRCASESTR = YesPlease
|
||||
@@ -682,6 +687,7 @@ ifeq ($(uname_S),OpenBSD)
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
BASIC_CFLAGS += -I/usr/local/include
|
||||
BASIC_LDFLAGS += -L/usr/local/lib
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),NetBSD)
|
||||
ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
|
||||
@@ -690,6 +696,7 @@ ifeq ($(uname_S),NetBSD)
|
||||
BASIC_CFLAGS += -I/usr/pkg/include
|
||||
BASIC_LDFLAGS += -L/usr/pkg/lib
|
||||
ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),AIX)
|
||||
NO_STRCASESTR=YesPlease
|
||||
@@ -727,6 +734,7 @@ ifeq ($(uname_S),HP-UX)
|
||||
NO_UNSETENV = YesPlease
|
||||
NO_HSTRERROR = YesPlease
|
||||
NO_SYS_SELECT_H = YesPlease
|
||||
SNPRINTF_RETURNS_BOGUS = YesPlease
|
||||
endif
|
||||
ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_MMAP = YesPlease
|
||||
@@ -749,6 +757,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_SVN_TESTS = YesPlease
|
||||
NO_PERL_MAKEMAKER = YesPlease
|
||||
NO_POSIX_ONLY_PROGRAMS = YesPlease
|
||||
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
|
||||
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
|
||||
COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
|
||||
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
|
||||
@@ -863,6 +872,9 @@ endif
|
||||
ifdef NO_D_INO_IN_DIRENT
|
||||
BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
|
||||
endif
|
||||
ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
|
||||
BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
|
||||
endif
|
||||
ifdef NO_C99_FORMAT
|
||||
BASIC_CFLAGS += -DNO_C99_FORMAT
|
||||
endif
|
||||
@@ -1098,7 +1110,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS
|
||||
'-DGIT_INFO_PATH="$(infodir_SQ)"' $<
|
||||
|
||||
$(BUILT_INS): git$X
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && \
|
||||
ln git$X $@ 2>/dev/null || \
|
||||
ln -s git$X $@ 2>/dev/null || \
|
||||
cp git$X $@
|
||||
|
||||
common-cmds.h: ./generate-cmdlist.sh command-list.txt
|
||||
|
||||
@@ -1215,7 +1230,9 @@ endif
|
||||
git-%$X: %.o $(GITLIBS)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
|
||||
|
||||
git-imap-send$X: imap-send.o $(LIB_FILE)
|
||||
git-imap-send$X: imap-send.o $(GITLIBS)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
||||
$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
|
||||
|
||||
http.o http-walker.o http-push.o transport.o: http.h
|
||||
|
||||
@@ -1223,12 +1240,6 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
||||
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
|
||||
|
||||
$(COMPAT_LIB): $(COMPAT_OBJS)
|
||||
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(COMPAT_OBJS)
|
||||
|
||||
git-shell$X: abspath.o ctype.o exec_cmd.o quote.o strbuf.o usage.o wrapper.o shell.o $(COMPAT_LIB)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(COMPAT_LIB)
|
||||
|
||||
$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
|
||||
$(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
|
||||
builtin-revert.o wt-status.o: wt-status.h
|
||||
@@ -1351,7 +1362,7 @@ install: all
|
||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
||||
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
||||
$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
||||
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
|
||||
ifndef NO_TCLTK
|
||||
@@ -1363,16 +1374,13 @@ ifneq (,$X)
|
||||
endif
|
||||
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
|
||||
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
|
||||
if test "z$$bindir" != "z$$execdir"; \
|
||||
then \
|
||||
ln -f "$$bindir/git$X" "$$execdir/git$X" || \
|
||||
cp "$$bindir/git$X" "$$execdir/git$X"; \
|
||||
fi && \
|
||||
{ $(foreach p,$(BUILT_INS), $(RM) "$$execdir/$p" && ln "$$execdir/git$X" "$$execdir/$p" ;) } && \
|
||||
if test "z$$bindir" != "z$$execdir"; \
|
||||
then \
|
||||
$(RM) "$$execdir/git$X"; \
|
||||
fi && \
|
||||
{ $(RM) "$$execdir/git-add$X" && \
|
||||
ln git-add$X "$$execdir/git-add$X" 2>/dev/null || \
|
||||
cp git-add$X "$$execdir/git-add$X"; } && \
|
||||
{ $(foreach p,$(filter-out git-add,$(BUILT_INS)), $(RM) "$$execdir/$p" && \
|
||||
ln "$$execdir/git-add$X" "$$execdir/$p" 2>/dev/null || \
|
||||
ln -s "git-add$X" "$$execdir/$p" 2>/dev/null || \
|
||||
cp "$$execdir/git-add$X" "$$execdir/$p" || exit;) } && \
|
||||
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
|
||||
|
||||
install-doc:
|
||||
@@ -1441,7 +1449,7 @@ distclean: clean
|
||||
|
||||
clean:
|
||||
$(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
|
||||
$(LIB_FILE) $(XDIFF_LIB) $(COMPAT_LIB)
|
||||
$(LIB_FILE) $(XDIFF_LIB)
|
||||
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
|
||||
$(RM) $(TEST_PROGRAMS)
|
||||
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
|
||||
|
||||
@@ -153,6 +153,16 @@ static const char **validate_pathspec(int argc, const char **argv, const char *p
|
||||
{
|
||||
const char **pathspec = get_pathspec(prefix, argv);
|
||||
|
||||
if (pathspec) {
|
||||
const char **p;
|
||||
for (p = pathspec; *p; p++) {
|
||||
if (has_symlink_leading_path(strlen(*p), *p)) {
|
||||
int len = prefix ? strlen(prefix) : 0;
|
||||
die("'%s' is beyond a symbolic link", *p + len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pathspec;
|
||||
}
|
||||
|
||||
@@ -278,7 +288,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
|
||||
return 0;
|
||||
}
|
||||
pathspec = get_pathspec(prefix, argv);
|
||||
pathspec = validate_pathspec(argc, argv, prefix);
|
||||
|
||||
/*
|
||||
* If we are adding new files, we need to scan the working
|
||||
|
||||
@@ -465,7 +465,6 @@ struct patch {
|
||||
};
|
||||
|
||||
struct blame_diff_state {
|
||||
struct xdiff_emit_state xm;
|
||||
struct patch *ret;
|
||||
unsigned hunk_post_context;
|
||||
unsigned hunk_in_pre_context : 1;
|
||||
@@ -528,15 +527,12 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,
|
||||
xpp.flags = xdl_opts;
|
||||
memset(&xecfg, 0, sizeof(xecfg));
|
||||
xecfg.ctxlen = context;
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &state;
|
||||
memset(&state, 0, sizeof(state));
|
||||
state.xm.consume = process_u_diff;
|
||||
state.ret = xmalloc(sizeof(struct patch));
|
||||
state.ret->chunks = NULL;
|
||||
state.ret->num = 0;
|
||||
|
||||
xdi_diff(file_p, file_o, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(file_p, file_o, process_u_diff, &state, &xpp, &xecfg, &ecb);
|
||||
|
||||
if (state.ret->num) {
|
||||
struct chunk *chunk;
|
||||
|
||||
@@ -157,7 +157,7 @@ struct checkout_opts {
|
||||
int force;
|
||||
int writeout_error;
|
||||
|
||||
char *new_branch;
|
||||
const char *new_branch;
|
||||
int new_branch_log;
|
||||
enum branch_track track;
|
||||
};
|
||||
@@ -437,13 +437,28 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
opts.track = git_branch_track;
|
||||
opts.track = BRANCH_TRACK_UNSPECIFIED;
|
||||
|
||||
argc = parse_options(argc, argv, options, checkout_usage,
|
||||
PARSE_OPT_KEEP_DASHDASH);
|
||||
|
||||
if (!opts.new_branch && (opts.track != git_branch_track))
|
||||
die("git checkout: --track and --no-track require -b");
|
||||
/* --track without -b should DWIM */
|
||||
if (0 < opts.track && !opts.new_branch) {
|
||||
const char *argv0 = argv[0];
|
||||
if (!argc || !strcmp(argv0, "--"))
|
||||
die ("--track needs a branch name");
|
||||
if (!prefixcmp(argv0, "refs/"))
|
||||
argv0 += 5;
|
||||
if (!prefixcmp(argv0, "remotes/"))
|
||||
argv0 += 8;
|
||||
argv0 = strchr(argv0, '/');
|
||||
if (!argv0 || !argv0[1])
|
||||
die ("Missing branch name; try -b");
|
||||
opts.new_branch = argv0 + 1;
|
||||
}
|
||||
|
||||
if (opts.track == BRANCH_TRACK_UNSPECIFIED)
|
||||
opts.track = git_branch_track;
|
||||
|
||||
if (opts.force && opts.merge)
|
||||
die("git checkout: -f and -m are incompatible");
|
||||
|
||||
@@ -48,6 +48,7 @@ static const char commit_utf8_warn[] =
|
||||
int commit_tree(const char *msg, unsigned char *tree,
|
||||
struct commit_list *parents, unsigned char *ret)
|
||||
{
|
||||
int result;
|
||||
int encoding_is_utf8;
|
||||
struct strbuf buffer;
|
||||
|
||||
@@ -86,7 +87,9 @@ int commit_tree(const char *msg, unsigned char *tree,
|
||||
if (encoding_is_utf8 && !is_utf8(buffer.buf))
|
||||
fprintf(stderr, commit_utf8_warn);
|
||||
|
||||
return write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
|
||||
result = write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
|
||||
strbuf_release(&buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
int cmd_commit_tree(int argc, const char **argv, const char *prefix)
|
||||
|
||||
@@ -43,7 +43,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
|
||||
if (lstat(path, &st) || !S_ISREG(st.st_mode))
|
||||
bad = 1;
|
||||
else
|
||||
(*loose_size) += xsize_t(st.st_blocks);
|
||||
(*loose_size) += xsize_t(on_disk_bytes(st));
|
||||
}
|
||||
if (bad) {
|
||||
if (verbose) {
|
||||
@@ -104,6 +104,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
|
||||
if (verbose) {
|
||||
struct packed_git *p;
|
||||
unsigned long num_pack = 0;
|
||||
unsigned long size_pack = 0;
|
||||
if (!packed_git)
|
||||
prepare_packed_git();
|
||||
for (p = packed_git; p; p = p->next) {
|
||||
@@ -112,12 +113,14 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
|
||||
if (open_pack_index(p))
|
||||
continue;
|
||||
packed += p->num_objects;
|
||||
size_pack += p->pack_size + p->index_size;
|
||||
num_pack++;
|
||||
}
|
||||
printf("count: %lu\n", loose);
|
||||
printf("size: %lu\n", loose_size / 2);
|
||||
printf("size: %lu\n", loose_size / 1024);
|
||||
printf("in-pack: %lu\n", packed);
|
||||
printf("packs: %lu\n", num_pack);
|
||||
printf("size-pack: %lu\n", size_pack / 1024);
|
||||
printf("prune-packable: %lu\n", packed_loose);
|
||||
printf("garbage: %lu\n", garbage);
|
||||
}
|
||||
|
||||
@@ -14,20 +14,10 @@ static int diff_tree_commit_sha1(const unsigned char *sha1)
|
||||
return log_tree_commit(&log_tree_opt, commit);
|
||||
}
|
||||
|
||||
static int diff_tree_stdin(char *line)
|
||||
/* Diff one or more commits. */
|
||||
static int stdin_diff_commit(struct commit *commit, char *line, int len)
|
||||
{
|
||||
int len = strlen(line);
|
||||
unsigned char sha1[20];
|
||||
struct commit *commit;
|
||||
|
||||
if (!len || line[len-1] != '\n')
|
||||
return -1;
|
||||
line[len-1] = 0;
|
||||
if (get_sha1_hex(line, sha1))
|
||||
return -1;
|
||||
commit = lookup_commit(sha1);
|
||||
if (!commit || parse_commit(commit))
|
||||
return -1;
|
||||
if (isspace(line[40]) && !get_sha1_hex(line+41, sha1)) {
|
||||
/* Graft the fake parents locally to the commit */
|
||||
int pos = 41;
|
||||
@@ -52,6 +42,48 @@ static int diff_tree_stdin(char *line)
|
||||
return log_tree_commit(&log_tree_opt, commit);
|
||||
}
|
||||
|
||||
/* Diff two trees. */
|
||||
static int stdin_diff_trees(struct tree *tree1, char *line, int len)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
struct tree *tree2;
|
||||
if (len != 82 || !isspace(line[40]) || get_sha1_hex(line + 41, sha1))
|
||||
return error("Need exactly two trees, separated by a space");
|
||||
tree2 = lookup_tree(sha1);
|
||||
if (!tree2 || parse_tree(tree2))
|
||||
return -1;
|
||||
printf("%s %s\n", sha1_to_hex(tree1->object.sha1),
|
||||
sha1_to_hex(tree2->object.sha1));
|
||||
diff_tree_sha1(tree1->object.sha1, tree2->object.sha1,
|
||||
"", &log_tree_opt.diffopt);
|
||||
log_tree_diff_flush(&log_tree_opt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int diff_tree_stdin(char *line)
|
||||
{
|
||||
int len = strlen(line);
|
||||
unsigned char sha1[20];
|
||||
struct object *obj;
|
||||
|
||||
if (!len || line[len-1] != '\n')
|
||||
return -1;
|
||||
line[len-1] = 0;
|
||||
if (get_sha1_hex(line, sha1))
|
||||
return -1;
|
||||
obj = lookup_object(sha1);
|
||||
obj = obj ? obj : parse_object(sha1);
|
||||
if (!obj)
|
||||
return -1;
|
||||
if (obj->type == OBJ_COMMIT)
|
||||
return stdin_diff_commit((struct commit *)obj, line, len);
|
||||
if (obj->type == OBJ_TREE)
|
||||
return stdin_diff_trees((struct tree *)obj, line, len);
|
||||
error("Object %s is a %s, not a commit or tree",
|
||||
sha1_to_hex(sha1), typename(obj->type));
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char diff_tree_usage[] =
|
||||
"git diff-tree [--stdin] [-m] [-c] [--cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
|
||||
"[<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n"
|
||||
|
||||
@@ -417,7 +417,8 @@ static void export_marks(char *file)
|
||||
for (i = 0; i < idnums.size; i++) {
|
||||
if (deco->base && deco->base->type == 1) {
|
||||
mark = ptr_to_mark(deco->decoration);
|
||||
fprintf(f, ":%u %s\n", mark, sha1_to_hex(deco->base->sha1));
|
||||
fprintf(f, ":%"PRIu32" %s\n", mark,
|
||||
sha1_to_hex(deco->base->sha1));
|
||||
}
|
||||
deco++;
|
||||
}
|
||||
|
||||
@@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
|
||||
return;
|
||||
*sub = buf; /* first non-empty line */
|
||||
buf = strchr(buf, '\n');
|
||||
if (!buf)
|
||||
if (!buf) {
|
||||
*body = "";
|
||||
return; /* no body */
|
||||
}
|
||||
while (*buf == '\n')
|
||||
buf++; /* skip blank between subject and body */
|
||||
*body = buf;
|
||||
|
||||
@@ -217,6 +217,11 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||
if (rev->early_output)
|
||||
finish_early_output(rev);
|
||||
|
||||
/*
|
||||
* For --check and --exit-code, the exit code is based on CHECK_FAILED
|
||||
* and HAS_CHANGES being accumulated in rev->diffopt, so be careful to
|
||||
* retain that state information if replacing rev->diffopt in this loop
|
||||
*/
|
||||
while ((commit = get_revision(rev)) != NULL) {
|
||||
log_tree_commit(rev, commit);
|
||||
if (!rev->reflog_info) {
|
||||
@@ -227,7 +232,11 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||
free_commit_list(commit->parents);
|
||||
commit->parents = NULL;
|
||||
}
|
||||
return 0;
|
||||
if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
|
||||
DIFF_OPT_TST(&rev->diffopt, CHECK_FAILED)) {
|
||||
return 02;
|
||||
}
|
||||
return diff_result_code(&rev->diffopt, 0);
|
||||
}
|
||||
|
||||
static int git_log_config(const char *var, const char *value, void *cb)
|
||||
@@ -461,7 +470,7 @@ static int extra_cc_alloc;
|
||||
static void add_header(const char *value)
|
||||
{
|
||||
int len = strlen(value);
|
||||
while (value[len - 1] == '\n')
|
||||
while (len && value[len - 1] == '\n')
|
||||
len--;
|
||||
if (!strncasecmp(value, "to: ", 4)) {
|
||||
ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);
|
||||
@@ -923,7 +932,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
if (argc > 1)
|
||||
die ("unrecognized argument: %s", argv[1]);
|
||||
|
||||
if (!rev.diffopt.output_format)
|
||||
if (!rev.diffopt.output_format
|
||||
|| rev.diffopt.output_format == DIFF_FORMAT_PATCH)
|
||||
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
|
||||
|
||||
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
|
||||
|
||||
@@ -107,7 +107,7 @@ static void handle_from(const struct strbuf *from)
|
||||
el = strcspn(at, " \n\t\r\v\f>");
|
||||
strbuf_reset(&email);
|
||||
strbuf_add(&email, at, el);
|
||||
strbuf_remove(&f, at - f.buf, el + 1);
|
||||
strbuf_remove(&f, at - f.buf, el + (at[el] ? 1 : 0));
|
||||
|
||||
/* The remainder is name. It could be "John Doe <john.doe@xz>"
|
||||
* or "john.doe@xz (John Doe)", but we have removed the
|
||||
@@ -175,7 +175,7 @@ static void handle_content_type(struct strbuf *line)
|
||||
message_type = TYPE_OTHER;
|
||||
if (slurp_attr(line->buf, "boundary=", boundary)) {
|
||||
strbuf_insert(boundary, 0, "--", 2);
|
||||
if (content_top++ >= &content[MAX_BOUNDARIES]) {
|
||||
if (++content_top > &content[MAX_BOUNDARIES]) {
|
||||
fprintf(stderr, "Too many boundaries to handle\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -603,7 +603,7 @@ static void handle_filter(struct strbuf *line);
|
||||
static int find_boundary(void)
|
||||
{
|
||||
while (!strbuf_getline(&line, fin, '\n')) {
|
||||
if (is_multipart_boundary(&line))
|
||||
if (*content_top && is_multipart_boundary(&line))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -626,7 +626,7 @@ again:
|
||||
/* technically won't happen as is_multipart_boundary()
|
||||
will fail first. But just in case..
|
||||
*/
|
||||
if (content_top-- < content) {
|
||||
if (--content_top < content) {
|
||||
fprintf(stderr, "Detected mismatched boundaries, "
|
||||
"can't recover\n");
|
||||
exit(1);
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
|
||||
static int show_merge_base(struct commit *rev1, struct commit *rev2, int show_all)
|
||||
static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
|
||||
{
|
||||
struct commit_list *result = get_merge_bases(rev1, rev2, 0);
|
||||
struct commit_list *result;
|
||||
|
||||
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1, 0);
|
||||
|
||||
if (!result)
|
||||
return 1;
|
||||
@@ -20,7 +22,7 @@ static int show_merge_base(struct commit *rev1, struct commit *rev2, int show_al
|
||||
}
|
||||
|
||||
static const char merge_base_usage[] =
|
||||
"git merge-base [--all] <commit-id> <commit-id>";
|
||||
"git merge-base [--all] <commit-id> <commit-id>...";
|
||||
|
||||
static struct commit *get_commit_reference(const char *arg)
|
||||
{
|
||||
@@ -38,7 +40,8 @@ static struct commit *get_commit_reference(const char *arg)
|
||||
|
||||
int cmd_merge_base(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct commit *rev1, *rev2;
|
||||
struct commit **rev;
|
||||
int rev_nr = 0;
|
||||
int show_all = 0;
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
@@ -51,10 +54,15 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
|
||||
usage(merge_base_usage);
|
||||
argc--; argv++;
|
||||
}
|
||||
if (argc != 3)
|
||||
if (argc < 3)
|
||||
usage(merge_base_usage);
|
||||
rev1 = get_commit_reference(argv[1]);
|
||||
rev2 = get_commit_reference(argv[2]);
|
||||
|
||||
return show_merge_base(rev1, rev2, show_all);
|
||||
rev = xmalloc((argc - 1) * sizeof(*rev));
|
||||
|
||||
do {
|
||||
rev[rev_nr++] = get_commit_reference(argv[1]);
|
||||
argc--; argv++;
|
||||
} while (argc > 1);
|
||||
|
||||
return show_merge_base(rev, rev_nr, show_all);
|
||||
}
|
||||
|
||||
@@ -729,13 +729,13 @@ static void conflict_rename_rename(struct rename *ren1,
|
||||
const char *dst_name2 = ren2_dst;
|
||||
if (string_list_has_string(¤t_directory_set, ren1_dst)) {
|
||||
dst_name1 = del[delp++] = unique_path(ren1_dst, branch1);
|
||||
output(1, "%s is a directory in %s added as %s instead",
|
||||
output(1, "%s is a directory in %s adding as %s instead",
|
||||
ren1_dst, branch2, dst_name1);
|
||||
remove_file(0, ren1_dst, 0);
|
||||
}
|
||||
if (string_list_has_string(¤t_directory_set, ren2_dst)) {
|
||||
dst_name2 = del[delp++] = unique_path(ren2_dst, branch2);
|
||||
output(1, "%s is a directory in %s added as %s instead",
|
||||
output(1, "%s is a directory in %s adding as %s instead",
|
||||
ren2_dst, branch1, dst_name2);
|
||||
remove_file(0, ren2_dst, 0);
|
||||
}
|
||||
@@ -760,7 +760,7 @@ static void conflict_rename_dir(struct rename *ren1,
|
||||
const char *branch1)
|
||||
{
|
||||
char *new_path = unique_path(ren1->pair->two->path, branch1);
|
||||
output(1, "Renamed %s to %s instead", ren1->pair->one->path, new_path);
|
||||
output(1, "Renaming %s to %s instead", ren1->pair->one->path, new_path);
|
||||
remove_file(0, ren1->pair->two->path, 0);
|
||||
update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new_path);
|
||||
free(new_path);
|
||||
@@ -773,7 +773,7 @@ static void conflict_rename_rename_2(struct rename *ren1,
|
||||
{
|
||||
char *new_path1 = unique_path(ren1->pair->two->path, branch1);
|
||||
char *new_path2 = unique_path(ren2->pair->two->path, branch2);
|
||||
output(1, "Renamed %s to %s and %s to %s instead",
|
||||
output(1, "Renaming %s to %s and %s to %s instead",
|
||||
ren1->pair->one->path, new_path1,
|
||||
ren2->pair->one->path, new_path2);
|
||||
remove_file(0, ren1->pair->two->path, 0);
|
||||
@@ -887,10 +887,10 @@ static int process_renames(struct string_list *a_renames,
|
||||
branch1,
|
||||
branch2);
|
||||
if (mfi.merge || !mfi.clean)
|
||||
output(1, "Renamed %s->%s", src, ren1_dst);
|
||||
output(1, "Renaming %s->%s", src, ren1_dst);
|
||||
|
||||
if (mfi.merge)
|
||||
output(2, "Auto-merged %s", ren1_dst);
|
||||
output(2, "Auto-merging %s", ren1_dst);
|
||||
|
||||
if (!mfi.clean) {
|
||||
output(1, "CONFLICT (content): merge conflict in %s",
|
||||
@@ -924,14 +924,14 @@ static int process_renames(struct string_list *a_renames,
|
||||
|
||||
if (string_list_has_string(¤t_directory_set, ren1_dst)) {
|
||||
clean_merge = 0;
|
||||
output(1, "CONFLICT (rename/directory): Renamed %s->%s in %s "
|
||||
output(1, "CONFLICT (rename/directory): Rename %s->%s in %s "
|
||||
" directory %s added in %s",
|
||||
ren1_src, ren1_dst, branch1,
|
||||
ren1_dst, branch2);
|
||||
conflict_rename_dir(ren1, branch1);
|
||||
} else if (sha_eq(src_other.sha1, null_sha1)) {
|
||||
clean_merge = 0;
|
||||
output(1, "CONFLICT (rename/delete): Renamed %s->%s in %s "
|
||||
output(1, "CONFLICT (rename/delete): Rename %s->%s in %s "
|
||||
"and deleted in %s",
|
||||
ren1_src, ren1_dst, branch1,
|
||||
branch2);
|
||||
@@ -940,19 +940,19 @@ static int process_renames(struct string_list *a_renames,
|
||||
const char *new_path;
|
||||
clean_merge = 0;
|
||||
try_merge = 1;
|
||||
output(1, "CONFLICT (rename/add): Renamed %s->%s in %s. "
|
||||
output(1, "CONFLICT (rename/add): Rename %s->%s in %s. "
|
||||
"%s added in %s",
|
||||
ren1_src, ren1_dst, branch1,
|
||||
ren1_dst, branch2);
|
||||
new_path = unique_path(ren1_dst, branch2);
|
||||
output(1, "Added as %s instead", new_path);
|
||||
output(1, "Adding as %s instead", new_path);
|
||||
update_file(0, dst_other.sha1, dst_other.mode, new_path);
|
||||
} else if ((item = string_list_lookup(ren1_dst, renames2Dst))) {
|
||||
ren2 = item->util;
|
||||
clean_merge = 0;
|
||||
ren2->processed = 1;
|
||||
output(1, "CONFLICT (rename/rename): Renamed %s->%s in %s. "
|
||||
"Renamed %s->%s in %s",
|
||||
output(1, "CONFLICT (rename/rename): Rename %s->%s in %s. "
|
||||
"Rename %s->%s in %s",
|
||||
ren1_src, ren1_dst, branch1,
|
||||
ren2->pair->one->path, ren2->pair->two->path, branch2);
|
||||
conflict_rename_rename_2(ren1, branch1, ren2, branch2);
|
||||
@@ -986,9 +986,9 @@ static int process_renames(struct string_list *a_renames,
|
||||
output(3, "Skipped %s (merged same as existing)", ren1_dst);
|
||||
else {
|
||||
if (mfi.merge || !mfi.clean)
|
||||
output(1, "Renamed %s => %s", ren1_src, ren1_dst);
|
||||
output(1, "Renaming %s => %s", ren1_src, ren1_dst);
|
||||
if (mfi.merge)
|
||||
output(2, "Auto-merged %s", ren1_dst);
|
||||
output(2, "Auto-merging %s", ren1_dst);
|
||||
if (!mfi.clean) {
|
||||
output(1, "CONFLICT (rename/modify): Merge conflict in %s",
|
||||
ren1_dst);
|
||||
@@ -1039,7 +1039,7 @@ static int process_entry(const char *path, struct stage_data *entry,
|
||||
/* Deleted in both or deleted in one and
|
||||
* unchanged in the other */
|
||||
if (a_sha)
|
||||
output(2, "Removed %s", path);
|
||||
output(2, "Removing %s", path);
|
||||
/* do not touch working file if it did not exist */
|
||||
remove_file(1, path, !a_sha);
|
||||
} else {
|
||||
@@ -1086,12 +1086,12 @@ static int process_entry(const char *path, struct stage_data *entry,
|
||||
const char *new_path = unique_path(path, add_branch);
|
||||
clean_merge = 0;
|
||||
output(1, "CONFLICT (%s): There is a directory with name %s in %s. "
|
||||
"Added %s as %s",
|
||||
"Adding %s as %s",
|
||||
conf, path, other_branch, path, new_path);
|
||||
remove_file(0, path, 0);
|
||||
update_file(0, sha, mode, new_path);
|
||||
} else {
|
||||
output(2, "Added %s", path);
|
||||
output(2, "Adding %s", path);
|
||||
update_file(1, sha, mode, path);
|
||||
}
|
||||
} else if (a_sha && b_sha) {
|
||||
@@ -1105,7 +1105,7 @@ static int process_entry(const char *path, struct stage_data *entry,
|
||||
reason = "add/add";
|
||||
o_sha = (unsigned char *)null_sha1;
|
||||
}
|
||||
output(2, "Auto-merged %s", path);
|
||||
output(2, "Auto-merging %s", path);
|
||||
o.path = a.path = b.path = (char *)path;
|
||||
hashcpy(o.sha1, o_sha);
|
||||
o.mode = o_mode;
|
||||
|
||||
@@ -564,8 +564,7 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)
|
||||
struct dir_struct dir;
|
||||
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
||||
|
||||
if (read_cache_unmerged())
|
||||
die("you need to resolve your current index first");
|
||||
refresh_cache(REFRESH_QUIET);
|
||||
|
||||
fd = hold_locked_index(lock_file, 1);
|
||||
|
||||
@@ -650,13 +649,15 @@ static void add_strategies(const char *string, unsigned attr)
|
||||
static int merge_trivial(void)
|
||||
{
|
||||
unsigned char result_tree[20], result_commit[20];
|
||||
struct commit_list parent;
|
||||
struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
|
||||
|
||||
write_tree_trivial(result_tree);
|
||||
printf("Wonderful.\n");
|
||||
parent.item = remoteheads->item;
|
||||
parent.next = NULL;
|
||||
commit_tree(merge_msg.buf, result_tree, &parent, result_commit);
|
||||
parent->item = lookup_commit(head);
|
||||
parent->next = xmalloc(sizeof(struct commit_list *));
|
||||
parent->next->item = remoteheads->item;
|
||||
parent->next->next = NULL;
|
||||
commit_tree(merge_msg.buf, result_tree, parent, result_commit);
|
||||
finish(result_commit, "In-index merge");
|
||||
drop_save();
|
||||
return 0;
|
||||
@@ -742,6 +743,7 @@ static int evaluate_result(void)
|
||||
int cnt = 0;
|
||||
struct rev_info rev;
|
||||
|
||||
discard_cache();
|
||||
if (read_cache() < 0)
|
||||
die("failed to read the cache");
|
||||
|
||||
@@ -775,7 +777,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
struct commit_list **remotes = &remoteheads;
|
||||
|
||||
setup_work_tree();
|
||||
if (unmerged_cache())
|
||||
if (read_cache_unmerged())
|
||||
die("You are in the middle of a conflicted merge.");
|
||||
|
||||
/*
|
||||
@@ -832,6 +834,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
if (argc != 1)
|
||||
die("Can merge only exactly one commit into "
|
||||
"empty head");
|
||||
if (squash)
|
||||
die("Squash commit into empty head not supported yet");
|
||||
if (!allow_fast_forward)
|
||||
die("Non-fast-forward commit does not make sense into "
|
||||
"an empty head");
|
||||
remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);
|
||||
if (!remote_head)
|
||||
die("%s - not something we can merge", argv[0]);
|
||||
@@ -936,7 +943,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
hex,
|
||||
find_unique_abbrev(remoteheads->item->object.sha1,
|
||||
DEFAULT_ABBREV));
|
||||
refresh_cache(REFRESH_QUIET);
|
||||
strbuf_init(&msg, 0);
|
||||
strbuf_addstr(&msg, "Fast forward");
|
||||
if (have_message)
|
||||
@@ -1073,6 +1079,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
|
||||
/* Automerge succeeded. */
|
||||
discard_cache();
|
||||
write_tree_trivial(result_tree);
|
||||
automerge_was_ok = 1;
|
||||
break;
|
||||
|
||||
@@ -59,8 +59,17 @@ static int do_push(const char *repo, int flags)
|
||||
if (remote->mirror)
|
||||
flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
|
||||
|
||||
if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) && refspec)
|
||||
return -1;
|
||||
if ((flags & TRANSPORT_PUSH_ALL) && refspec) {
|
||||
if (!strcmp(*refspec, "refs/tags/*"))
|
||||
return error("--all and --tags are incompatible");
|
||||
return error("--all can't be combined with refspecs");
|
||||
}
|
||||
|
||||
if ((flags & TRANSPORT_PUSH_MIRROR) && refspec) {
|
||||
if (!strcmp(*refspec, "refs/tags/*"))
|
||||
return error("--mirror and --tags are incompatible");
|
||||
return error("--mirror can't be combined with refspecs");
|
||||
}
|
||||
|
||||
if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==
|
||||
(TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {
|
||||
|
||||
@@ -540,11 +540,11 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
|
||||
free(collected.e);
|
||||
}
|
||||
|
||||
while (i < argc) {
|
||||
const char *ref = argv[i++];
|
||||
for (; i < argc; i++) {
|
||||
char *ref;
|
||||
unsigned char sha1[20];
|
||||
if (!resolve_ref(ref, sha1, 1, NULL)) {
|
||||
status |= error("%s points nowhere!", ref);
|
||||
if (!dwim_log(argv[i], strlen(argv[i]), sha1, &ref)) {
|
||||
status |= error("%s points nowhere!", argv[i]);
|
||||
continue;
|
||||
}
|
||||
set_reflog_expiry_param(&cb, explicit_expiry, ref);
|
||||
|
||||
@@ -645,7 +645,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
revs.diff)
|
||||
usage(rev_list_usage);
|
||||
|
||||
save_commit_buffer = revs.verbose_header || revs.grep_filter;
|
||||
save_commit_buffer = revs.verbose_header ||
|
||||
revs.grep_filter.pattern_list;
|
||||
if (bisect_list)
|
||||
revs.limited = 1;
|
||||
|
||||
|
||||
@@ -194,6 +194,10 @@ static int process_path(const char *path)
|
||||
int len;
|
||||
struct stat st;
|
||||
|
||||
len = strlen(path);
|
||||
if (has_symlink_leading_path(len, path))
|
||||
return error("'%s' is beyond a symbolic link", path);
|
||||
|
||||
/*
|
||||
* First things first: get the stat information, to decide
|
||||
* what to do about the pathname!
|
||||
@@ -201,7 +205,6 @@ static int process_path(const char *path)
|
||||
if (lstat(path, &st) < 0)
|
||||
return process_lstat_error(path, errno);
|
||||
|
||||
len = strlen(path);
|
||||
if (S_ISDIR(st.st_mode))
|
||||
return process_directory(path, len, &st);
|
||||
|
||||
|
||||
6
cache.h
6
cache.h
@@ -126,6 +126,7 @@ struct cache_entry {
|
||||
|
||||
#define CE_NAMEMASK (0x0fff)
|
||||
#define CE_STAGEMASK (0x3000)
|
||||
#define CE_EXTENDED (0x4000)
|
||||
#define CE_VALID (0x8000)
|
||||
#define CE_STAGESHIFT 12
|
||||
|
||||
@@ -222,7 +223,8 @@ struct index_state {
|
||||
struct cache_tree *cache_tree;
|
||||
time_t timestamp;
|
||||
void *alloc;
|
||||
unsigned name_hash_initialized : 1;
|
||||
unsigned name_hash_initialized : 1,
|
||||
initialized : 1;
|
||||
struct hash_table name_hash;
|
||||
};
|
||||
|
||||
@@ -391,7 +393,6 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct
|
||||
|
||||
extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
|
||||
extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path);
|
||||
extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object);
|
||||
extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
|
||||
extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
|
||||
|
||||
@@ -451,6 +452,7 @@ enum safe_crlf {
|
||||
extern enum safe_crlf safe_crlf;
|
||||
|
||||
enum branch_track {
|
||||
BRANCH_TRACK_UNSPECIFIED = -1,
|
||||
BRANCH_TRACK_NEVER = 0,
|
||||
BRANCH_TRACK_REMOTE,
|
||||
BRANCH_TRACK_ALWAYS,
|
||||
|
||||
@@ -143,8 +143,6 @@ static void append_lost(struct sline *sline, int n, const char *line, int len)
|
||||
}
|
||||
|
||||
struct combine_diff_state {
|
||||
struct xdiff_emit_state xm;
|
||||
|
||||
unsigned int lno;
|
||||
int ob, on, nb, nn;
|
||||
unsigned long nmask;
|
||||
@@ -217,17 +215,15 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
|
||||
parent_file.size = sz;
|
||||
xpp.flags = XDF_NEED_MINIMAL;
|
||||
memset(&xecfg, 0, sizeof(xecfg));
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &state;
|
||||
memset(&state, 0, sizeof(state));
|
||||
state.xm.consume = consume_line;
|
||||
state.nmask = nmask;
|
||||
state.sline = sline;
|
||||
state.lno = 1;
|
||||
state.num_parent = num_parent;
|
||||
state.n = n;
|
||||
|
||||
xdi_diff(&parent_file, result_file, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(&parent_file, result_file, consume_line, &state,
|
||||
&xpp, &xecfg, &ecb);
|
||||
free(parent_file.ptr);
|
||||
|
||||
/* Assign line numbers for this parent.
|
||||
@@ -727,6 +723,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
die("early EOF '%s'", elem->path);
|
||||
|
||||
result[len] = 0;
|
||||
|
||||
/* If not a fake symlink, apply filters, e.g. autocrlf */
|
||||
if (is_file) {
|
||||
struct strbuf buf;
|
||||
|
||||
strbuf_init(&buf, 0);
|
||||
if (convert_to_git(elem->path, result, len, &buf, safe_crlf)) {
|
||||
free(result);
|
||||
result = strbuf_detach(&buf, &len);
|
||||
result_size = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
deleted_file:
|
||||
|
||||
1
commit.h
1
commit.h
@@ -121,6 +121,7 @@ int read_graft_file(const char *graft_file);
|
||||
struct commit_graft *lookup_commit_graft(const unsigned char *sha1);
|
||||
|
||||
extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2, int cleanup);
|
||||
extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos, int cleanup);
|
||||
extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);
|
||||
|
||||
extern int register_shallow(const unsigned char *sha1);
|
||||
|
||||
@@ -31,11 +31,6 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
|
||||
return (time_t)winTime;
|
||||
}
|
||||
|
||||
static inline size_t size_to_blocks(size_t s)
|
||||
{
|
||||
return (s+511)/512;
|
||||
}
|
||||
|
||||
extern int _getdrive( void );
|
||||
/* We keep the do_lstat code in a separate function to avoid recursion.
|
||||
* When a path ends with a slash, the stat will fail with ENOENT. In
|
||||
@@ -57,10 +52,10 @@ static int do_lstat(const char *file_name, struct stat *buf)
|
||||
buf->st_ino = 0;
|
||||
buf->st_gid = 0;
|
||||
buf->st_uid = 0;
|
||||
buf->st_nlink = 1;
|
||||
buf->st_mode = fMode;
|
||||
buf->st_size = fdata.nFileSizeLow; /* Can't use nFileSizeHigh, since it's not a stat64 */
|
||||
buf->st_blocks = size_to_blocks(buf->st_size);
|
||||
buf->st_dev = _getdrive() - 1;
|
||||
buf->st_dev = buf->st_rdev = (_getdrive() - 1);
|
||||
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
|
||||
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
|
||||
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
|
||||
@@ -94,7 +89,7 @@ static int do_lstat(const char *file_name, struct stat *buf)
|
||||
* complete. Note that Git stat()s are redirected to mingw_lstat()
|
||||
* too, since Windows doesn't really handle symlinks that well.
|
||||
*/
|
||||
int mingw_lstat(const char *file_name, struct mingw_stat *buf)
|
||||
int mingw_lstat(const char *file_name, struct stat *buf)
|
||||
{
|
||||
int namelen;
|
||||
static char alt_name[PATH_MAX];
|
||||
@@ -122,8 +117,7 @@ int mingw_lstat(const char *file_name, struct mingw_stat *buf)
|
||||
}
|
||||
|
||||
#undef fstat
|
||||
#undef stat
|
||||
int mingw_fstat(int fd, struct mingw_stat *buf)
|
||||
int mingw_fstat(int fd, struct stat *buf)
|
||||
{
|
||||
HANDLE fh = (HANDLE)_get_osfhandle(fd);
|
||||
BY_HANDLE_FILE_INFORMATION fdata;
|
||||
@@ -133,22 +127,8 @@ int mingw_fstat(int fd, struct mingw_stat *buf)
|
||||
return -1;
|
||||
}
|
||||
/* direct non-file handles to MS's fstat() */
|
||||
if (GetFileType(fh) != FILE_TYPE_DISK) {
|
||||
struct stat st;
|
||||
if (fstat(fd, &st))
|
||||
return -1;
|
||||
buf->st_ino = st.st_ino;
|
||||
buf->st_gid = st.st_gid;
|
||||
buf->st_uid = st.st_uid;
|
||||
buf->st_mode = st.st_mode;
|
||||
buf->st_size = st.st_size;
|
||||
buf->st_blocks = size_to_blocks(buf->st_size);
|
||||
buf->st_dev = st.st_dev;
|
||||
buf->st_atime = st.st_atime;
|
||||
buf->st_mtime = st.st_mtime;
|
||||
buf->st_ctime = st.st_ctime;
|
||||
return 0;
|
||||
}
|
||||
if (GetFileType(fh) != FILE_TYPE_DISK)
|
||||
return fstat(fd, buf);
|
||||
|
||||
if (GetFileInformationByHandle(fh, &fdata)) {
|
||||
int fMode = S_IREAD;
|
||||
@@ -162,10 +142,10 @@ int mingw_fstat(int fd, struct mingw_stat *buf)
|
||||
buf->st_ino = 0;
|
||||
buf->st_gid = 0;
|
||||
buf->st_uid = 0;
|
||||
buf->st_nlink = 1;
|
||||
buf->st_mode = fMode;
|
||||
buf->st_size = fdata.nFileSizeLow; /* Can't use nFileSizeHigh, since it's not a stat64 */
|
||||
buf->st_blocks = size_to_blocks(buf->st_size);
|
||||
buf->st_dev = _getdrive() - 1;
|
||||
buf->st_dev = buf->st_rdev = (_getdrive() - 1);
|
||||
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
|
||||
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
|
||||
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
|
||||
|
||||
@@ -162,22 +162,12 @@ int mingw_rename(const char*, const char*);
|
||||
|
||||
/* Use mingw_lstat() instead of lstat()/stat() and
|
||||
* mingw_fstat() instead of fstat() on Windows.
|
||||
* struct stat is redefined because it lacks the st_blocks member.
|
||||
*/
|
||||
struct mingw_stat {
|
||||
unsigned st_mode;
|
||||
time_t st_mtime, st_atime, st_ctime;
|
||||
unsigned st_dev, st_ino, st_uid, st_gid;
|
||||
size_t st_size;
|
||||
size_t st_blocks;
|
||||
};
|
||||
int mingw_lstat(const char *file_name, struct mingw_stat *buf);
|
||||
int mingw_fstat(int fd, struct mingw_stat *buf);
|
||||
int mingw_lstat(const char *file_name, struct stat *buf);
|
||||
int mingw_fstat(int fd, struct stat *buf);
|
||||
#define fstat mingw_fstat
|
||||
#define lstat mingw_lstat
|
||||
#define stat mingw_stat
|
||||
static inline int mingw_stat(const char *file_name, struct mingw_stat *buf)
|
||||
{ return mingw_lstat(file_name, buf); }
|
||||
#define stat(x,y) mingw_lstat(x,y)
|
||||
|
||||
int mingw_utime(const char *file_name, const struct utimbuf *times);
|
||||
#define utime mingw_utime
|
||||
|
||||
@@ -17,6 +17,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
|
||||
|
||||
if (maxsize > 0) {
|
||||
ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
|
||||
if (ret == maxsize-1)
|
||||
ret = -1;
|
||||
/* Windows does not NUL-terminate if result fills buffer */
|
||||
str[maxsize-1] = 0;
|
||||
}
|
||||
@@ -34,6 +36,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
|
||||
break;
|
||||
s = str;
|
||||
ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
|
||||
if (ret == maxsize-1)
|
||||
ret = -1;
|
||||
}
|
||||
free(s);
|
||||
return ret;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
AR = @AR@
|
||||
TAR = @TAR@
|
||||
#INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
|
||||
|
||||
@@ -271,15 +271,17 @@ __git_merge_strategies ()
|
||||
echo "$__git_merge_strategylist"
|
||||
return
|
||||
fi
|
||||
sed -n "/^all_strategies='/{
|
||||
s/^all_strategies='//
|
||||
s/'//
|
||||
git merge -s help 2>&1 |
|
||||
sed -n -e '/[Aa]vailable strategies are: /,/^$/{
|
||||
s/\.$//
|
||||
s/.*://
|
||||
s/^[ ]*//
|
||||
s/[ ]*$//
|
||||
p
|
||||
q
|
||||
}" "$(git --exec-path)/git-merge"
|
||||
}'
|
||||
}
|
||||
__git_merge_strategylist=
|
||||
__git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
|
||||
__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null)
|
||||
|
||||
__git_complete_file ()
|
||||
{
|
||||
@@ -769,7 +771,7 @@ _git_diff ()
|
||||
__gitcomp "--cached --stat --numstat --shortstat --summary
|
||||
--patch-with-stat --name-only --name-status --color
|
||||
--no-color --color-words --no-renames --check
|
||||
--full-index --binary --abbrev --diff-filter
|
||||
--full-index --binary --abbrev --diff-filter=
|
||||
--find-copies-harder --pickaxe-all --pickaxe-regex
|
||||
--text --ignore-space-at-eol --ignore-space-change
|
||||
--ignore-all-space --exit-code --quiet --ext-diff
|
||||
|
||||
@@ -76,7 +76,7 @@ def write_pipe(c, str):
|
||||
|
||||
def p4_write_pipe(c, str):
|
||||
real_cmd = p4_build_cmd(c)
|
||||
return write_pipe(c, str)
|
||||
return write_pipe(real_cmd, str)
|
||||
|
||||
def read_pipe(c, ignore_error=False):
|
||||
if verbose:
|
||||
|
||||
@@ -3,14 +3,16 @@ git-p4 - Perforce <-> Git converter using git-fast-import
|
||||
Usage
|
||||
=====
|
||||
|
||||
git-p4 supports two main modes: Importing from Perforce to a Git repository is
|
||||
done using "git-p4 sync" or "git-p4 rebase". Submitting changes from Git back
|
||||
to Perforce is done using "git-p4 submit".
|
||||
git-p4 can be used in two different ways:
|
||||
|
||||
1) To import changes from Perforce to a Git repository, using "git-p4 sync".
|
||||
|
||||
2) To submit changes from Git back to Perforce, using "git-p4 submit".
|
||||
|
||||
Importing
|
||||
=========
|
||||
|
||||
You can simply start with
|
||||
Simply start with
|
||||
|
||||
git-p4 clone //depot/path/project
|
||||
|
||||
@@ -18,11 +20,18 @@ or
|
||||
|
||||
git-p4 clone //depot/path/project myproject
|
||||
|
||||
This will create an empty git repository in a subdirectory called "project" (or
|
||||
"myproject" with the second command), import the head revision from the
|
||||
specified perforce path into a git "p4" branch (remotes/p4 actually), create a
|
||||
master branch off it and check it out. If you want the entire history (not just
|
||||
the head revision) then you can simply append a "@all" to the depot path:
|
||||
This will:
|
||||
|
||||
1) Create an empty git repository in a subdirectory called "project" (or
|
||||
"myproject" with the second command)
|
||||
|
||||
2) Import the head revision from the given Perforce path into a git branch
|
||||
called "p4" (remotes/p4 actually)
|
||||
|
||||
3) Create a master branch based on it and check it out.
|
||||
|
||||
If you want the entire history (not just the head revision) then you can simply
|
||||
append a "@all" to the depot path:
|
||||
|
||||
git-p4 clone //depot/project/main@all myproject
|
||||
|
||||
@@ -37,31 +46,40 @@ If you want more control you can also use the git-p4 sync command directly:
|
||||
|
||||
This will import the current head revision of the specified depot path into a
|
||||
"remotes/p4/master" branch of your git repository. You can use the
|
||||
--branch=mybranch option to use a different branch.
|
||||
--branch=mybranch option to import into a different branch.
|
||||
|
||||
If you want to import the entire history of a given depot path just use
|
||||
If you want to import the entire history of a given depot path simply use:
|
||||
|
||||
git-p4 sync //path/in/depot@all
|
||||
|
||||
|
||||
Note:
|
||||
|
||||
To achieve optimal compression you may want to run 'git repack -a -d -f' after
|
||||
a big import. This may take a while.
|
||||
|
||||
Support for Perforce integrations is still work in progress. Don't bother
|
||||
trying it unless you want to hack on it :)
|
||||
|
||||
Incremental Imports
|
||||
===================
|
||||
|
||||
After an initial import you can easily synchronize your git repository with
|
||||
newer changes from the Perforce depot by just calling
|
||||
After an initial import you can continue to synchronize your git repository
|
||||
with newer changes from the Perforce depot by just calling
|
||||
|
||||
git-p4 sync
|
||||
|
||||
in your git repository. By default the "remotes/p4/master" branch is updated.
|
||||
|
||||
It is recommended to run 'git repack -a -d -f' from time to time when using
|
||||
incremental imports to optimally combine the individual git packs that each
|
||||
incremental import creates through the use of git-fast-import.
|
||||
Advanced Setup
|
||||
==============
|
||||
|
||||
Suppose you have a periodically updated git repository somewhere, containing a
|
||||
complete import of a Perforce project. This repository can be cloned and used
|
||||
with git-p4. When updating the cloned repository with the "sync" command,
|
||||
git-p4 will try to fetch changes from the original repository first. The git
|
||||
protocol used with this is usually faster than importing from Perforce
|
||||
directly.
|
||||
|
||||
This behaviour can be disabled by setting the "git-p4.syncFromOrigin" git
|
||||
configuration variable to "false".
|
||||
|
||||
Updating
|
||||
========
|
||||
@@ -79,7 +97,7 @@ Submitting
|
||||
==========
|
||||
|
||||
git-p4 has support for submitting changes from a git repository back to the
|
||||
Perforce depot. This requires a Perforce checkout separate to your git
|
||||
Perforce depot. This requires a Perforce checkout separate from your git
|
||||
repository. To submit all changes that are in the current git branch but not in
|
||||
the "p4" branch (or "origin" if "p4" doesn't exist) simply call
|
||||
|
||||
@@ -97,17 +115,6 @@ continue importing the remaining changes with
|
||||
|
||||
git-p4 submit --continue
|
||||
|
||||
After submitting you should sync your perforce import branch ("p4" or "origin")
|
||||
from Perforce using git-p4's sync command.
|
||||
|
||||
If you have changes in your working directory that you haven't committed into
|
||||
git yet but that you want to commit to Perforce directly ("quick fixes") then
|
||||
you do not have to go through the intermediate step of creating a git commit
|
||||
first but you can just call
|
||||
|
||||
git-p4 submit --direct
|
||||
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
|
||||
11
decorate.c
11
decorate.c
@@ -6,13 +6,13 @@
|
||||
#include "object.h"
|
||||
#include "decorate.h"
|
||||
|
||||
static unsigned int hash_obj(struct object *obj, unsigned int n)
|
||||
static unsigned int hash_obj(const struct object *obj, unsigned int n)
|
||||
{
|
||||
unsigned int hash = *(unsigned int *)obj->sha1;
|
||||
return hash % n;
|
||||
}
|
||||
|
||||
static void *insert_decoration(struct decoration *n, struct object *base, void *decoration)
|
||||
static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
|
||||
{
|
||||
int size = n->size;
|
||||
struct object_decoration *hash = n->hash;
|
||||
@@ -44,7 +44,7 @@ static void grow_decoration(struct decoration *n)
|
||||
n->nr = 0;
|
||||
|
||||
for (i = 0; i < old_size; i++) {
|
||||
struct object *base = old_hash[i].base;
|
||||
const struct object *base = old_hash[i].base;
|
||||
void *decoration = old_hash[i].decoration;
|
||||
|
||||
if (!base)
|
||||
@@ -55,7 +55,8 @@ static void grow_decoration(struct decoration *n)
|
||||
}
|
||||
|
||||
/* Add a decoration pointer, return any old one */
|
||||
void *add_decoration(struct decoration *n, struct object *obj, void *decoration)
|
||||
void *add_decoration(struct decoration *n, const struct object *obj,
|
||||
void *decoration)
|
||||
{
|
||||
int nr = n->nr + 1;
|
||||
|
||||
@@ -65,7 +66,7 @@ void *add_decoration(struct decoration *n, struct object *obj, void *decoration)
|
||||
}
|
||||
|
||||
/* Lookup a decoration pointer */
|
||||
void *lookup_decoration(struct decoration *n, struct object *obj)
|
||||
void *lookup_decoration(struct decoration *n, const struct object *obj)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define DECORATE_H
|
||||
|
||||
struct object_decoration {
|
||||
struct object *base;
|
||||
const struct object *base;
|
||||
void *decoration;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ struct decoration {
|
||||
struct object_decoration *hash;
|
||||
};
|
||||
|
||||
extern void *add_decoration(struct decoration *n, struct object *obj, void *decoration);
|
||||
extern void *lookup_decoration(struct decoration *n, struct object *obj);
|
||||
extern void *add_decoration(struct decoration *n, const struct object *obj, void *decoration);
|
||||
extern void *lookup_decoration(struct decoration *n, const struct object *obj);
|
||||
|
||||
#endif
|
||||
|
||||
57
diff.c
57
diff.c
@@ -20,6 +20,7 @@
|
||||
|
||||
static int diff_detect_rename_default;
|
||||
static int diff_rename_limit_default = 200;
|
||||
static int diff_suppress_blank_empty;
|
||||
int diff_use_color_default = -1;
|
||||
static const char *external_diff_cmd_cfg;
|
||||
int diff_auto_refresh_index = 1;
|
||||
@@ -176,6 +177,12 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* like GNU diff's --suppress-blank-empty option */
|
||||
if (!strcmp(var, "diff.suppress-blank-empty")) {
|
||||
diff_suppress_blank_empty = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!prefixcmp(var, "diff.")) {
|
||||
const char *ep = strrchr(var, '.');
|
||||
if (ep != var + 4) {
|
||||
@@ -369,7 +376,6 @@ static void diff_words_append(char *line, unsigned long len,
|
||||
}
|
||||
|
||||
struct diff_words_data {
|
||||
struct xdiff_emit_state xm;
|
||||
struct diff_words_buffer minus, plus;
|
||||
FILE *file;
|
||||
};
|
||||
@@ -459,11 +465,8 @@ static void diff_words_show(struct diff_words_data *diff_words)
|
||||
|
||||
xpp.flags = XDF_NEED_MINIMAL;
|
||||
xecfg.ctxlen = diff_words->minus.alloc + diff_words->plus.alloc;
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = diff_words;
|
||||
diff_words->xm.consume = fn_out_diff_words_aux;
|
||||
xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
|
||||
|
||||
xdi_diff_outf(&minus, &plus, fn_out_diff_words_aux, diff_words,
|
||||
&xpp, &xecfg, &ecb);
|
||||
free(minus.ptr);
|
||||
free(plus.ptr);
|
||||
diff_words->minus.text.size = diff_words->plus.text.size = 0;
|
||||
@@ -477,7 +480,6 @@ static void diff_words_show(struct diff_words_data *diff_words)
|
||||
typedef unsigned long (*sane_truncate_fn)(char *line, unsigned long len);
|
||||
|
||||
struct emit_callback {
|
||||
struct xdiff_emit_state xm;
|
||||
int nparents, color_diff;
|
||||
unsigned ws_rule;
|
||||
sane_truncate_fn truncate;
|
||||
@@ -580,6 +582,12 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
|
||||
ecbdata->label_path[0] = ecbdata->label_path[1] = NULL;
|
||||
}
|
||||
|
||||
if (diff_suppress_blank_empty
|
||||
&& len == 2 && line[0] == ' ' && line[1] == '\n') {
|
||||
line[0] = '\n';
|
||||
len = 1;
|
||||
}
|
||||
|
||||
/* This is not really necessary for now because
|
||||
* this codepath only deals with two-way diffs.
|
||||
*/
|
||||
@@ -708,8 +716,6 @@ static char *pprint_rename(const char *a, const char *b)
|
||||
}
|
||||
|
||||
struct diffstat_t {
|
||||
struct xdiff_emit_state xm;
|
||||
|
||||
int nr;
|
||||
int alloc;
|
||||
struct diffstat_file {
|
||||
@@ -1131,7 +1137,6 @@ static void free_diffstat_info(struct diffstat_t *diffstat)
|
||||
}
|
||||
|
||||
struct checkdiff_t {
|
||||
struct xdiff_emit_state xm;
|
||||
const char *filename;
|
||||
int lineno;
|
||||
struct diff_options *o;
|
||||
@@ -1376,6 +1381,8 @@ static struct builtin_funcname_pattern {
|
||||
const char *name;
|
||||
const char *pattern;
|
||||
} builtin_funcname_pattern[] = {
|
||||
{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
|
||||
{ "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$" },
|
||||
{ "java", "!^[ ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
|
||||
"new\\|return\\|switch\\|throw\\|while\\)\n"
|
||||
"^[ ]*\\(\\([ ]*"
|
||||
@@ -1387,9 +1394,9 @@ static struct builtin_funcname_pattern {
|
||||
"\\|"
|
||||
"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
|
||||
},
|
||||
{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
|
||||
{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
|
||||
{ "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
|
||||
{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
|
||||
{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
|
||||
};
|
||||
|
||||
static const char *diff_funcname_pattern(struct diff_filespec *one)
|
||||
@@ -1521,15 +1528,13 @@ static void builtin_diff(const char *name_a,
|
||||
xecfg.ctxlen = strtoul(diffopts + 10, NULL, 10);
|
||||
else if (!prefixcmp(diffopts, "-u"))
|
||||
xecfg.ctxlen = strtoul(diffopts + 2, NULL, 10);
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &ecbdata;
|
||||
ecbdata.xm.consume = fn_out_consume;
|
||||
if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS)) {
|
||||
ecbdata.diff_words =
|
||||
xcalloc(1, sizeof(struct diff_words_data));
|
||||
ecbdata.diff_words->file = o->file;
|
||||
}
|
||||
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(&mf1, &mf2, fn_out_consume, &ecbdata,
|
||||
&xpp, &xecfg, &ecb);
|
||||
if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS))
|
||||
free_diff_words_data(&ecbdata);
|
||||
}
|
||||
@@ -1580,9 +1585,8 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
|
||||
|
||||
memset(&xecfg, 0, sizeof(xecfg));
|
||||
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = diffstat;
|
||||
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
|
||||
&xpp, &xecfg, &ecb);
|
||||
}
|
||||
|
||||
free_and_return:
|
||||
@@ -1603,7 +1607,6 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
|
||||
return;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.xm.consume = checkdiff_consume;
|
||||
data.filename = name_b ? name_b : name_a;
|
||||
data.lineno = 0;
|
||||
data.o = o;
|
||||
@@ -1627,10 +1630,10 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
|
||||
xdemitcb_t ecb;
|
||||
|
||||
memset(&xecfg, 0, sizeof(xecfg));
|
||||
xecfg.ctxlen = 1; /* at least one context line */
|
||||
xpp.flags = XDF_NEED_MINIMAL;
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &data;
|
||||
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(&mf1, &mf2, checkdiff_consume, &data,
|
||||
&xpp, &xecfg, &ecb);
|
||||
|
||||
if ((data.ws_rule & WS_TRAILING_SPACE) &&
|
||||
data.trailing_blanks_start) {
|
||||
@@ -3018,7 +3021,6 @@ static void diff_summary(FILE *file, struct diff_filepair *p)
|
||||
}
|
||||
|
||||
struct patch_id_t {
|
||||
struct xdiff_emit_state xm;
|
||||
SHA_CTX *ctx;
|
||||
int patchlen;
|
||||
};
|
||||
@@ -3063,7 +3065,6 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
|
||||
SHA1_Init(&ctx);
|
||||
memset(&data, 0, sizeof(struct patch_id_t));
|
||||
data.ctx = &ctx;
|
||||
data.xm.consume = patch_id_consume;
|
||||
|
||||
for (i = 0; i < q->nr; i++) {
|
||||
xpparam_t xpp;
|
||||
@@ -3128,9 +3129,8 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
|
||||
xpp.flags = XDF_NEED_MINIMAL;
|
||||
xecfg.ctxlen = 3;
|
||||
xecfg.flags = XDL_EMIT_FUNCNAMES;
|
||||
ecb.outf = xdiff_outf;
|
||||
ecb.priv = &data;
|
||||
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
|
||||
xdi_diff_outf(&mf1, &mf2, patch_id_consume, &data,
|
||||
&xpp, &xecfg, &ecb);
|
||||
}
|
||||
|
||||
SHA1_Final(sha1, &ctx);
|
||||
@@ -3207,7 +3207,6 @@ void diff_flush(struct diff_options *options)
|
||||
struct diffstat_t diffstat;
|
||||
|
||||
memset(&diffstat, 0, sizeof(struct diffstat_t));
|
||||
diffstat.xm.consume = diffstat_consume;
|
||||
for (i = 0; i < q->nr; i++) {
|
||||
struct diff_filepair *p = q->queue[i];
|
||||
if (check_pair_status(p))
|
||||
|
||||
6
dir.c
6
dir.c
@@ -727,8 +727,12 @@ static void free_simplify(struct path_simplify *simplify)
|
||||
|
||||
int read_directory(struct dir_struct *dir, const char *path, const char *base, int baselen, const char **pathspec)
|
||||
{
|
||||
struct path_simplify *simplify = create_simplify(pathspec);
|
||||
struct path_simplify *simplify;
|
||||
|
||||
if (has_symlink_leading_path(strlen(path), path))
|
||||
return dir->nr;
|
||||
|
||||
simplify = create_simplify(pathspec);
|
||||
read_directory_recursive(dir, path, base, baselen, 0, simplify);
|
||||
free_simplify(simplify);
|
||||
qsort(dir->entries, dir->nr, sizeof(struct dir_entry *), cmp_name);
|
||||
|
||||
@@ -99,6 +99,11 @@
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_OPENSSL
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
/* On most systems <limits.h> would have given us this, but
|
||||
* not on some systems (e.g. GNU/Hurd).
|
||||
*/
|
||||
@@ -192,6 +197,12 @@ extern int git_munmap(void *start, size_t length);
|
||||
|
||||
#endif /* NO_MMAP */
|
||||
|
||||
#ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
|
||||
#define on_disk_bytes(st) ((st).st_size)
|
||||
#else
|
||||
#define on_disk_bytes(st) ((st).st_blocks * 512)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PACKED_GIT_LIMIT \
|
||||
((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
|
||||
|
||||
|
||||
@@ -416,15 +416,17 @@ if [ "$filter_tag_name" ]; then
|
||||
echo "$ref -> $new_ref ($sha1 -> $new_sha1)"
|
||||
|
||||
if [ "$type" = "tag" ]; then
|
||||
new_sha1=$(git cat-file tag "$ref" |
|
||||
new_sha1=$( ( printf 'object %s\ntype commit\ntag %s\n' \
|
||||
"$new_sha1" "$new_ref"
|
||||
git cat-file tag "$ref" |
|
||||
sed -n \
|
||||
-e "1,/^$/{
|
||||
s/^object .*/object $new_sha1/
|
||||
s/^type .*/type commit/
|
||||
s/^tag .*/tag $new_ref/
|
||||
/^object /d
|
||||
/^type /d
|
||||
/^tag /d
|
||||
}" \
|
||||
-e '/^-----BEGIN PGP SIGNATURE-----/q' \
|
||||
-e 'p' |
|
||||
-e 'p' ) |
|
||||
git mktag) ||
|
||||
die "Could not create new tag object for $ref"
|
||||
if git cat-file tag "$ref" | \
|
||||
|
||||
@@ -61,7 +61,7 @@ do
|
||||
exit 2
|
||||
esac
|
||||
|
||||
common=$(git merge-base --all $MRC $SHA1) ||
|
||||
common=$(git merge-base --all $SHA1 $MRC) ||
|
||||
die "Unable to find common commit with $SHA1"
|
||||
|
||||
case "$LF$common$LF" in
|
||||
@@ -100,14 +100,7 @@ do
|
||||
next=$(git write-tree 2>/dev/null)
|
||||
fi
|
||||
|
||||
# We have merged the other branch successfully. Ideally
|
||||
# we could implement OR'ed heads in merge-base, and keep
|
||||
# a list of commits we have merged so far in MRC to feed
|
||||
# them to merge-base, but we approximate it by keep using
|
||||
# the current MRC. We used to update it to $common, which
|
||||
# was incorrectly doing AND'ed merge-base here, which was
|
||||
# unneeded.
|
||||
|
||||
MRC="$MRC $SHA1"
|
||||
MRT=$next
|
||||
done
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
|
||||
USAGE="[--quiet] [--cached] \
|
||||
[add <repo> [-b branch] <path>]|[status|init|update [-i|--init]|summary [-n|--summary-limit <n>] [<commit>]] \
|
||||
[--] [<path>...]"
|
||||
[--] [<path>...]|[foreach <command>]"
|
||||
OPTIONS_SPEC=
|
||||
. git-sh-setup
|
||||
. git-parse-remote
|
||||
require_work_tree
|
||||
|
||||
command=
|
||||
@@ -30,9 +31,7 @@ say()
|
||||
# Resolve relative url by appending to parent's url
|
||||
resolve_relative_url ()
|
||||
{
|
||||
branch="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
remote="$(git config branch.${branch#refs/heads/}.remote)"
|
||||
remote="${remote:-origin}"
|
||||
remote=$(get_default_remote)
|
||||
remoteurl=$(git config "remote.$remote.url") ||
|
||||
die "remote ($remote) does not have a url defined in .git/config"
|
||||
url="$1"
|
||||
@@ -53,6 +52,15 @@ resolve_relative_url ()
|
||||
echo "$remoteurl/$url"
|
||||
}
|
||||
|
||||
#
|
||||
# Get submodule info for registered submodules
|
||||
# $@ = path to limit submodule list
|
||||
#
|
||||
module_list()
|
||||
{
|
||||
git ls-files --stage -- "$@" | grep '^160000 '
|
||||
}
|
||||
|
||||
#
|
||||
# Map submodule path to submodule name
|
||||
#
|
||||
@@ -198,6 +206,26 @@ cmd_add()
|
||||
die "Failed to register submodule '$path'"
|
||||
}
|
||||
|
||||
#
|
||||
# Execute an arbitrary command sequence in each checked out
|
||||
# submodule
|
||||
#
|
||||
# $@ = command to execute
|
||||
#
|
||||
cmd_foreach()
|
||||
{
|
||||
module_list |
|
||||
while read mode sha1 stage path
|
||||
do
|
||||
if test -e "$path"/.git
|
||||
then
|
||||
say "Entering '$path'"
|
||||
(cd "$path" && eval "$@") ||
|
||||
die "Stopping at '$path'; script returned non-zero status."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Register submodules in .git/config
|
||||
#
|
||||
@@ -226,7 +254,7 @@ cmd_init()
|
||||
shift
|
||||
done
|
||||
|
||||
git ls-files --stage -- "$@" | grep '^160000 ' |
|
||||
module_list "$@" |
|
||||
while read mode sha1 stage path
|
||||
do
|
||||
# Skip already registered paths
|
||||
@@ -284,7 +312,7 @@ cmd_update()
|
||||
esac
|
||||
done
|
||||
|
||||
git ls-files --stage -- "$@" | grep '^160000 ' |
|
||||
module_list "$@" |
|
||||
while read mode sha1 stage path
|
||||
do
|
||||
name=$(module_name "$path") || exit
|
||||
@@ -549,7 +577,7 @@ cmd_status()
|
||||
shift
|
||||
done
|
||||
|
||||
git ls-files --stage -- "$@" | grep '^160000 ' |
|
||||
module_list "$@" |
|
||||
while read mode sha1 stage path
|
||||
do
|
||||
name=$(module_name "$path") || exit
|
||||
@@ -583,7 +611,7 @@ cmd_status()
|
||||
while test $# != 0 && test -z "$command"
|
||||
do
|
||||
case "$1" in
|
||||
add | init | update | status | summary)
|
||||
add | foreach | init | update | status | summary)
|
||||
command=$1
|
||||
;;
|
||||
-q|--quiet)
|
||||
|
||||
@@ -421,7 +421,7 @@ sub cmd_dcommit {
|
||||
$head ||= 'HEAD';
|
||||
my @refs;
|
||||
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
||||
$url = $_commit_url if defined $_commit_url;
|
||||
$url = defined $_commit_url ? $_commit_url : $gs->full_url;
|
||||
my $last_rev = $_revision if defined $_revision;
|
||||
if ($url) {
|
||||
print "Committing to $url ...\n";
|
||||
@@ -437,6 +437,8 @@ sub cmd_dcommit {
|
||||
"If these changes depend on each other, re-running ",
|
||||
"without --no-rebase may be required."
|
||||
}
|
||||
my $expect_url = $url;
|
||||
Git::SVN::remove_username($expect_url);
|
||||
while (1) {
|
||||
my $d = shift @$linear_refs or last;
|
||||
unless (defined $last_rev) {
|
||||
@@ -511,9 +513,9 @@ sub cmd_dcommit {
|
||||
$gs->refname,
|
||||
"\nBefore dcommitting";
|
||||
}
|
||||
if ($url_ ne $url) {
|
||||
if ($url_ ne $expect_url) {
|
||||
fatal "URL mismatch after rebase: ",
|
||||
"$url_ != $url";
|
||||
"$url_ != $expect_url";
|
||||
}
|
||||
if ($uuid_ ne $uuid) {
|
||||
fatal "uuid mismatch after rebase: ",
|
||||
|
||||
153
hash-object.c
153
hash-object.c
@@ -7,16 +7,14 @@
|
||||
#include "cache.h"
|
||||
#include "blob.h"
|
||||
#include "quote.h"
|
||||
#include "parse-options.h"
|
||||
|
||||
static void hash_object(const char *path, enum object_type type, int write_object)
|
||||
static void hash_fd(int fd, const char *type, int write_object, const char *path)
|
||||
{
|
||||
int fd;
|
||||
struct stat st;
|
||||
unsigned char sha1[20];
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0 ||
|
||||
fstat(fd, &st) < 0 ||
|
||||
index_fd(sha1, fd, &st, write_object, type, path))
|
||||
if (fstat(fd, &st) < 0 ||
|
||||
index_fd(sha1, fd, &st, write_object, type_from_string(type), path))
|
||||
die(write_object
|
||||
? "Unable to add %s to database"
|
||||
: "Unable to hash %s", path);
|
||||
@@ -24,12 +22,14 @@ static void hash_object(const char *path, enum object_type type, int write_objec
|
||||
maybe_flush_or_die(stdout, "hash to stdout");
|
||||
}
|
||||
|
||||
static void hash_stdin(const char *type, int write_object)
|
||||
static void hash_object(const char *path, const char *type, int write_object,
|
||||
const char *vpath)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
if (index_pipe(sha1, 0, type, write_object))
|
||||
die("Unable to add stdin to database");
|
||||
printf("%s\n", sha1_to_hex(sha1));
|
||||
int fd;
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
die("Cannot open %s", path);
|
||||
hash_fd(fd, type, write_object, vpath);
|
||||
}
|
||||
|
||||
static void hash_stdin_paths(const char *type, int write_objects)
|
||||
@@ -45,92 +45,91 @@ static void hash_stdin_paths(const char *type, int write_objects)
|
||||
die("line is badly quoted");
|
||||
strbuf_swap(&buf, &nbuf);
|
||||
}
|
||||
hash_object(buf.buf, type_from_string(type), write_objects);
|
||||
hash_object(buf.buf, type, write_objects, buf.buf);
|
||||
}
|
||||
strbuf_release(&buf);
|
||||
strbuf_release(&nbuf);
|
||||
}
|
||||
|
||||
static const char hash_object_usage[] =
|
||||
"git hash-object [ [-t <type>] [-w] [--stdin] <file>... | --stdin-paths < <list-of-paths> ]";
|
||||
static const char * const hash_object_usage[] = {
|
||||
"git hash-object [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin] [--] <file>...",
|
||||
"git hash-object --stdin-paths < <list-of-paths>",
|
||||
NULL
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
static const char *type;
|
||||
static int write_object;
|
||||
static int hashstdin;
|
||||
static int stdin_paths;
|
||||
static int no_filters;
|
||||
static const char *vpath;
|
||||
|
||||
static const struct option hash_object_options[] = {
|
||||
OPT_STRING('t', NULL, &type, "type", "object type"),
|
||||
OPT_BOOLEAN('w', NULL, &write_object, "write the object into the object database"),
|
||||
OPT_BOOLEAN( 0 , "stdin", &hashstdin, "read the object from stdin"),
|
||||
OPT_BOOLEAN( 0 , "stdin-paths", &stdin_paths, "read file names from stdin"),
|
||||
OPT_BOOLEAN( 0 , "no-filters", &no_filters, "store file as is without filters"),
|
||||
OPT_STRING( 0 , "path", &vpath, "file", "process file as it were from this path"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
int i;
|
||||
const char *type = blob_type;
|
||||
int write_object = 0;
|
||||
const char *prefix = NULL;
|
||||
int prefix_length = -1;
|
||||
int no_more_flags = 0;
|
||||
int hashstdin = 0;
|
||||
int stdin_paths = 0;
|
||||
const char *errstr = NULL;
|
||||
|
||||
type = blob_type;
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
for (i = 1 ; i < argc; i++) {
|
||||
if (!no_more_flags && argv[i][0] == '-') {
|
||||
if (!strcmp(argv[i], "-t")) {
|
||||
if (argc <= ++i)
|
||||
usage(hash_object_usage);
|
||||
type = argv[i];
|
||||
}
|
||||
else if (!strcmp(argv[i], "-w")) {
|
||||
if (prefix_length < 0) {
|
||||
prefix = setup_git_directory();
|
||||
prefix_length =
|
||||
prefix ? strlen(prefix) : 0;
|
||||
}
|
||||
write_object = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--")) {
|
||||
no_more_flags = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--help"))
|
||||
usage(hash_object_usage);
|
||||
else if (!strcmp(argv[i], "--stdin-paths")) {
|
||||
if (hashstdin) {
|
||||
error("Can't use --stdin-paths with --stdin");
|
||||
usage(hash_object_usage);
|
||||
}
|
||||
stdin_paths = 1;
|
||||
argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);
|
||||
|
||||
}
|
||||
else if (!strcmp(argv[i], "--stdin")) {
|
||||
if (stdin_paths) {
|
||||
error("Can't use %s with --stdin-paths", argv[i]);
|
||||
usage(hash_object_usage);
|
||||
}
|
||||
if (hashstdin)
|
||||
die("Multiple --stdin arguments are not supported");
|
||||
hashstdin = 1;
|
||||
}
|
||||
else
|
||||
usage(hash_object_usage);
|
||||
}
|
||||
else {
|
||||
const char *arg = argv[i];
|
||||
if (write_object) {
|
||||
prefix = setup_git_directory();
|
||||
prefix_length = prefix ? strlen(prefix) : 0;
|
||||
if (vpath && prefix)
|
||||
vpath = prefix_filename(prefix, prefix_length, vpath);
|
||||
}
|
||||
|
||||
if (stdin_paths) {
|
||||
error("Can't specify files (such as \"%s\") with --stdin-paths", arg);
|
||||
usage(hash_object_usage);
|
||||
}
|
||||
if (stdin_paths) {
|
||||
if (hashstdin)
|
||||
errstr = "Can't use --stdin-paths with --stdin";
|
||||
else if (argc)
|
||||
errstr = "Can't specify files with --stdin-paths";
|
||||
else if (vpath)
|
||||
errstr = "Can't use --stdin-paths with --path";
|
||||
else if (no_filters)
|
||||
errstr = "Can't use --stdin-paths with --no-filters";
|
||||
}
|
||||
else {
|
||||
if (hashstdin > 1)
|
||||
errstr = "Multiple --stdin arguments are not supported";
|
||||
if (vpath && no_filters)
|
||||
errstr = "Can't use --path with --no-filters";
|
||||
}
|
||||
|
||||
if (hashstdin) {
|
||||
hash_stdin(type, write_object);
|
||||
hashstdin = 0;
|
||||
}
|
||||
if (0 <= prefix_length)
|
||||
arg = prefix_filename(prefix, prefix_length,
|
||||
arg);
|
||||
hash_object(arg, type_from_string(type), write_object);
|
||||
no_more_flags = 1;
|
||||
}
|
||||
if (errstr) {
|
||||
error (errstr);
|
||||
usage_with_options(hash_object_usage, hash_object_options);
|
||||
}
|
||||
|
||||
if (hashstdin)
|
||||
hash_fd(0, type, write_object, vpath);
|
||||
|
||||
for (i = 0 ; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
|
||||
if (0 <= prefix_length)
|
||||
arg = prefix_filename(prefix, prefix_length, arg);
|
||||
hash_object(arg, type, write_object,
|
||||
no_filters ? NULL : vpath ? vpath : arg);
|
||||
}
|
||||
|
||||
if (stdin_paths)
|
||||
hash_stdin_paths(type, write_object);
|
||||
|
||||
if (hashstdin)
|
||||
hash_stdin(type, write_object);
|
||||
return 0;
|
||||
}
|
||||
|
||||
3
help.c
3
help.c
@@ -555,7 +555,8 @@ static int is_git_command(const char *s)
|
||||
{
|
||||
load_command_list();
|
||||
return is_in_cmdlist(&main_cmds, s) ||
|
||||
is_in_cmdlist(&other_cmds, s);
|
||||
is_in_cmdlist(&other_cmds, s) ||
|
||||
!strcmp(s, "help");
|
||||
}
|
||||
|
||||
static const char *prepend(const char *prefix, const char *cmd)
|
||||
|
||||
922
imap-send.c
922
imap-send.c
File diff suppressed because it is too large
Load Diff
@@ -876,7 +876,9 @@ int main(int argc, char **argv)
|
||||
char *index_name_buf = NULL, *keep_name_buf = NULL;
|
||||
struct pack_idx_entry **idx_objects;
|
||||
unsigned char sha1[20];
|
||||
int nongit = 0;
|
||||
|
||||
setup_git_directory_gently(&nongit);
|
||||
git_config(git_index_pack_config, NULL);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
@@ -432,7 +432,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
|
||||
struct commit_list *parents;
|
||||
unsigned const char *sha1 = commit->object.sha1;
|
||||
|
||||
if (!opt->diff)
|
||||
if (!opt->diff && !DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS))
|
||||
return 0;
|
||||
|
||||
/* Root commit? */
|
||||
|
||||
55
pager.c
55
pager.c
@@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "run-command.h"
|
||||
|
||||
/*
|
||||
* This is split up from the rest of git so that we can do
|
||||
@@ -8,7 +9,7 @@
|
||||
static int spawned_pager;
|
||||
|
||||
#ifndef __MINGW32__
|
||||
static void run_pager(const char *pager)
|
||||
static void pager_preexec(void)
|
||||
{
|
||||
/*
|
||||
* Work around bug in "less" by not starting it until we
|
||||
@@ -20,17 +21,13 @@ static void run_pager(const char *pager)
|
||||
FD_SET(0, &in);
|
||||
select(1, &in, NULL, &in, NULL);
|
||||
|
||||
execlp(pager, pager, NULL);
|
||||
execl("/bin/sh", "sh", "-c", pager, NULL);
|
||||
setenv("LESS", "FRSX", 0);
|
||||
}
|
||||
#else
|
||||
#include "run-command.h"
|
||||
#endif
|
||||
|
||||
static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
|
||||
static struct child_process pager_process = {
|
||||
.argv = pager_argv,
|
||||
.in = -1
|
||||
};
|
||||
static struct child_process pager_process;
|
||||
|
||||
static void wait_for_pager(void)
|
||||
{
|
||||
fflush(stdout);
|
||||
@@ -40,14 +37,9 @@ static void wait_for_pager(void)
|
||||
close(2);
|
||||
finish_command(&pager_process);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setup_pager(void)
|
||||
{
|
||||
#ifndef __MINGW32__
|
||||
pid_t pid;
|
||||
int fd[2];
|
||||
#endif
|
||||
const char *pager = getenv("GIT_PAGER");
|
||||
|
||||
if (!isatty(1))
|
||||
@@ -66,37 +58,13 @@ void setup_pager(void)
|
||||
|
||||
spawned_pager = 1; /* means we are emitting to terminal */
|
||||
|
||||
#ifndef __MINGW32__
|
||||
if (pipe(fd) < 0)
|
||||
return;
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* return in the child */
|
||||
if (!pid) {
|
||||
dup2(fd[1], 1);
|
||||
dup2(fd[1], 2);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The original process turns into the PAGER */
|
||||
dup2(fd[0], 0);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
|
||||
setenv("LESS", "FRSX", 0);
|
||||
run_pager(pager);
|
||||
die("unable to execute pager '%s'", pager);
|
||||
exit(255);
|
||||
#else
|
||||
/* spawn the pager */
|
||||
pager_argv[2] = pager;
|
||||
pager_process.argv = pager_argv;
|
||||
pager_process.in = -1;
|
||||
#ifndef __MINGW32__
|
||||
pager_process.preexec_cb = pager_preexec;
|
||||
#endif
|
||||
if (start_command(&pager_process))
|
||||
return;
|
||||
|
||||
@@ -107,7 +75,6 @@ void setup_pager(void)
|
||||
|
||||
/* this makes sure that the parent terminates after the pager */
|
||||
atexit(wait_for_pager);
|
||||
#endif
|
||||
}
|
||||
|
||||
int pager_in_use(void)
|
||||
|
||||
@@ -1118,6 +1118,10 @@ static void convert_from_disk(struct ondisk_cache_entry *ondisk, struct cache_en
|
||||
ce->ce_size = ntohl(ondisk->size);
|
||||
/* On-disk flags are just 16 bits */
|
||||
ce->ce_flags = ntohs(ondisk->flags);
|
||||
|
||||
/* For future extension: we do not understand this entry yet */
|
||||
if (ce->ce_flags & CE_EXTENDED)
|
||||
die("Unknown index entry format");
|
||||
hashcpy(ce->sha1, ondisk->sha1);
|
||||
|
||||
len = ce->ce_flags & CE_NAMEMASK;
|
||||
@@ -1155,7 +1159,7 @@ int read_index_from(struct index_state *istate, const char *path)
|
||||
size_t mmap_size;
|
||||
|
||||
errno = EBUSY;
|
||||
if (istate->alloc)
|
||||
if (istate->initialized)
|
||||
return istate->cache_nr;
|
||||
|
||||
errno = ENOENT;
|
||||
@@ -1195,6 +1199,7 @@ int read_index_from(struct index_state *istate, const char *path)
|
||||
* index size
|
||||
*/
|
||||
istate->alloc = xmalloc(estimate_cache_size(mmap_size, istate->cache_nr));
|
||||
istate->initialized = 1;
|
||||
|
||||
src_offset = sizeof(*hdr);
|
||||
dst_offset = 0;
|
||||
@@ -1247,6 +1252,7 @@ int discard_index(struct index_state *istate)
|
||||
cache_tree_free(&(istate->cache_tree));
|
||||
free(istate->alloc);
|
||||
istate->alloc = NULL;
|
||||
istate->initialized = 0;
|
||||
|
||||
/* no need to throw away allocated active_cache */
|
||||
return 0;
|
||||
|
||||
30
remote.c
30
remote.c
@@ -449,6 +449,26 @@ static int verify_refname(char *name, int is_glob)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function frees a refspec array.
|
||||
* Warning: code paths should be checked to ensure that the src
|
||||
* and dst pointers are always freeable pointers as well
|
||||
* as the refspec pointer itself.
|
||||
*/
|
||||
void free_refspecs(struct refspec *refspec, int nr_refspec)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!refspec)
|
||||
return;
|
||||
|
||||
for (i = 0; i < nr_refspec; i++) {
|
||||
free(refspec[i].src);
|
||||
free(refspec[i].dst);
|
||||
}
|
||||
free(refspec);
|
||||
}
|
||||
|
||||
static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)
|
||||
{
|
||||
int i;
|
||||
@@ -567,7 +587,12 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp
|
||||
|
||||
invalid:
|
||||
if (verify) {
|
||||
free(rs);
|
||||
/*
|
||||
* nr_refspec must be greater than zero and i must be valid
|
||||
* since it is only possible to reach this point from within
|
||||
* the for loop above.
|
||||
*/
|
||||
free_refspecs(rs, i+1);
|
||||
return NULL;
|
||||
}
|
||||
die("Invalid refspec '%s'", refspec[i]);
|
||||
@@ -579,8 +604,7 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
|
||||
struct refspec *refspec;
|
||||
|
||||
refspec = parse_refspec_internal(1, fetch_refspec, 1, 1);
|
||||
if (refspec)
|
||||
free(refspec);
|
||||
free_refspecs(refspec, 1);
|
||||
return !!refspec;
|
||||
}
|
||||
|
||||
|
||||
1
remote.h
1
remote.h
@@ -78,6 +78,7 @@ void ref_remove_duplicates(struct ref *ref_map);
|
||||
int valid_fetch_refspec(const char *refspec);
|
||||
struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
|
||||
struct refspec *parse_push_refspec(int nr_refspec, const char **refspec);
|
||||
void free_refspecs(struct refspec *refspec, int nr_refspec);
|
||||
|
||||
int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
|
||||
int nr_refspec, const char **refspec, int all);
|
||||
|
||||
34
revision.c
34
revision.c
@@ -782,6 +782,10 @@ void init_revisions(struct rev_info *revs, const char *prefix)
|
||||
|
||||
revs->commit_format = CMIT_FMT_DEFAULT;
|
||||
|
||||
revs->grep_filter.status_only = 1;
|
||||
revs->grep_filter.pattern_tail = &(revs->grep_filter.pattern_list);
|
||||
revs->grep_filter.regflags = REG_NEWLINE;
|
||||
|
||||
diff_setup(&revs->diffopt);
|
||||
if (prefix && !revs->diffopt.prefix) {
|
||||
revs->diffopt.prefix = prefix;
|
||||
@@ -946,15 +950,7 @@ void read_revisions_from_stdin(struct rev_info *revs)
|
||||
|
||||
static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token what)
|
||||
{
|
||||
if (!revs->grep_filter) {
|
||||
struct grep_opt *opt = xcalloc(1, sizeof(*opt));
|
||||
opt->status_only = 1;
|
||||
opt->pattern_tail = &(opt->pattern_list);
|
||||
opt->regflags = REG_NEWLINE;
|
||||
revs->grep_filter = opt;
|
||||
}
|
||||
append_grep_pattern(revs->grep_filter, ptn,
|
||||
"command line", 0, what);
|
||||
append_grep_pattern(&revs->grep_filter, ptn, "command line", 0, what);
|
||||
}
|
||||
|
||||
static void add_header_grep(struct rev_info *revs, const char *field, const char *pattern)
|
||||
@@ -1164,17 +1160,13 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
||||
} else if (!prefixcmp(arg, "--grep=")) {
|
||||
add_message_grep(revs, arg+7);
|
||||
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
|
||||
if (revs->grep_filter)
|
||||
revs->grep_filter->regflags |= REG_EXTENDED;
|
||||
revs->grep_filter.regflags |= REG_EXTENDED;
|
||||
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
|
||||
if (revs->grep_filter)
|
||||
revs->grep_filter->regflags |= REG_ICASE;
|
||||
revs->grep_filter.regflags |= REG_ICASE;
|
||||
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
|
||||
if (revs->grep_filter)
|
||||
revs->grep_filter->fixed = 1;
|
||||
revs->grep_filter.fixed = 1;
|
||||
} else if (!strcmp(arg, "--all-match")) {
|
||||
if (revs->grep_filter)
|
||||
revs->grep_filter->all_match = 1;
|
||||
revs->grep_filter.all_match = 1;
|
||||
} else if (!prefixcmp(arg, "--encoding=")) {
|
||||
arg += 11;
|
||||
if (strcmp(arg, "none"))
|
||||
@@ -1349,9 +1341,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
||||
if (diff_setup_done(&revs->diffopt) < 0)
|
||||
die("diff_setup_done failed");
|
||||
|
||||
if (revs->grep_filter) {
|
||||
compile_grep_patterns(revs->grep_filter);
|
||||
}
|
||||
compile_grep_patterns(&revs->grep_filter);
|
||||
|
||||
if (revs->reverse && revs->reflog_info)
|
||||
die("cannot combine --reverse with --walk-reflogs");
|
||||
@@ -1492,9 +1482,9 @@ static int rewrite_parents(struct rev_info *revs, struct commit *commit)
|
||||
|
||||
static int commit_match(struct commit *commit, struct rev_info *opt)
|
||||
{
|
||||
if (!opt->grep_filter)
|
||||
if (!opt->grep_filter.pattern_list)
|
||||
return 1;
|
||||
return grep_buffer(opt->grep_filter,
|
||||
return grep_buffer(&opt->grep_filter,
|
||||
NULL, /* we say nothing, not even filename */
|
||||
commit->buffer, strlen(commit->buffer));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define REVISION_H
|
||||
|
||||
#include "parse-options.h"
|
||||
#include "grep.h"
|
||||
|
||||
#define SEEN (1u<<0)
|
||||
#define UNINTERESTING (1u<<1)
|
||||
@@ -92,7 +93,7 @@ struct rev_info {
|
||||
int show_log_size;
|
||||
|
||||
/* Filter by commit log message */
|
||||
struct grep_opt *grep_filter;
|
||||
struct grep_opt grep_filter;
|
||||
|
||||
/* Display history graph */
|
||||
struct git_graph *graph;
|
||||
@@ -119,7 +120,7 @@ struct rev_info {
|
||||
void read_revisions_from_stdin(struct rev_info *revs);
|
||||
|
||||
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
|
||||
volatile show_early_output_fn_t show_early_output;
|
||||
extern volatile show_early_output_fn_t show_early_output;
|
||||
|
||||
extern void init_revisions(struct rev_info *revs, const char *prefix);
|
||||
extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def);
|
||||
|
||||
@@ -111,6 +111,8 @@ int start_command(struct child_process *cmd)
|
||||
unsetenv(*cmd->env);
|
||||
}
|
||||
}
|
||||
if (cmd->preexec_cb)
|
||||
cmd->preexec_cb();
|
||||
if (cmd->git_cmd) {
|
||||
execv_git_cmd(cmd->argv);
|
||||
} else {
|
||||
|
||||
@@ -42,6 +42,7 @@ struct child_process {
|
||||
unsigned no_stderr:1;
|
||||
unsigned git_cmd:1; /* if this is to be git sub-command */
|
||||
unsigned stdout_to_stderr:1;
|
||||
void (*preexec_cb)(void);
|
||||
};
|
||||
|
||||
int start_command(struct child_process *);
|
||||
|
||||
64
sha1_file.c
64
sha1_file.c
@@ -2360,51 +2360,22 @@ int has_sha1_file(const unsigned char *sha1)
|
||||
return has_loose_object(sha1);
|
||||
}
|
||||
|
||||
int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object)
|
||||
static int index_mem(unsigned char *sha1, void *buf, size_t size,
|
||||
int write_object, enum object_type type, const char *path)
|
||||
{
|
||||
struct strbuf buf;
|
||||
int ret;
|
||||
|
||||
strbuf_init(&buf, 0);
|
||||
if (strbuf_read(&buf, fd, 4096) < 0) {
|
||||
strbuf_release(&buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!type)
|
||||
type = blob_type;
|
||||
if (write_object)
|
||||
ret = write_sha1_file(buf.buf, buf.len, type, sha1);
|
||||
else
|
||||
ret = hash_sha1_file(buf.buf, buf.len, type, sha1);
|
||||
strbuf_release(&buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
|
||||
enum object_type type, const char *path)
|
||||
{
|
||||
size_t size = xsize_t(st->st_size);
|
||||
void *buf = NULL;
|
||||
int ret, re_allocated = 0;
|
||||
|
||||
if (size)
|
||||
buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
close(fd);
|
||||
|
||||
if (!type)
|
||||
type = OBJ_BLOB;
|
||||
|
||||
/*
|
||||
* Convert blobs to git internal format
|
||||
*/
|
||||
if ((type == OBJ_BLOB) && S_ISREG(st->st_mode)) {
|
||||
if ((type == OBJ_BLOB) && path) {
|
||||
struct strbuf nbuf;
|
||||
strbuf_init(&nbuf, 0);
|
||||
if (convert_to_git(path, buf, size, &nbuf,
|
||||
write_object ? safe_crlf : 0)) {
|
||||
munmap(buf, size);
|
||||
buf = strbuf_detach(&nbuf, &size);
|
||||
re_allocated = 1;
|
||||
}
|
||||
@@ -2414,12 +2385,33 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
|
||||
ret = write_sha1_file(buf, size, typename(type), sha1);
|
||||
else
|
||||
ret = hash_sha1_file(buf, size, typename(type), sha1);
|
||||
if (re_allocated) {
|
||||
if (re_allocated)
|
||||
free(buf);
|
||||
return ret;
|
||||
}
|
||||
if (size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
|
||||
enum object_type type, const char *path)
|
||||
{
|
||||
int ret;
|
||||
size_t size = xsize_t(st->st_size);
|
||||
|
||||
if (!S_ISREG(st->st_mode)) {
|
||||
struct strbuf sbuf;
|
||||
strbuf_init(&sbuf, 0);
|
||||
if (strbuf_read(&sbuf, fd, 4096) >= 0)
|
||||
ret = index_mem(sha1, sbuf.buf, sbuf.len, write_object,
|
||||
type, path);
|
||||
else
|
||||
ret = -1;
|
||||
strbuf_release(&sbuf);
|
||||
} else if (size) {
|
||||
void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
ret = index_mem(sha1, buf, size, write_object, type, path);
|
||||
munmap(buf, size);
|
||||
} else
|
||||
ret = index_mem(sha1, NULL, size, write_object, type, path);
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
|
||||
else
|
||||
nth = -1;
|
||||
}
|
||||
if (0 <= nth)
|
||||
if (100000000 <= nth) {
|
||||
at_time = nth;
|
||||
nth = -1;
|
||||
} else if (0 <= nth)
|
||||
at_time = 0;
|
||||
else {
|
||||
char *tmp = xstrndup(str + at + 2, reflog_len);
|
||||
|
||||
8
shell.c
8
shell.c
@@ -3,14 +3,6 @@
|
||||
#include "exec_cmd.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
/* Stubs for functions that make no sense for git-shell. These stubs
|
||||
* are provided here to avoid linking in external redundant modules.
|
||||
*/
|
||||
void release_pack_memory(size_t need, int fd){}
|
||||
void trace_argv_printf(const char **argv, const char *fmt, ...){}
|
||||
void trace_printf(const char *fmt, ...){}
|
||||
|
||||
|
||||
static int do_generic_cmd(const char *me, char *arg)
|
||||
{
|
||||
const char *my_argv[4];
|
||||
|
||||
2
t/.gitignore
vendored
2
t/.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
/trash directory
|
||||
/trash directory*
|
||||
/test-results
|
||||
|
||||
@@ -14,7 +14,8 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
||||
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
|
||||
TSVN = $(wildcard t91[0-9][0-9]-*.sh)
|
||||
|
||||
all: pre-clean $(T) aggregate-results clean
|
||||
all: pre-clean
|
||||
$(MAKE) aggregate-results-and-cleanup
|
||||
|
||||
$(T):
|
||||
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
|
||||
@@ -25,6 +26,10 @@ pre-clean:
|
||||
clean:
|
||||
$(RM) -r 'trash directory' test-results
|
||||
|
||||
aggregate-results-and-cleanup: $(T)
|
||||
$(MAKE) aggregate-results
|
||||
$(MAKE) clean
|
||||
|
||||
aggregate-results:
|
||||
'$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*
|
||||
|
||||
@@ -34,4 +39,3 @@ full-svn-test:
|
||||
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
|
||||
|
||||
.PHONY: pre-clean $(T) aggregate-results clean
|
||||
.NOTPARALLEL:
|
||||
|
||||
@@ -14,7 +14,7 @@ fi
|
||||
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/apache2'}
|
||||
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
|
||||
|
||||
TEST_PATH="$PWD"/../lib-httpd
|
||||
TEST_PATH="$TEST_DIRECTORY"/lib-httpd
|
||||
HTTPD_ROOT_PATH="$PWD"/httpd
|
||||
HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ test_description='ignore CR in CRLF sequence while computing similiarity'
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
cat ../t0022-crlf-rename.sh >sample &&
|
||||
cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample &&
|
||||
git add sample &&
|
||||
|
||||
test_tick &&
|
||||
git commit -m Initial &&
|
||||
|
||||
sed -e "s/\$/
|
||||
sed -e "s/\$/
|
||||
/" "$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas &&
|
||||
git add elpmas &&
|
||||
rm -f sample &&
|
||||
|
||||
25
t/t0055-beyond-symlinks.sh
Executable file
25
t/t0055-beyond-symlinks.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='update-index and add refuse to add beyond symlinks'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success setup '
|
||||
>a &&
|
||||
mkdir b &&
|
||||
ln -s b c &&
|
||||
>c/d &&
|
||||
git update-index --add a b/d
|
||||
'
|
||||
|
||||
test_expect_success 'update-index --add beyond symlinks' '
|
||||
test_must_fail git update-index --add c/d &&
|
||||
! ( git ls-files | grep c/d )
|
||||
'
|
||||
|
||||
test_expect_success 'add beyond symlinks' '
|
||||
test_must_fail git add c/d &&
|
||||
! ( git ls-files | grep c/d )
|
||||
'
|
||||
|
||||
test_done
|
||||
@@ -72,7 +72,7 @@ In addition:
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../lib-read-tree-m-3way.sh
|
||||
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
|
||||
|
||||
################################################################
|
||||
# Trivial "majority when 3 stages exist" merge plus #2ALT, #3ALT
|
||||
|
||||
@@ -20,6 +20,8 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
|
||||
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
|
||||
compare_change () {
|
||||
sed >current \
|
||||
-e '1{/^diff --git /d;}' \
|
||||
-e '2{/^index /d;}' \
|
||||
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
|
||||
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
|
||||
test_cmp expected current
|
||||
@@ -81,7 +83,7 @@ test_expect_success \
|
||||
git update-index --add yomin &&
|
||||
git read-tree -m -u $treeH $treeM &&
|
||||
git ls-files --stage >4.out || return 1
|
||||
diff -U0 M.out 4.out >4diff.out
|
||||
git diff -U0 --no-index M.out 4.out >4diff.out
|
||||
compare_change 4diff.out expected &&
|
||||
check_cache_at yomin clean &&
|
||||
sum bozbar frotz nitfol >actual4.sum &&
|
||||
@@ -100,7 +102,7 @@ test_expect_success \
|
||||
echo yomin yomin >yomin &&
|
||||
git read-tree -m -u $treeH $treeM &&
|
||||
git ls-files --stage >5.out || return 1
|
||||
diff -U0 M.out 5.out >5diff.out
|
||||
git diff -U0 --no-index M.out 5.out >5diff.out
|
||||
compare_change 5diff.out expected &&
|
||||
check_cache_at yomin dirty &&
|
||||
sum bozbar frotz nitfol >actual5.sum &&
|
||||
@@ -212,7 +214,7 @@ test_expect_success \
|
||||
git update-index --add nitfol &&
|
||||
git read-tree -m -u $treeH $treeM &&
|
||||
git ls-files --stage >14.out || return 1
|
||||
diff -U0 M.out 14.out >14diff.out
|
||||
git diff -U0 --no-index M.out 14.out >14diff.out
|
||||
compare_change 14diff.out expected &&
|
||||
sum bozbar frotz >actual14.sum &&
|
||||
grep -v nitfol M.sum > expected14.sum &&
|
||||
@@ -233,7 +235,7 @@ test_expect_success \
|
||||
echo nitfol nitfol nitfol >nitfol &&
|
||||
git read-tree -m -u $treeH $treeM &&
|
||||
git ls-files --stage >15.out || return 1
|
||||
diff -U0 M.out 15.out >15diff.out
|
||||
git diff -U0 --no-index M.out 15.out >15diff.out
|
||||
compare_change 15diff.out expected &&
|
||||
check_cache_at nitfol dirty &&
|
||||
sum bozbar frotz >actual15.sum &&
|
||||
|
||||
@@ -49,16 +49,28 @@ setup_repo
|
||||
# Argument checking
|
||||
|
||||
test_expect_success "multiple '--stdin's are rejected" '
|
||||
test_must_fail git hash-object --stdin --stdin < example
|
||||
echo example | test_must_fail git hash-object --stdin --stdin
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --stdin and --stdin-paths together" '
|
||||
test_must_fail git hash-object --stdin --stdin-paths &&
|
||||
test_must_fail git hash-object --stdin-paths --stdin
|
||||
echo example | test_must_fail git hash-object --stdin --stdin-paths &&
|
||||
echo example | test_must_fail git hash-object --stdin-paths --stdin
|
||||
'
|
||||
|
||||
test_expect_success "Can't pass filenames as arguments with --stdin-paths" '
|
||||
test_must_fail git hash-object --stdin-paths hello < example
|
||||
echo example | test_must_fail git hash-object --stdin-paths hello
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --path with --stdin-paths" '
|
||||
echo example | test_must_fail git hash-object --stdin-paths --path=foo
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --stdin-paths with --no-filters" '
|
||||
echo example | test_must_fail git hash-object --stdin-paths --no-filters
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --path with --no-filters" '
|
||||
test_must_fail git hash-object --no-filters --path=foo
|
||||
'
|
||||
|
||||
# Behavior
|
||||
@@ -93,6 +105,42 @@ test_expect_success 'git hash-object --stdin file1 <file0 first operates on file
|
||||
test "$obname1" = "$obname1new"
|
||||
'
|
||||
|
||||
test_expect_success 'check that appropriate filter is invoke when --path is used' '
|
||||
echo fooQ | tr Q "\\015" >file0 &&
|
||||
cp file0 file1 &&
|
||||
echo "file0 -crlf" >.gitattributes &&
|
||||
echo "file1 crlf" >>.gitattributes &&
|
||||
git config core.autocrlf true &&
|
||||
file0_sha=$(git hash-object file0) &&
|
||||
file1_sha=$(git hash-object file1) &&
|
||||
test "$file0_sha" != "$file1_sha" &&
|
||||
path1_sha=$(git hash-object --path=file1 file0) &&
|
||||
path0_sha=$(git hash-object --path=file0 file1) &&
|
||||
test "$file0_sha" = "$path0_sha" &&
|
||||
test "$file1_sha" = "$path1_sha" &&
|
||||
path1_sha=$(cat file0 | git hash-object --path=file1 --stdin) &&
|
||||
path0_sha=$(cat file1 | git hash-object --path=file0 --stdin) &&
|
||||
test "$file0_sha" = "$path0_sha" &&
|
||||
test "$file1_sha" = "$path1_sha" &&
|
||||
git config --unset core.autocrlf
|
||||
'
|
||||
|
||||
test_expect_success 'check that --no-filters option works' '
|
||||
echo fooQ | tr Q "\\015" >file0 &&
|
||||
cp file0 file1 &&
|
||||
echo "file0 -crlf" >.gitattributes &&
|
||||
echo "file1 crlf" >>.gitattributes &&
|
||||
git config core.autocrlf true &&
|
||||
file0_sha=$(git hash-object file0) &&
|
||||
file1_sha=$(git hash-object file1) &&
|
||||
test "$file0_sha" != "$file1_sha" &&
|
||||
nofilters_file1=$(git hash-object --no-filters file1) &&
|
||||
test "$file0_sha" = "$nofilters_file1" &&
|
||||
nofilters_file1=$(cat file1 | git hash-object --stdin) &&
|
||||
test "$file0_sha" = "$nofilters_file1" &&
|
||||
git config --unset core.autocrlf
|
||||
'
|
||||
|
||||
pop_repo
|
||||
|
||||
for args in "-w --stdin" "--stdin -w"; do
|
||||
|
||||
@@ -269,6 +269,17 @@ test_expect_success 'merge-recursive result' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'fail if the index has unresolved entries' '
|
||||
|
||||
rm -fr [abcd] &&
|
||||
git checkout -f "$c1" &&
|
||||
|
||||
test_must_fail git merge "$c5" &&
|
||||
test_must_fail git merge "$c5" 2> out &&
|
||||
grep "You are in the middle of a conflicted merge" out
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'merge-recursive remove conflict' '
|
||||
|
||||
rm -fr [abcd] &&
|
||||
|
||||
@@ -21,7 +21,7 @@ cat >"$p0" <<\EOF
|
||||
3. A quick brown fox jumps over the lazy cat, oops dog.
|
||||
EOF
|
||||
|
||||
cat >"$p1" "$p0"
|
||||
cat 2>/dev/null >"$p1" "$p0"
|
||||
echo 'Foo Bar Baz' >"$p2"
|
||||
|
||||
test -f "$p1" && cmp "$p0" "$p1" || {
|
||||
|
||||
@@ -16,7 +16,7 @@ test_expect_success setup '
|
||||
: >F &&
|
||||
git add F &&
|
||||
T=$(git write-tree) &&
|
||||
C=$(git commit-tree $T <../t3900/1-UTF-8.txt) &&
|
||||
C=$(git commit-tree $T <"$TEST_DIRECTORY"/t3900/1-UTF-8.txt) &&
|
||||
git update-ref HEAD $C &&
|
||||
git-tag C0
|
||||
'
|
||||
@@ -32,7 +32,7 @@ do
|
||||
git config i18n.commitencoding $H &&
|
||||
git-checkout -b $H C0 &&
|
||||
echo $H >F &&
|
||||
git-commit -a -F ../t3900/$H.txt
|
||||
git-commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt
|
||||
'
|
||||
done
|
||||
|
||||
@@ -57,13 +57,13 @@ test_expect_success 'config to remove customization' '
|
||||
'
|
||||
|
||||
test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
|
||||
compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
|
||||
compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
|
||||
'
|
||||
|
||||
for H in EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success "$H should be shown in UTF-8 now" '
|
||||
compare_with '$H' ../t3900/2-UTF-8.txt
|
||||
compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
|
||||
'
|
||||
done
|
||||
|
||||
@@ -82,7 +82,7 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success "$H should be shown in itself now" '
|
||||
git config i18n.commitencoding '$H' &&
|
||||
compare_with '$H' ../t3900/'$H'.txt
|
||||
compare_with '$H' "$TEST_DIRECTORY"/t3900/'$H'.txt
|
||||
'
|
||||
done
|
||||
|
||||
@@ -91,13 +91,13 @@ test_expect_success 'config to tweak customization' '
|
||||
'
|
||||
|
||||
test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
|
||||
compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
|
||||
compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
|
||||
'
|
||||
|
||||
for H in EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success "$H should be shown in UTF-8 now" '
|
||||
compare_with '$H' ../t3900/2-UTF-8.txt
|
||||
compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
|
||||
'
|
||||
done
|
||||
|
||||
@@ -107,7 +107,7 @@ do
|
||||
for H in EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success "$H should be shown in $J now" '
|
||||
compare_with '$H' ../t3900/'$J'.txt
|
||||
compare_with '$H' "$TEST_DIRECTORY"/t3900/'$J'.txt
|
||||
'
|
||||
done
|
||||
done
|
||||
@@ -115,7 +115,7 @@ done
|
||||
for H in ISO-8859-1 EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success "No conversion with $H" '
|
||||
compare_with "--encoding=none '$H'" ../t3900/'$H'.txt
|
||||
compare_with "--encoding=none '$H'" "$TEST_DIRECTORY"/t3900/'$H'.txt
|
||||
'
|
||||
done
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ test_expect_success setup '
|
||||
|
||||
# use UTF-8 in author and committer name to match the
|
||||
# i18n.commitencoding settings
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
test_tick &&
|
||||
echo "$GIT_AUTHOR_NAME" >mine &&
|
||||
@@ -57,7 +57,7 @@ test_expect_success setup '
|
||||
# the second one on the side branch is ISO-8859-1
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
# use author and committer name in ISO-8859-1 to match it.
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
test_tick &&
|
||||
echo Yet another >theirs &&
|
||||
git add theirs &&
|
||||
@@ -101,7 +101,7 @@ test_expect_success 'rebase (U/U)' '
|
||||
|
||||
# The result will be committed by GIT_COMMITTER_NAME --
|
||||
# we want UTF-8 encoded name.
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
git checkout -b test &&
|
||||
git-rebase master &&
|
||||
|
||||
@@ -111,7 +111,7 @@ test_expect_success 'rebase (U/U)' '
|
||||
test_expect_success 'rebase (U/L)' '
|
||||
git config i18n.commitencoding UTF-8 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase master &&
|
||||
@@ -123,7 +123,7 @@ test_expect_success 'rebase (L/L)' '
|
||||
# In this test we want ISO-8859-1 encoded commits as the result
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase master &&
|
||||
@@ -136,7 +136,7 @@ test_expect_success 'rebase (L/U)' '
|
||||
# to get ISO-8859-1 results.
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding UTF-8 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase master &&
|
||||
@@ -149,7 +149,7 @@ test_expect_success 'cherry-pick(U/U)' '
|
||||
|
||||
git config i18n.commitencoding UTF-8 &&
|
||||
git config i18n.logoutputencoding UTF-8 &&
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
git reset --hard master &&
|
||||
git cherry-pick side^ &&
|
||||
@@ -164,7 +164,7 @@ test_expect_success 'cherry-pick(L/L)' '
|
||||
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard master &&
|
||||
git cherry-pick side^ &&
|
||||
@@ -179,7 +179,7 @@ test_expect_success 'cherry-pick(U/L)' '
|
||||
|
||||
git config i18n.commitencoding UTF-8 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
git reset --hard master &&
|
||||
git cherry-pick side^ &&
|
||||
@@ -195,7 +195,7 @@ test_expect_success 'cherry-pick(L/U)' '
|
||||
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding UTF-8 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard master &&
|
||||
git cherry-pick side^ &&
|
||||
@@ -208,7 +208,7 @@ test_expect_success 'cherry-pick(L/U)' '
|
||||
test_expect_success 'rebase --merge (U/U)' '
|
||||
git config i18n.commitencoding UTF-8 &&
|
||||
git config i18n.logoutputencoding UTF-8 &&
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase --merge master &&
|
||||
@@ -219,7 +219,7 @@ test_expect_success 'rebase --merge (U/U)' '
|
||||
test_expect_success 'rebase --merge (U/L)' '
|
||||
git config i18n.commitencoding UTF-8 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-utf8.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase --merge master &&
|
||||
@@ -231,7 +231,7 @@ test_expect_success 'rebase --merge (L/L)' '
|
||||
# In this test we want ISO-8859-1 encoded commits as the result
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding ISO-8859-1 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase --merge master &&
|
||||
@@ -244,7 +244,7 @@ test_expect_success 'rebase --merge (L/U)' '
|
||||
# to get ISO-8859-1 results.
|
||||
git config i18n.commitencoding ISO-8859-1 &&
|
||||
git config i18n.logoutputencoding UTF-8 &&
|
||||
. ../t3901-8859-1.txt &&
|
||||
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
|
||||
|
||||
git reset --hard side &&
|
||||
git-rebase --merge master &&
|
||||
|
||||
@@ -7,12 +7,6 @@ test_description='quoted output'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
P1='pathname with HT'
|
||||
: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
|
||||
echo >&2 'Filesystem does not support HT in names'
|
||||
test_done
|
||||
}
|
||||
|
||||
FN='濱野'
|
||||
GN='純'
|
||||
HT=' '
|
||||
@@ -20,7 +14,7 @@ LF='
|
||||
'
|
||||
DQ='"'
|
||||
|
||||
echo foo > "Name and an${HT}HT"
|
||||
echo foo 2>/dev/null > "Name and an${HT}HT"
|
||||
test -f "Name and an${HT}HT" || {
|
||||
# since FAT/NTFS does not allow tabs in filenames, skip this test
|
||||
say 'Your filesystem does not allow tabs in filenames, test skipped.'
|
||||
|
||||
@@ -7,7 +7,7 @@ test_description='Test built-in diff output engine.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
echo >path0 'Line 1
|
||||
Line 2
|
||||
|
||||
@@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
echo >path0 'Line 1
|
||||
Line 2
|
||||
|
||||
@@ -7,7 +7,7 @@ test_description='Test diff raw-output.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../lib-read-tree-m-3way.sh
|
||||
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
|
||||
|
||||
cat >.test-plain-OA <<\EOF
|
||||
:000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA
|
||||
@@ -168,6 +168,20 @@ test_expect_success \
|
||||
'git diff-tree -r $tree_A $tree_B >.test-a &&
|
||||
cmp -s .test-a .test-recursive-AB'
|
||||
|
||||
test_expect_success \
|
||||
'diff-tree --stdin of known trees.' \
|
||||
'echo $tree_A $tree_B | git diff-tree --stdin > .test-a &&
|
||||
echo $tree_A $tree_B > .test-plain-ABx &&
|
||||
cat .test-plain-AB >> .test-plain-ABx &&
|
||||
cmp -s .test-a .test-plain-ABx'
|
||||
|
||||
test_expect_success \
|
||||
'diff-tree --stdin of known trees.' \
|
||||
'echo $tree_A $tree_B | git diff-tree -r --stdin > .test-a &&
|
||||
echo $tree_A $tree_B > .test-recursive-ABx &&
|
||||
cat .test-recursive-AB >> .test-recursive-ABx &&
|
||||
cmp -s .test-a .test-recursive-ABx'
|
||||
|
||||
test_expect_success \
|
||||
'diff-cache O with A in cache' \
|
||||
'git read-tree $tree_A &&
|
||||
|
||||
@@ -7,11 +7,11 @@ test_description='More rename detection
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
'prepare reference tree' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
echo frotz >rezrov &&
|
||||
git update-index --add COPYING rezrov &&
|
||||
tree=$(git write-tree) &&
|
||||
@@ -99,7 +99,7 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'prepare work tree once again' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
git update-index --add --remove COPYING COPYING.1'
|
||||
|
||||
# tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
|
||||
|
||||
@@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
|
||||
by an edit for them.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
then
|
||||
|
||||
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
'prepare reference tree' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
echo frotz >rezrov &&
|
||||
git update-index --add COPYING rezrov &&
|
||||
tree=$(git write-tree) &&
|
||||
@@ -71,7 +71,7 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'prepare work tree once again' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
git update-index --add --remove COPYING COPYING.1'
|
||||
|
||||
git diff-index -C --find-copies-harder $tree >current
|
||||
|
||||
@@ -7,12 +7,12 @@ test_description='Rename interaction with pathspec.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
'prepare reference tree' \
|
||||
'mkdir path0 path1 &&
|
||||
cp ../../COPYING path0/COPYING &&
|
||||
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
|
||||
git update-index --add path0/COPYING &&
|
||||
tree=$(git write-tree) &&
|
||||
echo $tree'
|
||||
|
||||
@@ -22,12 +22,12 @@ four changes in total.
|
||||
Further, with -B and -M together, these should turn into two renames.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
setup \
|
||||
'cat ../../README >file0 &&
|
||||
cat ../../COPYING >file1 &&
|
||||
'cat "$TEST_DIRECTORY"/../README >file0 &&
|
||||
cat "$TEST_DIRECTORY"/../COPYING >file1 &&
|
||||
git update-index --add file0 file1 &&
|
||||
tree=$(git write-tree) &&
|
||||
echo "$tree"'
|
||||
|
||||
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
'prepare reference tree' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
echo frotz >rezrov &&
|
||||
git update-index --add COPYING rezrov &&
|
||||
tree=$(git write-tree) &&
|
||||
@@ -78,7 +78,7 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'prepare work tree once again' \
|
||||
'cat ../../COPYING >COPYING &&
|
||||
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
|
||||
git update-index --add --remove COPYING COPYING.1'
|
||||
|
||||
git diff-index -z -C --find-copies-harder $tree >current
|
||||
|
||||
@@ -10,7 +10,7 @@ Prepare:
|
||||
path1/file1
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh ;# test-lib chdir's into trash
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
|
||||
|
||||
test_expect_success \
|
||||
setup \
|
||||
|
||||
@@ -7,7 +7,7 @@ test_description='Test diff of symlinks.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
then
|
||||
|
||||
@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
|
||||
'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
|
||||
git update-index --add a b c d &&
|
||||
echo git >a &&
|
||||
cat ../test4012.png >b &&
|
||||
cat "$TEST_DIRECTORY"/test4012.png >b &&
|
||||
echo git >c &&
|
||||
cat b b >d'
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ do
|
||||
test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
|
||||
cnt=`expr $test_count + 1`
|
||||
pfx=`printf "%04d" $cnt`
|
||||
expect="../t4013/diff.$test"
|
||||
expect="$TEST_DIRECTORY/t4013/diff.$test"
|
||||
actual="$pfx-diff.$test"
|
||||
|
||||
test_expect_success "git $cmd" '
|
||||
|
||||
@@ -230,4 +230,29 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
|
||||
|
||||
'
|
||||
|
||||
cat > expect << EOF
|
||||
---
|
||||
file | 16 ++++++++++++++++
|
||||
1 files changed, 16 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/file b/file
|
||||
index 40f36c6..2dc5c23 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -13,4 +13,20 @@ C
|
||||
10
|
||||
D
|
||||
E
|
||||
F
|
||||
+5
|
||||
EOF
|
||||
|
||||
test_expect_success 'format-patch respects -U' '
|
||||
|
||||
git format-patch -U4 -2 &&
|
||||
sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
|
||||
|
||||
'
|
||||
. ./test-lib.sh
|
||||
. ../diff-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
# Ray Lehtiniemi's example
|
||||
|
||||
@@ -341,4 +341,31 @@ test_expect_success 'checkdiff detects trailing blank lines' '
|
||||
git diff --check | grep "ends with blank"
|
||||
'
|
||||
|
||||
test_expect_success 'checkdiff allows new blank lines' '
|
||||
git checkout x &&
|
||||
mv x y &&
|
||||
(
|
||||
echo "/* This is new */" &&
|
||||
echo "" &&
|
||||
cat y
|
||||
) >x &&
|
||||
git diff --check
|
||||
'
|
||||
|
||||
test_expect_success 'combined diff with autocrlf conversion' '
|
||||
|
||||
git reset --hard &&
|
||||
echo >x hello &&
|
||||
git commit -m "one side" x &&
|
||||
git checkout HEAD^ &&
|
||||
echo >x goodbye &&
|
||||
git commit -m "the other side" x &&
|
||||
git config core.autocrlf true &&
|
||||
test_must_fail git merge master &&
|
||||
|
||||
git diff | sed -e "1,/^@@@/d" >actual &&
|
||||
! grep "^-" actual
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -13,8 +13,8 @@ P1='pathname with HT'
|
||||
P2='pathname with SP'
|
||||
P3='pathname
|
||||
with LF'
|
||||
: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
|
||||
echo >&2 'Filesystem does not support tabs in names'
|
||||
: 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
|
||||
say 'Your filesystem does not allow tabs in filenames, test skipped.'
|
||||
test_done
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user