mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Merge branch 'master' of git://repo.or.cz/alt-git
This commit is contained in:
@@ -44,6 +44,7 @@ MANPAGE_XSL = callouts.xsl
|
||||
INSTALL?=install
|
||||
RM ?= rm -f
|
||||
DOC_REF = origin/man
|
||||
HTML_REF = origin/html
|
||||
|
||||
infodir?=$(prefix)/share/info
|
||||
MAKEINFO=makeinfo
|
||||
@@ -222,4 +223,7 @@ install-webdoc : html
|
||||
quick-install:
|
||||
sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
|
||||
|
||||
quick-install-html:
|
||||
sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
|
||||
|
||||
.PHONY: .FORCE-GIT-VERSION-FILE
|
||||
|
||||
@@ -17,6 +17,10 @@ Fixes since v1.6.0.1
|
||||
* Many commands did not use the correct working tree location when used
|
||||
with GIT_WORK_TREE environment settings.
|
||||
|
||||
* Some systems needs to use compatibility fnmach and regex libraries
|
||||
independent from each other; the compat/ area has been reorganized to
|
||||
allow this.
|
||||
|
||||
|
||||
* "git apply --unidiff-zero" incorrectly applied a -U0 patch that inserts
|
||||
a new line before the second line.
|
||||
@@ -24,9 +28,15 @@ Fixes since v1.6.0.1
|
||||
* "git blame -c" did not exactly work like "git annotate" when range
|
||||
boundaries are involved.
|
||||
|
||||
* "git checkout file" when file is still unmerged checked out contents from
|
||||
a random high order stage, which was confusing.
|
||||
|
||||
* "git clone $there $here/" with extra trailing slashes after explicit
|
||||
local directory name $here did not work as expected.
|
||||
|
||||
* "git diff" on tracked contents with CRLF line endings did not drive "less"
|
||||
intelligently when showing added or removed lines.
|
||||
|
||||
* "git diff --dirstat -M" did not add changes in subdirectories up
|
||||
correctly for renamed paths.
|
||||
|
||||
@@ -42,18 +52,29 @@ Fixes since v1.6.0.1
|
||||
|
||||
* "git gui" translation updates and i18n fixes.
|
||||
|
||||
* "git index-pack" is more careful against disk corruption while completing
|
||||
a thin pack.
|
||||
|
||||
* "git log -i --grep=pattern" did not ignore case; neither "git log -E
|
||||
--grep=pattern" triggered extended regexp.
|
||||
|
||||
* "git log --pretty="%ad" --date=short" did not use short format when
|
||||
showing the timestamp.
|
||||
|
||||
* "git log --author=author" match incorrectly matched with the
|
||||
timestamp part of "author " line in commit objects.
|
||||
|
||||
* "git log -F --author=author" did not work at all.
|
||||
|
||||
* Build procedure for "git shell" that used stub versions of some
|
||||
functions and globals was not understood by linkers on some platforms.
|
||||
|
||||
* "git stash" was fooled by a stat-dirty but otherwise unmodified paths
|
||||
and refused to work until the user refreshed the index.
|
||||
|
||||
* "git svn" was broken on Perl before 5.8 with recent fixes to reduce
|
||||
use of temporary files.
|
||||
|
||||
* "git verify-pack -v" did not work correctly when given more than one
|
||||
packfile.
|
||||
|
||||
@@ -61,7 +82,6 @@ Also contains many documentation updates.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.6.0.1-61-g1eff26c
|
||||
O=v1.6.0.1-78-g3632cfc
|
||||
echo O=$(git describe maint)
|
||||
git shortlog --no-merges $O..maint
|
||||
|
||||
|
||||
29
Documentation/RelNotes-1.6.0.3.txt
Normal file
29
Documentation/RelNotes-1.6.0.3.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
GIT v1.6.0.3 Release Notes
|
||||
==========================
|
||||
|
||||
Fixes since v1.6.0.2
|
||||
--------------------
|
||||
|
||||
* "git archive --format=zip" did not honor core.autocrlf while
|
||||
--format=tar did.
|
||||
|
||||
* Continuing "git rebase -i" was very confused when the user left modified
|
||||
files in the working tree while resolving conflicts.
|
||||
|
||||
* Continuing "git rebase -i" was also very confused when the user left
|
||||
some staged changes in the index after "edit".
|
||||
|
||||
* Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code"
|
||||
with the output redirected to /dev/null.
|
||||
|
||||
* "Git.pm" tests relied on unnecessarily more recent version of Perl.
|
||||
|
||||
* "gitweb" triggered undef warning on commits without log messages.
|
||||
|
||||
Many other documentation updates.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.6.0.2-32-g8d11fde
|
||||
echo O=$(git describe maint)
|
||||
git shortlog --no-merges $O..maint
|
||||
@@ -32,8 +32,19 @@ on.
|
||||
* Most of the test scripts (but not the ones that try to run servers)
|
||||
can be run in parallel.
|
||||
|
||||
* Bash completion of refnames in a repository with massive number of
|
||||
refs has been optimized.
|
||||
|
||||
(usability, bells and whistles)
|
||||
|
||||
* When you mistype a command name, git helpfully suggests what it guesses
|
||||
you might have meant to say. help.autocorrect configuration can be set
|
||||
to a non-zero value to accept the suggestion when git can uniquely
|
||||
guess.
|
||||
|
||||
* "git bisect" is careful about a user mistake and suggests testing of
|
||||
merge base first when good is not a strict ancestor of bad.
|
||||
|
||||
* "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".
|
||||
@@ -54,6 +65,12 @@ on.
|
||||
* "git diff" learned to put more sensible hunk headers for Python and
|
||||
HTML contents.
|
||||
|
||||
* "git diff" learned to vary the a/ vs b/ prefix depending on what are
|
||||
being compared, controlled by diff.mnemonicprefix configuration.
|
||||
|
||||
* "git for-each-ref" learned "refname:short" token that gives an
|
||||
unambiguously abbreviated refname.
|
||||
|
||||
* "git help" learned to use GIT_MAN_VIEWER environment variable before
|
||||
using "man" program.
|
||||
|
||||
@@ -68,6 +85,9 @@ on.
|
||||
* "git log" learned --simplify-merges, a milder variant of --full-history;
|
||||
"gitk --simplify-merges" is easier to view than with --full-history.
|
||||
|
||||
* "git log --pretty=format:" learned "%d" format element that inserts
|
||||
names of tags that point at the commit.
|
||||
|
||||
* "git merge --squash" and "git merge --no-ff" into an unborn branch are
|
||||
noticed as user errors.
|
||||
|
||||
@@ -115,6 +135,6 @@ release, unless otherwise noted.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
O=v1.6.0.1-266-gaf9552f
|
||||
O=v1.6.0.2-295-g34a5d35
|
||||
echo O=$(git describe master)
|
||||
git shortlog --no-merges $O..master ^maint
|
||||
|
||||
@@ -585,6 +585,22 @@ diff.external::
|
||||
you want to use an external diff program only on a subset of
|
||||
your files, you might want to use linkgit:gitattributes[5] instead.
|
||||
|
||||
diff.mnemonicprefix::
|
||||
If set, 'git-diff' uses a prefix pair that is different from the
|
||||
standard "a/" and "b/" depending on what is being compared. When
|
||||
this configuration is in effect, reverse diff output also swaps
|
||||
the order of the prefixes:
|
||||
'git-diff';;
|
||||
compares the (i)ndex and the (w)ork tree;
|
||||
'git-diff HEAD';;
|
||||
compares a (c)ommit and the (w)ork tree;
|
||||
'git diff --cached';;
|
||||
compares a (c)ommit and the (i)ndex;
|
||||
'git-diff HEAD:file1 file2';;
|
||||
compares an (o)bject and a (w)ork tree entity;
|
||||
'git diff --no-index a b';;
|
||||
compares two non-git things (1) and (2).
|
||||
|
||||
diff.renameLimit::
|
||||
The number of files to consider when performing the copy/rename
|
||||
detection; equivalent to the 'git-diff' option '-l'.
|
||||
@@ -790,6 +806,15 @@ help.format::
|
||||
Values 'man', 'info', 'web' and 'html' are supported. 'man' is
|
||||
the default. 'web' and 'html' are the same.
|
||||
|
||||
help.autocorrect::
|
||||
Automatically correct and execute mistyped commands after
|
||||
waiting for the given number of deciseconds (0.1 sec). If more
|
||||
than one command can be deduced from the entered text, nothing
|
||||
will be executed. If the value of this option is negative,
|
||||
the corrected command will be executed immediately. If the
|
||||
value is 0 - the command will be just shown but not executed.
|
||||
This is the default.
|
||||
|
||||
http.proxy::
|
||||
Override the HTTP proxy, normally configured using the 'http_proxy'
|
||||
environment variable (see linkgit:curl[1]). This can be overridden
|
||||
|
||||
@@ -74,6 +74,7 @@ For all objects, the following names can be used:
|
||||
|
||||
refname::
|
||||
The name of the ref (the part after $GIT_DIR/).
|
||||
For a non-ambiguous short name of the ref append `:short`.
|
||||
|
||||
objecttype::
|
||||
The type of the object (`blob`, `tree`, `commit`, `tag`).
|
||||
|
||||
@@ -160,7 +160,10 @@ Here are the "carry forward" rules:
|
||||
0 nothing nothing nothing (does not happen)
|
||||
1 nothing nothing exists use M
|
||||
2 nothing exists nothing remove path from index
|
||||
3 nothing exists exists use M
|
||||
3 nothing exists exists, use M if "initial checkout"
|
||||
H == M keep index otherwise
|
||||
exists fail
|
||||
H != M
|
||||
|
||||
clean I==H I==M
|
||||
------------------
|
||||
@@ -207,6 +210,12 @@ you picked it up via e-mail in a patch form), `git diff-index
|
||||
merge, but it would not show in `git diff-index --cached $M`
|
||||
output after two-tree merge.
|
||||
|
||||
Case #3 is slightly tricky and needs explanation. The result from this
|
||||
rule logically should be to remove the path if the user staged the removal
|
||||
of the path and then swiching to a new branch. That however will prevent
|
||||
the initial checkout from happening, so the rule is modified to use M (new
|
||||
tree) only when the contents of the index is empty. Otherwise the removal
|
||||
of the path is kept as long as $H and $M are the same.
|
||||
|
||||
3-Way Merge
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -60,7 +60,7 @@ OPTIONS
|
||||
linkgit:git-pack-objects[1].
|
||||
|
||||
-f::
|
||||
Pass the `--no-reuse-delta` option to 'git-pack-objects'. See
|
||||
Pass the `--no-reuse-object` option to `git-pack-objects`, see
|
||||
linkgit:git-pack-objects[1].
|
||||
|
||||
-q::
|
||||
|
||||
@@ -77,7 +77,7 @@ the URLs passed as arguments.
|
||||
Note about konqueror
|
||||
--------------------
|
||||
|
||||
When 'konqueror' is specified by the a command line option or a
|
||||
When 'konqueror' is specified by a command line option or a
|
||||
configuration variable, we launch 'kfmclient' to try to open the HTML
|
||||
man page on an already opened konqueror in a new tab if possible.
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ 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.1/git.html[documentation for release 1.6.1]
|
||||
* link:v1.6.0.2/git.html[documentation for release 1.6.0.2]
|
||||
|
||||
* release notes for
|
||||
link:RelNotes-1.6.1.txt[1.6.1],
|
||||
link:RelNotes-1.6.0.2.txt[1.6.0.2],
|
||||
link:RelNotes-1.6.0.1.txt[1.6.0.1],
|
||||
link:RelNotes-1.6.0.txt[1.6.0].
|
||||
|
||||
* link:v1.5.6.5/git.html[documentation for release 1.5.6.5]
|
||||
|
||||
@@ -270,27 +270,27 @@ See linkgit:git[1] for details.
|
||||
Defining a custom hunk-header
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Each group of changes (called "hunk") in the textual diff output
|
||||
Each group of changes (called a "hunk") in the textual diff output
|
||||
is prefixed with a line of the form:
|
||||
|
||||
@@ -k,l +n,m @@ TEXT
|
||||
|
||||
The text is called 'hunk header', and by default a line that
|
||||
begins with an alphabet, an underscore or a dollar sign is used,
|
||||
which matches what GNU 'diff -p' output uses. This default
|
||||
selection however is not suited for some contents, and you can
|
||||
use customized pattern to make a selection.
|
||||
This is called a 'hunk header'. The "TEXT" portion is by default a line
|
||||
that begins with an alphabet, an underscore or a dollar sign; this
|
||||
matches what GNU 'diff -p' output uses. This default selection however
|
||||
is not suited for some contents, and you can use a customized pattern
|
||||
to make a selection.
|
||||
|
||||
First in .gitattributes, you would assign the `diff` attribute
|
||||
First, in .gitattributes, you would assign the `diff` attribute
|
||||
for paths.
|
||||
|
||||
------------------------
|
||||
*.tex diff=tex
|
||||
------------------------
|
||||
|
||||
Then, you would define "diff.tex.funcname" configuration to
|
||||
Then, you would define a "diff.tex.funcname" configuration to
|
||||
specify a regular expression that matches a line that you would
|
||||
want to appear as the hunk header, like this:
|
||||
want to appear as the hunk header "TEXT", like this:
|
||||
|
||||
------------------------
|
||||
[diff "tex"]
|
||||
@@ -311,18 +311,20 @@ patterns are available:
|
||||
|
||||
- `bibtex` suitable for files with BibTeX coded references.
|
||||
|
||||
- `java` suitable for source code in the Java lanugage.
|
||||
- `html` suitable for HTML/XHTML documents.
|
||||
|
||||
- `java` suitable for source code in the Java language.
|
||||
|
||||
- `pascal` suitable for source code in the Pascal/Delphi language.
|
||||
|
||||
- `php` suitable for source code in the PHP 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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -36,11 +36,25 @@ files:
|
||||
|
||||
- 'git-diff-tree' compares contents of two "tree" objects;
|
||||
|
||||
In all of these cases, the commands themselves compare
|
||||
corresponding paths in the two sets of files. The result of
|
||||
comparison is passed from these commands to what is internally
|
||||
called "diffcore", in a format similar to what is output when
|
||||
the -p option is not used. E.g.
|
||||
In all of these cases, the commands themselves first optionally limit
|
||||
the two sets of files by any pathspecs given on their command-lines,
|
||||
and compare corresponding paths in the two resulting sets of files.
|
||||
|
||||
The pathspecs are used to limit the world diff operates in. They remove
|
||||
the filepairs outside the specified sets of pathnames. E.g. If the
|
||||
input set of filepairs included:
|
||||
|
||||
------------------------------------------------
|
||||
:100644 100644 bcd1234... 0123456... M junkfile
|
||||
------------------------------------------------
|
||||
|
||||
but the command invocation was `git diff-files myfile`, then the
|
||||
junkfile entry would be removed from the list because only "myfile"
|
||||
is under consideration.
|
||||
|
||||
The result of comparison is passed from these commands to what is
|
||||
internally called "diffcore", in a format similar to what is output
|
||||
when the -p option is not used. E.g.
|
||||
|
||||
------------------------------------------------
|
||||
in-place edit :100644 100644 bcd1234... 0123456... M file0
|
||||
@@ -52,9 +66,8 @@ unmerged :000000 000000 0000000... 0000000... U file6
|
||||
The diffcore mechanism is fed a list of such comparison results
|
||||
(each of which is called "filepair", although at this point each
|
||||
of them talks about a single file), and transforms such a list
|
||||
into another list. There are currently 6 such transformations:
|
||||
into another list. There are currently 5 such transformations:
|
||||
|
||||
- diffcore-pathspec
|
||||
- diffcore-break
|
||||
- diffcore-rename
|
||||
- diffcore-merge-broken
|
||||
@@ -62,38 +75,14 @@ into another list. There are currently 6 such transformations:
|
||||
- diffcore-order
|
||||
|
||||
These are applied in sequence. The set of filepairs 'git-diff-{asterisk}'
|
||||
commands find are used as the input to diffcore-pathspec, and
|
||||
the output from diffcore-pathspec is used as the input to the
|
||||
commands find are used as the input to diffcore-break, and
|
||||
the output from diffcore-break is used as the input to the
|
||||
next transformation. The final result is then passed to the
|
||||
output routine and generates either diff-raw format (see Output
|
||||
format sections of the manual for 'git-diff-{asterisk}' commands) or
|
||||
diff-patch format.
|
||||
|
||||
|
||||
diffcore-pathspec: For Ignoring Files Outside Our Consideration
|
||||
---------------------------------------------------------------
|
||||
|
||||
The first transformation in the chain is diffcore-pathspec, and
|
||||
is controlled by giving the pathname parameters to the
|
||||
'git-diff-{asterisk}' commands on the command line. The pathspec is used
|
||||
to limit the world diff operates in. It removes the filepairs
|
||||
outside the specified set of pathnames. E.g. If the input set
|
||||
of filepairs included:
|
||||
|
||||
------------------------------------------------
|
||||
:100644 100644 bcd1234... 0123456... M junkfile
|
||||
------------------------------------------------
|
||||
|
||||
but the command invocation was `git diff-files myfile`, then the
|
||||
junkfile entry would be removed from the list because only "myfile"
|
||||
is under consideration.
|
||||
|
||||
Implementation note. For performance reasons, 'git-diff-tree'
|
||||
uses the pathname parameters on the command line to cull set of
|
||||
filepairs it feeds the diffcore mechanism itself, and does not
|
||||
use diffcore-pathspec, but the end result is the same.
|
||||
|
||||
|
||||
diffcore-break: For Splitting Up "Complete Rewrites"
|
||||
----------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
merge.stat::
|
||||
Whether to print the diffstat between ORIG_HEAD and merge result
|
||||
Whether to print the diffstat between ORIG_HEAD and the merge result
|
||||
at the end of the merge. True by default.
|
||||
|
||||
merge.log::
|
||||
|
||||
@@ -116,6 +116,7 @@ The placeholders are:
|
||||
- '%cr': committer date, relative
|
||||
- '%ct': committer date, UNIX timestamp
|
||||
- '%ci': committer date, ISO 8601 format
|
||||
- '%d': ref names, like the --decorate option of linkgit:git-log[1]
|
||||
- '%e': encoding
|
||||
- '%s': subject
|
||||
- '%b': body
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
GVF=GIT-VERSION-FILE
|
||||
DEF_VER=v1.6.0.GIT
|
||||
DEF_VER=v1.6.0.2.GIT
|
||||
|
||||
LF='
|
||||
'
|
||||
|
||||
21
INSTALL
21
INSTALL
@@ -6,7 +6,7 @@ will install the git programs in your own ~/bin/ directory. If you want
|
||||
to do a global install, you can do
|
||||
|
||||
$ make prefix=/usr all doc info ;# as yourself
|
||||
# make prefix=/usr install install-doc install-info ;# as root
|
||||
# make prefix=/usr install install-doc install-html install-info ;# as root
|
||||
|
||||
(or prefix=/usr/local, of course). Just like any program suite
|
||||
that uses $prefix, the built results have some paths encoded,
|
||||
@@ -19,7 +19,7 @@ set up install paths (via config.mak.autogen), so you can write instead
|
||||
$ make configure ;# as yourself
|
||||
$ ./configure --prefix=/usr ;# as yourself
|
||||
$ make all doc ;# as yourself
|
||||
# make install install-doc ;# as root
|
||||
# make install install-doc install-html;# as root
|
||||
|
||||
|
||||
Issues of note:
|
||||
@@ -89,13 +89,22 @@ Issues of note:
|
||||
inclined to install the tools, the default build target
|
||||
("make all") does _not_ build them.
|
||||
|
||||
"make doc" builds documentation in man and html formats; there are
|
||||
also "make man", "make html" and "make info". Note that "make html"
|
||||
requires asciidoc, but not xmlto. "make man" (and thus make doc)
|
||||
requires both.
|
||||
|
||||
"make install-doc" installs documentation in man format only; there
|
||||
are also "make install-man", "make install-html" and "make
|
||||
install-info".
|
||||
|
||||
Building and installing the info file additionally requires
|
||||
makeinfo and docbook2X. Version 0.8.3 is known to work.
|
||||
|
||||
The documentation is written for AsciiDoc 7, but "make
|
||||
ASCIIDOC8=YesPlease doc" will let you format with AsciiDoc 8.
|
||||
|
||||
Alternatively, pre-formatted documentation are available in
|
||||
Alternatively, pre-formatted documentation is available in
|
||||
"html" and "man" branches of the git repository itself. For
|
||||
example, you could:
|
||||
|
||||
@@ -117,6 +126,12 @@ Issues of note:
|
||||
|
||||
http://www.kernel.org/pub/software/scm/git/docs/
|
||||
|
||||
There are also "make quick-install-doc" and "make quick-install-html"
|
||||
which install preformatted man pages and html documentation.
|
||||
This does not require asciidoc/xmlto, but it only works from within
|
||||
a cloned checkout of git.git with these two extra branches, and will
|
||||
not work for the maintainer for obvious chicken-and-egg reasons.
|
||||
|
||||
It has been reported that docbook-xsl version 1.72 and 1.73 are
|
||||
buggy; 1.72 misformats manual pages for callouts, and 1.73 needs
|
||||
the patch in contrib/patches/docbook-xsl-manpages-charmap.patch
|
||||
|
||||
42
Makefile
42
Makefile
@@ -296,6 +296,7 @@ PROGRAMS += git-pack-redundant$X
|
||||
PROGRAMS += git-patch-id$X
|
||||
PROGRAMS += git-receive-pack$X
|
||||
PROGRAMS += git-send-pack$X
|
||||
PROGRAMS += git-shell$X
|
||||
PROGRAMS += git-show-index$X
|
||||
PROGRAMS += git-unpack-file$X
|
||||
PROGRAMS += git-update-server-info$X
|
||||
@@ -358,6 +359,7 @@ LIB_H += graph.h
|
||||
LIB_H += grep.h
|
||||
LIB_H += hash.h
|
||||
LIB_H += help.h
|
||||
LIB_H += levenshtein.h
|
||||
LIB_H += list-objects.h
|
||||
LIB_H += ll-merge.h
|
||||
LIB_H += log-tree.h
|
||||
@@ -434,6 +436,7 @@ LIB_OBJS += hash.o
|
||||
LIB_OBJS += help.o
|
||||
LIB_OBJS += ident.o
|
||||
LIB_OBJS += interpolate.o
|
||||
LIB_OBJS += levenshtein.o
|
||||
LIB_OBJS += list-objects.o
|
||||
LIB_OBJS += ll-merge.o
|
||||
LIB_OBJS += lockfile.o
|
||||
@@ -633,6 +636,8 @@ ifeq ($(uname_S),Darwin)
|
||||
endif
|
||||
NO_STRLCPY = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
COMPAT_CFLAGS += -Icompat/regex
|
||||
COMPAT_OBJS += compat/regex/regex.o
|
||||
endif
|
||||
ifeq ($(uname_S),SunOS)
|
||||
NEEDS_SOCKET = YesPlease
|
||||
@@ -683,6 +688,8 @@ ifeq ($(uname_S),FreeBSD)
|
||||
BASIC_LDFLAGS += -L/usr/local/lib
|
||||
DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
COMPAT_CFLAGS += -Icompat/regex
|
||||
COMPAT_OBJS += compat/regex/regex.o
|
||||
endif
|
||||
ifeq ($(uname_S),OpenBSD)
|
||||
NO_STRCASESTR = YesPlease
|
||||
@@ -697,8 +704,7 @@ ifeq ($(uname_S),NetBSD)
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
endif
|
||||
BASIC_CFLAGS += -I/usr/pkg/include
|
||||
BASIC_LDFLAGS += -L/usr/pkg/lib
|
||||
ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
|
||||
BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
|
||||
THREADED_DELTA_SEARCH = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_S),AIX)
|
||||
@@ -710,6 +716,8 @@ ifeq ($(uname_S),AIX)
|
||||
INTERNAL_QSORT = UnfortunatelyYes
|
||||
NEEDS_LIBICONV=YesPlease
|
||||
BASIC_CFLAGS += -D_LARGE_FILES
|
||||
COMPAT_CFLAGS += -Icompat/regex
|
||||
COMPAT_OBJS += compat/regex/regex.o
|
||||
endif
|
||||
ifeq ($(uname_S),GNU)
|
||||
# GNU/Hurd
|
||||
@@ -761,10 +769,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
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 += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
|
||||
COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
|
||||
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
|
||||
COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o
|
||||
COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
|
||||
EXTLIBS += -lws2_32
|
||||
X = .exe
|
||||
gitexecdir = ../libexec/git-core
|
||||
@@ -793,12 +801,14 @@ ifeq ($(uname_S),Darwin)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef NO_R_TO_GCC_LINKER
|
||||
# Some gcc does not accept and pass -R to the linker to specify
|
||||
# the runtime dynamic library path.
|
||||
CC_LD_DYNPATH = -Wl,-rpath=
|
||||
else
|
||||
CC_LD_DYNPATH = -R
|
||||
ifndef CC_LD_DYNPATH
|
||||
ifdef NO_R_TO_GCC_LINKER
|
||||
# Some gcc does not accept and pass -R to the linker to specify
|
||||
# the runtime dynamic library path.
|
||||
CC_LD_DYNPATH = -Wl,-rpath,
|
||||
else
|
||||
CC_LD_DYNPATH = -R
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef NO_CURL
|
||||
@@ -834,7 +844,6 @@ EXTLIBS += -lz
|
||||
ifndef NO_POSIX_ONLY_PROGRAMS
|
||||
PROGRAMS += git-daemon$X
|
||||
PROGRAMS += git-imap-send$X
|
||||
PROGRAMS += git-shell$X
|
||||
endif
|
||||
ifndef NO_OPENSSL
|
||||
OPENSSL_LIBSSL = -lssl
|
||||
@@ -1262,6 +1271,12 @@ $(XDIFF_LIB): $(XDIFF_OBJS)
|
||||
doc:
|
||||
$(MAKE) -C Documentation all
|
||||
|
||||
man:
|
||||
$(MAKE) -C Documentation man
|
||||
|
||||
html:
|
||||
$(MAKE) -C Documentation html
|
||||
|
||||
info:
|
||||
$(MAKE) -C Documentation info
|
||||
|
||||
@@ -1365,7 +1380,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 git-shell$X '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
||||
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
|
||||
ifndef NO_TCLTK
|
||||
@@ -1398,6 +1413,9 @@ install-info:
|
||||
quick-install-doc:
|
||||
$(MAKE) -C Documentation quick-install
|
||||
|
||||
quick-install-html:
|
||||
$(MAKE) -C Documentation quick-install-html
|
||||
|
||||
|
||||
|
||||
### Maintainer's dist rules
|
||||
|
||||
@@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
const char *remote = NULL;
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
remote = extract_remote_arg(&argc, argv);
|
||||
if (remote)
|
||||
return run_remote_archiver(remote, argc, argv);
|
||||
|
||||
@@ -5,26 +5,26 @@
|
||||
*
|
||||
* Careful: order of argument flags does matter. For example,
|
||||
*
|
||||
* git-checkout-index -a -f file.c
|
||||
* git checkout-index -a -f file.c
|
||||
*
|
||||
* Will first check out all files listed in the cache (but not
|
||||
* overwrite any old ones), and then force-checkout "file.c" a
|
||||
* second time (ie that one _will_ overwrite any old contents
|
||||
* with the same filename).
|
||||
*
|
||||
* Also, just doing "git-checkout-index" does nothing. You probably
|
||||
* meant "git-checkout-index -a". And if you want to force it, you
|
||||
* want "git-checkout-index -f -a".
|
||||
* Also, just doing "git checkout-index" does nothing. You probably
|
||||
* meant "git checkout-index -a". And if you want to force it, you
|
||||
* want "git checkout-index -f -a".
|
||||
*
|
||||
* Intuitiveness is not the goal here. Repeatability is. The
|
||||
* reason for the "no arguments means no work" thing is that
|
||||
* from scripts you are supposed to be able to do things like
|
||||
*
|
||||
* find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
|
||||
* find . -name '*.h' -print0 | xargs -0 git checkout-index -f --
|
||||
*
|
||||
* or:
|
||||
*
|
||||
* find . -name '*.h' -print0 | git-checkout-index -f -z --stdin
|
||||
* find . -name '*.h' -print0 | git checkout-index -f -z --stdin
|
||||
*
|
||||
* which will force all existing *.h files to be replaced with
|
||||
* their cached copies. If an empty command line implied "all",
|
||||
@@ -107,7 +107,7 @@ static int checkout_file(const char *name, int prefix_length)
|
||||
}
|
||||
|
||||
if (!state.quiet) {
|
||||
fprintf(stderr, "git-checkout-index: %s ", name);
|
||||
fprintf(stderr, "git checkout-index: %s ", name);
|
||||
if (!has_same_name)
|
||||
fprintf(stderr, "is not in the cache");
|
||||
else if (checkout_stage)
|
||||
|
||||
@@ -76,6 +76,15 @@ static int read_tree_some(struct tree *tree, const char **pathspec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int skip_same_name(struct cache_entry *ce, int pos)
|
||||
{
|
||||
while (++pos < active_nr &&
|
||||
!strcmp(active_cache[pos]->name, ce->name))
|
||||
; /* skip */
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
static int checkout_paths(struct tree *source_tree, const char **pathspec)
|
||||
{
|
||||
int pos;
|
||||
@@ -107,6 +116,20 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec)
|
||||
if (report_path_error(ps_matched, pathspec, 0))
|
||||
return 1;
|
||||
|
||||
/* Any unmerged paths? */
|
||||
for (pos = 0; pos < active_nr; pos++) {
|
||||
struct cache_entry *ce = active_cache[pos];
|
||||
if (pathspec_match(pathspec, NULL, ce->name, 0)) {
|
||||
if (!ce_stage(ce))
|
||||
continue;
|
||||
errs = 1;
|
||||
error("path '%s' is unmerged", ce->name);
|
||||
pos = skip_same_name(ce, pos) - 1;
|
||||
}
|
||||
}
|
||||
if (errs)
|
||||
return 1;
|
||||
|
||||
/* Now we are committed to check them out */
|
||||
memset(&state, 0, sizeof(state));
|
||||
state.force = 1;
|
||||
@@ -114,7 +137,11 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec)
|
||||
for (pos = 0; pos < active_nr; pos++) {
|
||||
struct cache_entry *ce = active_cache[pos];
|
||||
if (pathspec_match(pathspec, NULL, ce->name, 0)) {
|
||||
errs |= checkout_entry(ce, &state, NULL);
|
||||
if (!ce_stage(ce)) {
|
||||
errs |= checkout_entry(ce, &state, NULL);
|
||||
continue;
|
||||
}
|
||||
pos = skip_same_name(ce, pos) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +269,8 @@ static int merge_working_tree(struct checkout_opts *opts,
|
||||
}
|
||||
|
||||
/* 2-way merge to the new branch */
|
||||
topts.initial_checkout = (!active_nr &&
|
||||
(old->commit == new->commit));
|
||||
topts.update = 1;
|
||||
topts.merge = 1;
|
||||
topts.gently = opts->merge;
|
||||
@@ -551,6 +580,18 @@ no_reference:
|
||||
return checkout_paths(source_tree, pathspec);
|
||||
}
|
||||
|
||||
if (opts.new_branch) {
|
||||
struct strbuf buf;
|
||||
strbuf_init(&buf, 0);
|
||||
strbuf_addstr(&buf, "refs/heads/");
|
||||
strbuf_addstr(&buf, opts.new_branch);
|
||||
if (!get_sha1(buf.buf, rev))
|
||||
die("git checkout: branch %s already exists", opts.new_branch);
|
||||
if (check_ref_format(buf.buf))
|
||||
die("git checkout: we do not like '%s' as a branch name.", opts.new_branch);
|
||||
strbuf_release(&buf);
|
||||
}
|
||||
|
||||
if (new.name && !new.commit) {
|
||||
die("Cannot switch branch to a non-commit.");
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ static struct option builtin_clone_options[] = {
|
||||
OPT_STRING(0, "reference", &option_reference, "repo",
|
||||
"reference repository"),
|
||||
OPT_STRING('o', "origin", &option_origin, "branch",
|
||||
"use <branch> instead or 'origin' to track upstream"),
|
||||
"use <branch> instead of 'origin' to track upstream"),
|
||||
OPT_STRING('u', "upload-pack", &option_upload_pack, "path",
|
||||
"path to git-upload-pack on the remote"),
|
||||
OPT_STRING(0, "depth", &option_depth, "depth",
|
||||
|
||||
@@ -24,7 +24,7 @@ static void check_valid(unsigned char *sha1, enum object_type expect)
|
||||
typename(expect));
|
||||
}
|
||||
|
||||
static const char commit_tree_usage[] = "git-commit-tree <sha1> [-p <sha1>]* < changelog";
|
||||
static const char commit_tree_usage[] = "git commit-tree <sha1> [-p <sha1>]* < changelog";
|
||||
|
||||
static void new_parent(struct commit *parent, struct commit_list **parents_p)
|
||||
{
|
||||
|
||||
@@ -126,6 +126,6 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
else
|
||||
printf("%lu objects, %lu kilobytes\n",
|
||||
loose, loose_size / 2);
|
||||
loose, loose_size / 1024);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,12 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
||||
3 < rev.max_count)
|
||||
usage(diff_files_usage);
|
||||
|
||||
if (rev.max_count == -1 &&
|
||||
/*
|
||||
* "diff-files --base -p" should not combine merges because it
|
||||
* was not asked to. "diff-files -c -p" should not densify
|
||||
* (the user should ask with "diff-files --cc" explicitly).
|
||||
*/
|
||||
if (rev.max_count == -1 && !rev.combine_merges &&
|
||||
(rev.diffopt.output_format & DIFF_FORMAT_PATCH))
|
||||
rev.combine_merges = rev.dense_combined_merges = 1;
|
||||
|
||||
|
||||
@@ -71,8 +71,9 @@ static int diff_tree_stdin(char *line)
|
||||
line[len-1] = 0;
|
||||
if (get_sha1_hex(line, sha1))
|
||||
return -1;
|
||||
obj = lookup_object(sha1);
|
||||
obj = obj ? obj : parse_object(sha1);
|
||||
obj = lookup_unknown_object(sha1);
|
||||
if (!obj || !obj->parsed)
|
||||
obj = parse_object(sha1);
|
||||
if (!obj)
|
||||
return -1;
|
||||
if (obj->type == OBJ_COMMIT)
|
||||
|
||||
@@ -74,6 +74,8 @@ static int builtin_diff_b_f(struct rev_info *revs,
|
||||
if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
|
||||
die("'%s': not a regular file or symlink", path);
|
||||
|
||||
diff_set_mnemonic_prefix(&revs->diffopt, "o/", "w/");
|
||||
|
||||
if (blob[0].mode == S_IFINVALID)
|
||||
blob[0].mode = canon_mode(st.st_mode);
|
||||
|
||||
@@ -223,7 +225,13 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
|
||||
argv++; argc--;
|
||||
}
|
||||
|
||||
if (revs->max_count == -1 &&
|
||||
/*
|
||||
* "diff --base" should not combine merges because it was not
|
||||
* asked to. "diff -c" should not densify (if the user wants
|
||||
* dense one, --cc can be explicitly asked for, or just rely
|
||||
* on the default).
|
||||
*/
|
||||
if (revs->max_count == -1 && !revs->combine_merges &&
|
||||
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
|
||||
revs->combine_merges = revs->dense_combined_merges = 1;
|
||||
|
||||
|
||||
@@ -750,7 +750,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
|
||||
if (!ret && nr_heads) {
|
||||
/* If the heads to pull were given, we should have
|
||||
* consumed all of them by matching the remote.
|
||||
* Otherwise, 'git-fetch remote no-such-ref' would
|
||||
* Otherwise, 'git fetch remote no-such-ref' would
|
||||
* silently succeed without issuing an error.
|
||||
*/
|
||||
for (i = 0; i < nr_heads; i++)
|
||||
|
||||
@@ -86,10 +86,10 @@ static void add_merge_config(struct ref **head,
|
||||
/*
|
||||
* Not fetched to a tracking branch? We need to fetch
|
||||
* it anyway to allow this branch's "branch.$name.merge"
|
||||
* to be honored by git-pull, but we do not have to
|
||||
* to be honored by 'git pull', but we do not have to
|
||||
* fail if branch.$name.merge is misconfigured to point
|
||||
* at a nonexisting branch. If we were indeed called by
|
||||
* git-pull, it will notice the misconfiguration because
|
||||
* 'git pull', it will notice the misconfiguration because
|
||||
* there is no entry in the resulting FETCH_HEAD marked
|
||||
* for merging.
|
||||
*/
|
||||
@@ -396,7 +396,7 @@ static int store_updated_refs(const char *url, const char *remote_name,
|
||||
* The refs we are going to fetch are in to_fetch (nr_heads in
|
||||
* total). If running
|
||||
*
|
||||
* $ git-rev-list --objects to_fetch[0] to_fetch[1] ... --not --all
|
||||
* $ git rev-list --objects to_fetch[0] to_fetch[1] ... --not --all
|
||||
*
|
||||
* does not error out, that means everything reachable from the
|
||||
* refs we are going to fetch exists and is connected to some of
|
||||
|
||||
@@ -545,6 +545,107 @@ static void grab_values(struct atom_value *val, int deref, struct object *obj, v
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* generate a format suitable for scanf from a ref_rev_parse_rules
|
||||
* rule, that is replace the "%.*s" spec with a "%s" spec
|
||||
*/
|
||||
static void gen_scanf_fmt(char *scanf_fmt, const char *rule)
|
||||
{
|
||||
char *spec;
|
||||
|
||||
spec = strstr(rule, "%.*s");
|
||||
if (!spec || strstr(spec + 4, "%.*s"))
|
||||
die("invalid rule in ref_rev_parse_rules: %s", rule);
|
||||
|
||||
/* copy all until spec */
|
||||
strncpy(scanf_fmt, rule, spec - rule);
|
||||
scanf_fmt[spec - rule] = '\0';
|
||||
/* copy new spec */
|
||||
strcat(scanf_fmt, "%s");
|
||||
/* copy remaining rule */
|
||||
strcat(scanf_fmt, spec + 4);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shorten the refname to an non-ambiguous form
|
||||
*/
|
||||
static char *get_short_ref(struct refinfo *ref)
|
||||
{
|
||||
int i;
|
||||
static char **scanf_fmts;
|
||||
static int nr_rules;
|
||||
char *short_name;
|
||||
|
||||
/* pre generate scanf formats from ref_rev_parse_rules[] */
|
||||
if (!nr_rules) {
|
||||
size_t total_len = 0;
|
||||
|
||||
/* the rule list is NULL terminated, count them first */
|
||||
for (; ref_rev_parse_rules[nr_rules]; nr_rules++)
|
||||
/* no +1 because strlen("%s") < strlen("%.*s") */
|
||||
total_len += strlen(ref_rev_parse_rules[nr_rules]);
|
||||
|
||||
scanf_fmts = xmalloc(nr_rules * sizeof(char *) + total_len);
|
||||
|
||||
total_len = 0;
|
||||
for (i = 0; i < nr_rules; i++) {
|
||||
scanf_fmts[i] = (char *)&scanf_fmts[nr_rules]
|
||||
+ total_len;
|
||||
gen_scanf_fmt(scanf_fmts[i], ref_rev_parse_rules[i]);
|
||||
total_len += strlen(ref_rev_parse_rules[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* bail out if there are no rules */
|
||||
if (!nr_rules)
|
||||
return ref->refname;
|
||||
|
||||
/* buffer for scanf result, at most ref->refname must fit */
|
||||
short_name = xstrdup(ref->refname);
|
||||
|
||||
/* skip first rule, it will always match */
|
||||
for (i = nr_rules - 1; i > 0 ; --i) {
|
||||
int j;
|
||||
int short_name_len;
|
||||
|
||||
if (1 != sscanf(ref->refname, scanf_fmts[i], short_name))
|
||||
continue;
|
||||
|
||||
short_name_len = strlen(short_name);
|
||||
|
||||
/*
|
||||
* check if the short name resolves to a valid ref,
|
||||
* but use only rules prior to the matched one
|
||||
*/
|
||||
for (j = 0; j < i; j++) {
|
||||
const char *rule = ref_rev_parse_rules[j];
|
||||
unsigned char short_objectname[20];
|
||||
|
||||
/*
|
||||
* the short name is ambiguous, if it resolves
|
||||
* (with this previous rule) to a valid ref
|
||||
* read_ref() returns 0 on success
|
||||
*/
|
||||
if (!read_ref(mkpath(rule, short_name_len, short_name),
|
||||
short_objectname))
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* short name is non-ambiguous if all previous rules
|
||||
* haven't resolved to a valid ref
|
||||
*/
|
||||
if (j == i)
|
||||
return short_name;
|
||||
}
|
||||
|
||||
free(short_name);
|
||||
return ref->refname;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse the object referred by ref, and grab needed value.
|
||||
*/
|
||||
@@ -570,13 +671,33 @@ static void populate_value(struct refinfo *ref)
|
||||
for (i = 0; i < used_atom_cnt; i++) {
|
||||
const char *name = used_atom[i];
|
||||
struct atom_value *v = &ref->value[i];
|
||||
if (!strcmp(name, "refname"))
|
||||
v->s = ref->refname;
|
||||
else if (!strcmp(name, "*refname")) {
|
||||
int len = strlen(ref->refname);
|
||||
char *s = xmalloc(len + 4);
|
||||
sprintf(s, "%s^{}", ref->refname);
|
||||
v->s = s;
|
||||
int deref = 0;
|
||||
if (*name == '*') {
|
||||
deref = 1;
|
||||
name++;
|
||||
}
|
||||
if (!prefixcmp(name, "refname")) {
|
||||
const char *formatp = strchr(name, ':');
|
||||
const char *refname = ref->refname;
|
||||
|
||||
/* look for "short" refname format */
|
||||
if (formatp) {
|
||||
formatp++;
|
||||
if (!strcmp(formatp, "short"))
|
||||
refname = get_short_ref(ref);
|
||||
else
|
||||
die("unknown refname format %s",
|
||||
formatp);
|
||||
}
|
||||
|
||||
if (!deref)
|
||||
v->s = refname;
|
||||
else {
|
||||
int len = strlen(refname);
|
||||
char *s = xmalloc(len + 4);
|
||||
sprintf(s, "%s^{}", refname);
|
||||
v->s = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)
|
||||
arg++;
|
||||
}
|
||||
if (argc < arg + 2 - commits_on_stdin) {
|
||||
usage("git-http-fetch [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url");
|
||||
usage("git http-fetch [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url");
|
||||
return 1;
|
||||
}
|
||||
if (commits_on_stdin) {
|
||||
@@ -53,7 +53,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
url = argv[arg];
|
||||
if (url && url[strlen(url)-1] != '/') {
|
||||
rewritten_url = malloc(strlen(url)+2);
|
||||
rewritten_url = xmalloc(strlen(url)+2);
|
||||
strcpy(rewritten_url, url);
|
||||
strcat(rewritten_url, "/");
|
||||
url = rewritten_url;
|
||||
@@ -75,7 +75,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)
|
||||
fprintf(stderr,
|
||||
"Some loose object were found to be corrupt, but they might be just\n"
|
||||
"a false '404 Not Found' error message sent with incorrect HTTP\n"
|
||||
"status code. Suggest running git-fsck.\n");
|
||||
"status code. Suggest running 'git fsck'.\n");
|
||||
}
|
||||
|
||||
walker_free(walker);
|
||||
|
||||
@@ -37,7 +37,7 @@ static void copy_templates_1(char *path, int baselen,
|
||||
|
||||
/* Note: if ".git/hooks" file exists in the repository being
|
||||
* re-initialized, /etc/core-git/templates/hooks/update would
|
||||
* cause git-init to fail here. I think this is sane but
|
||||
* cause "git init" to fail here. I think this is sane but
|
||||
* it means that the set of templates we ship by default, along
|
||||
* with the way the namespace under .git/ is organized, should
|
||||
* be really carefully chosen.
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "tag.h"
|
||||
#include "reflog-walk.h"
|
||||
#include "patch-ids.h"
|
||||
#include "refs.h"
|
||||
#include "run-command.h"
|
||||
#include "shortlog.h"
|
||||
|
||||
@@ -25,31 +24,6 @@ static int default_show_root = 1;
|
||||
static const char *fmt_patch_subject_prefix = "PATCH";
|
||||
static const char *fmt_pretty;
|
||||
|
||||
static void add_name_decoration(const char *prefix, const char *name, struct object *obj)
|
||||
{
|
||||
int plen = strlen(prefix);
|
||||
int nlen = strlen(name);
|
||||
struct name_decoration *res = xmalloc(sizeof(struct name_decoration) + plen + nlen);
|
||||
memcpy(res->name, prefix, plen);
|
||||
memcpy(res->name + plen, name, nlen + 1);
|
||||
res->next = add_decoration(&name_decoration, obj, res);
|
||||
}
|
||||
|
||||
static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
|
||||
{
|
||||
struct object *obj = parse_object(sha1);
|
||||
if (!obj)
|
||||
return 0;
|
||||
add_name_decoration("", refname, obj);
|
||||
while (obj->type == OBJ_TAG) {
|
||||
obj = ((struct tag *)obj)->tagged;
|
||||
if (!obj)
|
||||
break;
|
||||
add_name_decoration("tag: ", refname, obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
struct rev_info *rev)
|
||||
{
|
||||
@@ -80,8 +54,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
if (!strcmp(arg, "--decorate")) {
|
||||
if (!decorate)
|
||||
for_each_ref(add_ref_decoration, NULL);
|
||||
load_ref_decorations();
|
||||
decorate = 1;
|
||||
} else
|
||||
die("unrecognized argument: %s", arg);
|
||||
@@ -844,7 +817,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
|
||||
endpos = strchr(committer, '>');
|
||||
if (!endpos)
|
||||
die("bogos committer info %s\n", committer);
|
||||
die("bogus committer info %s\n", committer);
|
||||
add_signoff = xmemdupz(committer, endpos - committer + 1);
|
||||
}
|
||||
else if (!strcmp(argv[i], "--attach")) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#endif
|
||||
|
||||
static const char pack_usage[] = "\
|
||||
git-pack-objects [{ -q | --progress | --all-progress }] \n\
|
||||
git pack-objects [{ -q | --progress | --all-progress }] \n\
|
||||
[--max-pack-size=N] [--local] [--incremental] \n\
|
||||
[--window=N] [--window-memory=N] [--depth=N] \n\
|
||||
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
|
||||
@@ -1725,6 +1725,14 @@ static void prepare_pack(int window, int depth)
|
||||
if (entry->type < 0)
|
||||
die("unable to get type of object %s",
|
||||
sha1_to_hex(entry->idx.sha1));
|
||||
} else {
|
||||
if (entry->type < 0) {
|
||||
/*
|
||||
* This object is not found, but we
|
||||
* don't have to include it anyway.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
delta_list[n++] = entry;
|
||||
@@ -1872,7 +1880,7 @@ static void mark_in_pack_object(struct object *object, struct packed_git *p, str
|
||||
|
||||
/*
|
||||
* Compare the objects in the offset order, in order to emulate the
|
||||
* "git-rev-list --objects" output that produced the pack originally.
|
||||
* "git rev-list --objects" output that produced the pack originally.
|
||||
*/
|
||||
static int ofscmp(const void *a_, const void *b_)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ static void prime_cache_tree(void)
|
||||
|
||||
}
|
||||
|
||||
static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
|
||||
static const char read_tree_usage[] = "git read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
|
||||
|
||||
static struct lock_file lock_file;
|
||||
|
||||
@@ -206,6 +206,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
|
||||
break;
|
||||
case 2:
|
||||
opts.fn = twoway_merge;
|
||||
opts.initial_checkout = !active_nr;
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
|
||||
@@ -407,14 +407,15 @@ static int rm(int argc, const char **argv)
|
||||
return i;
|
||||
}
|
||||
|
||||
static void show_list(const char *title, struct string_list *list)
|
||||
static void show_list(const char *title, struct string_list *list,
|
||||
const char *extra_arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!list->nr)
|
||||
return;
|
||||
|
||||
printf(title, list->nr > 1 ? "es" : "");
|
||||
printf(title, list->nr > 1 ? "es" : "", extra_arg);
|
||||
printf("\n ");
|
||||
for (i = 0; i < list->nr; i++)
|
||||
printf("%s%s", i ? " " : "", list->items[i].string);
|
||||
@@ -477,7 +478,6 @@ static int show(int argc, const char **argv)
|
||||
|
||||
memset(&states, 0, sizeof(states));
|
||||
for (; argc; argc--, argv++) {
|
||||
struct strbuf buf;
|
||||
int i;
|
||||
|
||||
get_remote_ref_states(*argv, &states, !no_query);
|
||||
@@ -503,18 +503,16 @@ static int show(int argc, const char **argv)
|
||||
}
|
||||
|
||||
if (!no_query) {
|
||||
strbuf_init(&buf, 0);
|
||||
strbuf_addf(&buf, " New remote branch%%s (next fetch "
|
||||
"will store in remotes/%s)", states.remote->name);
|
||||
show_list(buf.buf, &states.new);
|
||||
strbuf_release(&buf);
|
||||
show_list(" New remote branch%s (next fetch "
|
||||
"will store in remotes/%s)",
|
||||
&states.new, states.remote->name);
|
||||
show_list(" Stale tracking branch%s (use 'git remote "
|
||||
"prune')", &states.stale);
|
||||
"prune')", &states.stale, "");
|
||||
}
|
||||
|
||||
if (no_query)
|
||||
for_each_ref(append_ref_to_tracked_list, &states);
|
||||
show_list(" Tracked remote branch%s", &states.tracked);
|
||||
show_list(" Tracked remote branch%s", &states.tracked, "");
|
||||
|
||||
if (states.remote->push_refspec_nr) {
|
||||
printf(" Local branch%s pushed with 'git push'\n ",
|
||||
|
||||
@@ -178,7 +178,7 @@ static void finish_object(struct object_array_entry *p)
|
||||
static void show_object(struct object_array_entry *p)
|
||||
{
|
||||
/* An object with name "foo\n0000000..." can be used to
|
||||
* confuse downstream git-pack-objects very badly.
|
||||
* confuse downstream "git pack-objects" very badly.
|
||||
*/
|
||||
const char *ep = strchr(p->name, '\n');
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ static int check_local_mod(unsigned char *head, int index_only)
|
||||
"from both the file and the HEAD\n"
|
||||
"(use -f to force removal)", name);
|
||||
else if (!index_only) {
|
||||
/* It's not dangerous to git-rm --cached a
|
||||
/* It's not dangerous to "git rm --cached" a
|
||||
* file if the index matches the file or the
|
||||
* HEAD, since it means the deleted content is
|
||||
* still available somewhere.
|
||||
|
||||
@@ -43,7 +43,7 @@ static int pack_objects(int fd, struct ref *refs)
|
||||
po.out = fd;
|
||||
po.git_cmd = 1;
|
||||
if (start_command(&po))
|
||||
die("git-pack-objects failed (%s)", strerror(errno));
|
||||
die("git pack-objects failed (%s)", strerror(errno));
|
||||
|
||||
/*
|
||||
* We feed the pack-objects we just spawned with revision
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
|
||||
static const char tar_tree_usage[] =
|
||||
"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
|
||||
"*** Note that this command is now deprecated; use git-archive instead.";
|
||||
"*** Note that this command is now deprecated; use \"git archive\" instead.";
|
||||
|
||||
int cmd_tar_tree(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
/*
|
||||
* git-tar-tree is now a wrapper around git-archive --format=tar
|
||||
* "git tar-tree" is now a wrapper around "git archive --format=tar"
|
||||
*
|
||||
* $0 --remote=<repo> arg... ==>
|
||||
* git-archive --format=tar --remote=<repo> arg...
|
||||
* git archive --format=tar --remote=<repo> arg...
|
||||
* $0 tree-ish ==>
|
||||
* git-archive --format=tar tree-ish
|
||||
* git archive --format=tar tree-ish
|
||||
* $0 tree-ish basedir ==>
|
||||
* git-archive --format-tar --prefix=basedir tree-ish
|
||||
* git archive --format-tar --prefix=basedir tree-ish
|
||||
*/
|
||||
int i;
|
||||
const char **nargv = xcalloc(sizeof(*nargv), argc + 2);
|
||||
char *basedir_arg;
|
||||
int nargc = 0;
|
||||
|
||||
nargv[nargc++] = "git-archive";
|
||||
nargv[nargc++] = "archive";
|
||||
nargv[nargc++] = "--format=tar";
|
||||
|
||||
if (2 <= argc && !prefixcmp(argv[1], "--remote=")) {
|
||||
@@ -53,8 +53,8 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
|
||||
nargv[nargc] = NULL;
|
||||
|
||||
fprintf(stderr,
|
||||
"*** git-tar-tree is now deprecated.\n"
|
||||
"*** Running git-archive instead.\n***");
|
||||
"*** \"git tar-tree\" is now deprecated.\n"
|
||||
"*** Running \"git archive\" instead.\n***");
|
||||
for (i = 0; i < nargc; i++) {
|
||||
fputc(' ', stderr);
|
||||
sq_quote_print(stderr, nargv[i]);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "fsck.h"
|
||||
|
||||
static int dry_run, quiet, recover, has_errors, strict;
|
||||
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
|
||||
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
|
||||
|
||||
/* We always read in 4kB chunks. */
|
||||
static unsigned char buffer[4096];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* Default to not allowing changes to the list of files. The
|
||||
* tool doesn't actually care, but this makes it harder to add
|
||||
* files to the revision control by mistake by doing something
|
||||
* like "git-update-index *" and suddenly having all the object
|
||||
* like "git update-index *" and suddenly having all the object
|
||||
* files be revision controlled.
|
||||
*/
|
||||
static int allow_add;
|
||||
@@ -313,18 +313,18 @@ static void read_index_info(int line_termination)
|
||||
/* This reads lines formatted in one of three formats:
|
||||
*
|
||||
* (1) mode SP sha1 TAB path
|
||||
* The first format is what "git-apply --index-info"
|
||||
* The first format is what "git apply --index-info"
|
||||
* reports, and used to reconstruct a partial tree
|
||||
* that is used for phony merge base tree when falling
|
||||
* back on 3-way merge.
|
||||
*
|
||||
* (2) mode SP type SP sha1 TAB path
|
||||
* The second format is to stuff git-ls-tree output
|
||||
* The second format is to stuff "git ls-tree" output
|
||||
* into the index file.
|
||||
*
|
||||
* (3) mode SP sha1 SP stage TAB path
|
||||
* This format is to put higher order stages into the
|
||||
* index file and matches git-ls-files --stage output.
|
||||
* index file and matches "git ls-files --stage" output.
|
||||
*/
|
||||
errno = 0;
|
||||
ul = strtoul(buf.buf, &ptr, 8);
|
||||
|
||||
@@ -11,7 +11,7 @@ extern const char git_usage_string[];
|
||||
extern const char git_more_info_string[];
|
||||
|
||||
extern void list_common_cmds_help(void);
|
||||
extern void help_unknown_cmd(const char *cmd);
|
||||
extern const char *help_unknown_cmd(const char *cmd);
|
||||
extern void prune_packed_objects(int);
|
||||
extern int read_line_with_nul(char *buf, int size, FILE *file);
|
||||
extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
|
||||
|
||||
@@ -496,6 +496,18 @@ static int hunk_comment_line(const char *bol)
|
||||
return (isalpha(ch) || ch == '_' || ch == '$');
|
||||
}
|
||||
|
||||
static void show_line_to_eol(const char *line, int len, const char *reset)
|
||||
{
|
||||
int saw_cr_at_eol = 0;
|
||||
if (len < 0)
|
||||
len = strlen(line);
|
||||
saw_cr_at_eol = (len && line[len-1] == '\r');
|
||||
|
||||
printf("%.*s%s%s\n", len - saw_cr_at_eol, line,
|
||||
reset,
|
||||
saw_cr_at_eol ? "\r" : "");
|
||||
}
|
||||
|
||||
static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
||||
int use_color)
|
||||
{
|
||||
@@ -589,7 +601,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
||||
else
|
||||
putchar(' ');
|
||||
}
|
||||
printf("%s%s\n", ll->line, c_reset);
|
||||
show_line_to_eol(ll->line, -1, c_reset);
|
||||
ll = ll->next;
|
||||
}
|
||||
if (cnt < lno)
|
||||
@@ -613,7 +625,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
||||
putchar(' ');
|
||||
p_mask <<= 1;
|
||||
}
|
||||
printf("%.*s%s\n", sl->len, sl->bol, c_reset);
|
||||
show_line_to_eol(sl->bol, sl->len, c_reset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -671,9 +683,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
int i, show_hunks;
|
||||
int working_tree_file = is_null_sha1(elem->sha1);
|
||||
int abbrev = DIFF_OPT_TST(opt, FULL_INDEX) ? 40 : DEFAULT_ABBREV;
|
||||
const char *a_prefix, *b_prefix;
|
||||
mmfile_t result_file;
|
||||
|
||||
context = opt->context;
|
||||
a_prefix = opt->a_prefix ? opt->a_prefix : "a/";
|
||||
b_prefix = opt->b_prefix ? opt->b_prefix : "b/";
|
||||
|
||||
/* Read the result of merge first */
|
||||
if (!working_tree_file)
|
||||
result = grab_blob(elem->sha1, &result_size);
|
||||
@@ -849,13 +865,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
dump_quoted_path("--- ", "", "/dev/null",
|
||||
c_meta, c_reset);
|
||||
else
|
||||
dump_quoted_path("--- ", opt->a_prefix, elem->path,
|
||||
dump_quoted_path("--- ", a_prefix, elem->path,
|
||||
c_meta, c_reset);
|
||||
if (deleted)
|
||||
dump_quoted_path("+++ ", "", "/dev/null",
|
||||
c_meta, c_reset);
|
||||
else
|
||||
dump_quoted_path("+++ ", opt->b_prefix, elem->path,
|
||||
dump_quoted_path("+++ ", b_prefix, elem->path,
|
||||
c_meta, c_reset);
|
||||
dump_sline(sline, cnt, num_parent,
|
||||
DIFF_OPT_TST(opt, COLOR_DIFF));
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
CC_LD_DYNPATH = @CC_LD_DYNPATH@
|
||||
AR = @AR@
|
||||
TAR = @TAR@
|
||||
#INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
|
||||
|
||||
32
configure.ac
32
configure.ac
@@ -103,6 +103,38 @@ GIT_PARSE_WITH(tcltk))
|
||||
AC_MSG_NOTICE([CHECKS for programs])
|
||||
#
|
||||
AC_PROG_CC([cc gcc])
|
||||
# which switch to pass runtime path to dynamic libraries to the linker
|
||||
AC_CACHE_CHECK([if linker supports -R], ld_dashr, [
|
||||
SAVE_LDFLAGS="${LDFLAGS}"
|
||||
LDFLAGS="${SAVE_LDFLAGS} -R /"
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_dashr=yes], [ld_dashr=no])
|
||||
LDFLAGS="${SAVE_LDFLAGS}"
|
||||
])
|
||||
if test "$ld_dashr" = "yes"; then
|
||||
AC_SUBST(CC_LD_DYNPATH, [-R])
|
||||
else
|
||||
AC_CACHE_CHECK([if linker supports -Wl,-rpath,], ld_wl_rpath, [
|
||||
SAVE_LDFLAGS="${LDFLAGS}"
|
||||
LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
|
||||
LDFLAGS="${SAVE_LD_FLAGS}"
|
||||
])
|
||||
if test "$ld_wl_rpath" = "yes"; then
|
||||
AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
|
||||
else
|
||||
AC_CACHE_CHECK([if linker supports -rpath], ld_rpath, [
|
||||
SAVE_LDFLAGS="${LDFLAGS}"
|
||||
LDFLAGS="${SAVE_LDFLAGS} -rpath /"
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
|
||||
LDFLAGS="${SAVE_LD_FLAGS}"
|
||||
])
|
||||
if test "$ld_rpath" = "yes"; then
|
||||
AC_SUBST(CC_LD_DYNPATH, [-rpath])
|
||||
else
|
||||
AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#AC_PROG_INSTALL # needs install-sh or install.sh in sources
|
||||
AC_CHECK_TOOLS(AR, [gar ar], :)
|
||||
AC_CHECK_PROGS(TAR, [gtar tar])
|
||||
|
||||
@@ -154,11 +154,8 @@ __git_heads ()
|
||||
{
|
||||
local cmd i is_hash=y dir="$(__gitdir "$1")"
|
||||
if [ -d "$dir" ]; then
|
||||
for i in $(git --git-dir="$dir" \
|
||||
for-each-ref --format='%(refname)' \
|
||||
refs/heads ); do
|
||||
echo "${i#refs/heads/}"
|
||||
done
|
||||
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
refs/heads
|
||||
return
|
||||
fi
|
||||
for i in $(git ls-remote "$1" 2>/dev/null); do
|
||||
@@ -175,11 +172,8 @@ __git_tags ()
|
||||
{
|
||||
local cmd i is_hash=y dir="$(__gitdir "$1")"
|
||||
if [ -d "$dir" ]; then
|
||||
for i in $(git --git-dir="$dir" \
|
||||
for-each-ref --format='%(refname)' \
|
||||
refs/tags ); do
|
||||
echo "${i#refs/tags/}"
|
||||
done
|
||||
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
refs/tags
|
||||
return
|
||||
fi
|
||||
for i in $(git ls-remote "$1" 2>/dev/null); do
|
||||
@@ -197,16 +191,8 @@ __git_refs ()
|
||||
local cmd i is_hash=y dir="$(__gitdir "$1")"
|
||||
if [ -d "$dir" ]; then
|
||||
if [ -e "$dir/HEAD" ]; then echo HEAD; fi
|
||||
for i in $(git --git-dir="$dir" \
|
||||
for-each-ref --format='%(refname)' \
|
||||
refs/tags refs/heads refs/remotes); do
|
||||
case "$i" in
|
||||
refs/tags/*) echo "${i#refs/tags/}" ;;
|
||||
refs/heads/*) echo "${i#refs/heads/}" ;;
|
||||
refs/remotes/*) echo "${i#refs/remotes/}" ;;
|
||||
*) echo "$i" ;;
|
||||
esac
|
||||
done
|
||||
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
refs/tags refs/heads refs/remotes
|
||||
return
|
||||
fi
|
||||
for i in $(git ls-remote "$dir" 2>/dev/null); do
|
||||
@@ -750,7 +736,7 @@ _git_commit ()
|
||||
--*)
|
||||
__gitcomp "
|
||||
--all --author= --signoff --verify --no-verify
|
||||
--edit --amend --include --only
|
||||
--edit --amend --include --only --interactive
|
||||
"
|
||||
return
|
||||
esac
|
||||
|
||||
@@ -50,7 +50,7 @@ if ((@ARGV < 0) || !GetOptions(
|
||||
)) { die $usage; }
|
||||
die $usage unless ($read_mode xor $write_mode);
|
||||
|
||||
my $topdir = `git-rev-parse --show-cdup` or die "\n"; chomp $topdir;
|
||||
my $topdir = `git rev-parse --show-cdup` or die "\n"; chomp $topdir;
|
||||
my $gitdir = $topdir . '.git';
|
||||
my $gitmeta = $topdir . '.gitmeta';
|
||||
|
||||
@@ -155,7 +155,7 @@ elsif ($read_mode) {
|
||||
open (OUT, ">$gitmeta.tmp") or die "Could not open $gitmeta.tmp for writing: $!\n";
|
||||
}
|
||||
|
||||
my @files = `git-ls-files`;
|
||||
my @files = `git ls-files`;
|
||||
my %dirs;
|
||||
|
||||
foreach my $path (@files) {
|
||||
|
||||
27
csum-file.c
27
csum-file.c
@@ -11,10 +11,8 @@
|
||||
#include "progress.h"
|
||||
#include "csum-file.h"
|
||||
|
||||
static void sha1flush(struct sha1file *f, unsigned int count)
|
||||
static void sha1flush(struct sha1file *f, void *buf, unsigned int count)
|
||||
{
|
||||
void *buf = f->buffer;
|
||||
|
||||
for (;;) {
|
||||
int ret = xwrite(f->fd, buf, count);
|
||||
if (ret > 0) {
|
||||
@@ -39,7 +37,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
|
||||
|
||||
if (offset) {
|
||||
SHA1_Update(&f->ctx, f->buffer, offset);
|
||||
sha1flush(f, offset);
|
||||
sha1flush(f, f->buffer, offset);
|
||||
f->offset = 0;
|
||||
}
|
||||
SHA1_Final(f->buffer, &f->ctx);
|
||||
@@ -47,7 +45,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
|
||||
hashcpy(result, f->buffer);
|
||||
if (flags & (CSUM_CLOSE | CSUM_FSYNC)) {
|
||||
/* write checksum and close fd */
|
||||
sha1flush(f, 20);
|
||||
sha1flush(f, f->buffer, 20);
|
||||
if (flags & CSUM_FSYNC)
|
||||
fsync_or_die(f->fd, f->name);
|
||||
if (close(f->fd))
|
||||
@@ -62,21 +60,30 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
|
||||
|
||||
int sha1write(struct sha1file *f, void *buf, unsigned int count)
|
||||
{
|
||||
if (f->do_crc)
|
||||
f->crc32 = crc32(f->crc32, buf, count);
|
||||
while (count) {
|
||||
unsigned offset = f->offset;
|
||||
unsigned left = sizeof(f->buffer) - offset;
|
||||
unsigned nr = count > left ? left : count;
|
||||
void *data;
|
||||
|
||||
if (f->do_crc)
|
||||
f->crc32 = crc32(f->crc32, buf, nr);
|
||||
|
||||
if (nr == sizeof(f->buffer)) {
|
||||
/* process full buffer directly without copy */
|
||||
data = buf;
|
||||
} else {
|
||||
memcpy(f->buffer + offset, buf, nr);
|
||||
data = f->buffer;
|
||||
}
|
||||
|
||||
memcpy(f->buffer + offset, buf, nr);
|
||||
count -= nr;
|
||||
offset += nr;
|
||||
buf = (char *) buf + nr;
|
||||
left -= nr;
|
||||
if (!left) {
|
||||
SHA1_Update(&f->ctx, f->buffer, offset);
|
||||
sha1flush(f, offset);
|
||||
SHA1_Update(&f->ctx, data, offset);
|
||||
sha1flush(f, data, offset);
|
||||
offset = 0;
|
||||
}
|
||||
f->offset = offset;
|
||||
|
||||
3
daemon.c
3
daemon.c
@@ -1083,7 +1083,8 @@ int main(int argc, char **argv)
|
||||
openlog("git-daemon", LOG_PID, LOG_DAEMON);
|
||||
set_die_routine(daemon_die);
|
||||
} else
|
||||
setlinebuf(stderr); /* avoid splitting a message in the middle */
|
||||
/* avoid splitting a message in the middle */
|
||||
setvbuf(stderr, NULL, _IOLBF, 0);
|
||||
|
||||
if (inetd_mode && (group_name || user_name))
|
||||
die("--user and --group are incompatible with --inetd");
|
||||
|
||||
@@ -63,6 +63,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
? CE_MATCH_RACY_IS_DIRTY : 0);
|
||||
char symcache[PATH_MAX];
|
||||
|
||||
diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/");
|
||||
|
||||
if (diff_unmerged_stage < 0)
|
||||
diff_unmerged_stage = 2;
|
||||
entries = active_nr;
|
||||
@@ -469,6 +471,7 @@ int run_diff_index(struct rev_info *revs, int cached)
|
||||
if (unpack_trees(1, &t, &opts))
|
||||
exit(128);
|
||||
|
||||
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
|
||||
diffcore_std(&revs->diffopt);
|
||||
diff_flush(&revs->diffopt);
|
||||
return 0;
|
||||
|
||||
@@ -252,6 +252,7 @@ void diff_no_index(struct rev_info *revs,
|
||||
if (queue_diff(&revs->diffopt, revs->diffopt.paths[0],
|
||||
revs->diffopt.paths[1]))
|
||||
exit(1);
|
||||
diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/");
|
||||
diffcore_std(&revs->diffopt);
|
||||
diff_flush(&revs->diffopt);
|
||||
|
||||
|
||||
68
diff.c
68
diff.c
@@ -24,6 +24,7 @@ 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;
|
||||
static int diff_mnemonic_prefix;
|
||||
|
||||
static char diff_colors[][COLOR_MAXLEN] = {
|
||||
"\033[m", /* reset */
|
||||
@@ -150,6 +151,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
|
||||
diff_auto_refresh_index = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(var, "diff.mnemonicprefix")) {
|
||||
diff_mnemonic_prefix = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(var, "diff.external"))
|
||||
return git_config_string(&external_diff_cmd_cfg, var, value);
|
||||
if (!prefixcmp(var, "diff.")) {
|
||||
@@ -312,6 +317,15 @@ static void emit_rewrite_diff(const char *name_a,
|
||||
const char *new = diff_get_color(color_diff, DIFF_FILE_NEW);
|
||||
const char *reset = diff_get_color(color_diff, DIFF_RESET);
|
||||
static struct strbuf a_name = STRBUF_INIT, b_name = STRBUF_INIT;
|
||||
const char *a_prefix, *b_prefix;
|
||||
|
||||
if (diff_mnemonic_prefix && DIFF_OPT_TST(o, REVERSE_DIFF)) {
|
||||
a_prefix = o->b_prefix;
|
||||
b_prefix = o->a_prefix;
|
||||
} else {
|
||||
a_prefix = o->a_prefix;
|
||||
b_prefix = o->b_prefix;
|
||||
}
|
||||
|
||||
name_a += (*name_a == '/');
|
||||
name_b += (*name_b == '/');
|
||||
@@ -320,8 +334,8 @@ static void emit_rewrite_diff(const char *name_a,
|
||||
|
||||
strbuf_reset(&a_name);
|
||||
strbuf_reset(&b_name);
|
||||
quote_two_c_style(&a_name, o->a_prefix, name_a, 0);
|
||||
quote_two_c_style(&b_name, o->b_prefix, name_b, 0);
|
||||
quote_two_c_style(&a_name, a_prefix, name_a, 0);
|
||||
quote_two_c_style(&b_name, b_prefix, name_b, 0);
|
||||
|
||||
diff_populate_filespec(one, 0);
|
||||
diff_populate_filespec(two, 0);
|
||||
@@ -513,13 +527,20 @@ const char *diff_get_color(int diff_use_color, enum color_diff ix)
|
||||
|
||||
static void emit_line(FILE *file, const char *set, const char *reset, const char *line, int len)
|
||||
{
|
||||
int has_trailing_newline = (len > 0 && line[len-1] == '\n');
|
||||
int has_trailing_newline, has_trailing_carriage_return;
|
||||
|
||||
has_trailing_newline = (len > 0 && line[len-1] == '\n');
|
||||
if (has_trailing_newline)
|
||||
len--;
|
||||
has_trailing_carriage_return = (len > 0 && line[len-1] == '\r');
|
||||
if (has_trailing_carriage_return)
|
||||
len--;
|
||||
|
||||
fputs(set, file);
|
||||
fwrite(line, len, 1, file);
|
||||
fputs(reset, file);
|
||||
if (has_trailing_carriage_return)
|
||||
fputc('\r', file);
|
||||
if (has_trailing_newline)
|
||||
fputc('\n', file);
|
||||
}
|
||||
@@ -1402,6 +1423,7 @@ static struct builtin_funcname_pattern {
|
||||
"\\|"
|
||||
"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
|
||||
},
|
||||
{ "php", "^[\t ]*\\(\\(function\\|class\\).*\\)" },
|
||||
{ "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
|
||||
{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
|
||||
{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
|
||||
@@ -1439,6 +1461,14 @@ static const char *diff_funcname_pattern(struct diff_filespec *one)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b)
|
||||
{
|
||||
if (!options->a_prefix)
|
||||
options->a_prefix = a;
|
||||
if (!options->b_prefix)
|
||||
options->b_prefix = b;
|
||||
}
|
||||
|
||||
static void builtin_diff(const char *name_a,
|
||||
const char *name_b,
|
||||
struct diff_filespec *one,
|
||||
@@ -1452,9 +1482,19 @@ static void builtin_diff(const char *name_a,
|
||||
char *a_one, *b_two;
|
||||
const char *set = diff_get_color_opt(o, DIFF_METAINFO);
|
||||
const char *reset = diff_get_color_opt(o, DIFF_RESET);
|
||||
const char *a_prefix, *b_prefix;
|
||||
|
||||
a_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));
|
||||
b_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));
|
||||
diff_set_mnemonic_prefix(o, "a/", "b/");
|
||||
if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
|
||||
a_prefix = o->b_prefix;
|
||||
b_prefix = o->a_prefix;
|
||||
} else {
|
||||
a_prefix = o->a_prefix;
|
||||
b_prefix = o->b_prefix;
|
||||
}
|
||||
|
||||
a_one = quote_two(a_prefix, name_a + (*name_a == '/'));
|
||||
b_two = quote_two(b_prefix, name_b + (*name_b == '/'));
|
||||
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
|
||||
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
|
||||
fprintf(o->file, "%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
|
||||
@@ -2311,8 +2351,10 @@ void diff_setup(struct diff_options *options)
|
||||
DIFF_OPT_CLR(options, COLOR_DIFF);
|
||||
options->detect_rename = diff_detect_rename_default;
|
||||
|
||||
options->a_prefix = "a/";
|
||||
options->b_prefix = "b/";
|
||||
if (!diff_mnemonic_prefix) {
|
||||
options->a_prefix = "a/";
|
||||
options->b_prefix = "b/";
|
||||
}
|
||||
}
|
||||
|
||||
int diff_setup_done(struct diff_options *options)
|
||||
@@ -2395,13 +2437,6 @@ int diff_setup_done(struct diff_options *options)
|
||||
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we postprocess in diffcore, we cannot simply return
|
||||
* upon the first hit. We need to run diff as usual.
|
||||
*/
|
||||
if (options->pickaxe || options->filter)
|
||||
DIFF_OPT_CLR(options, QUIET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3389,10 +3424,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
||||
|
||||
void diffcore_std(struct diff_options *options)
|
||||
{
|
||||
if (DIFF_OPT_TST(options, QUIET))
|
||||
return;
|
||||
|
||||
if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER))
|
||||
if (options->skip_stat_unmatch)
|
||||
diffcore_skip_stat_unmatch(options);
|
||||
if (options->break_opt != -1)
|
||||
diffcore_break(options->break_opt);
|
||||
|
||||
2
diff.h
2
diff.h
@@ -160,6 +160,8 @@ extern void diff_tree_combined(const unsigned char *sha1, const unsigned char pa
|
||||
|
||||
extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
|
||||
|
||||
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
|
||||
|
||||
extern void diff_addremove(struct diff_options *,
|
||||
int addremove,
|
||||
unsigned mode,
|
||||
|
||||
@@ -92,7 +92,6 @@ extern struct diff_filepair *diff_queue(struct diff_queue_struct *,
|
||||
struct diff_filespec *);
|
||||
extern void diff_q(struct diff_queue_struct *, struct diff_filepair *);
|
||||
|
||||
extern void diffcore_pathspec(const char **pathspec);
|
||||
extern void diffcore_break(int);
|
||||
extern void diffcore_rename(struct diff_options *);
|
||||
extern void diffcore_merge_broken(void);
|
||||
|
||||
175
git-bisect.sh
175
git-bisect.sh
@@ -172,6 +172,25 @@ bisect_write() {
|
||||
test -n "$nolog" || echo "git bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
|
||||
}
|
||||
|
||||
is_expected_rev() {
|
||||
test -f "$GIT_DIR/BISECT_EXPECTED_REV" &&
|
||||
test "$1" = $(cat "$GIT_DIR/BISECT_EXPECTED_REV")
|
||||
}
|
||||
|
||||
mark_expected_rev() {
|
||||
echo "$1" > "$GIT_DIR/BISECT_EXPECTED_REV"
|
||||
}
|
||||
|
||||
check_expected_revs() {
|
||||
for _rev in "$@"; do
|
||||
if ! is_expected_rev "$_rev"; then
|
||||
rm -f "$GIT_DIR/BISECT_ANCESTORS_OK"
|
||||
rm -f "$GIT_DIR/BISECT_EXPECTED_REV"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
bisect_state() {
|
||||
bisect_autostart
|
||||
state=$1
|
||||
@@ -181,7 +200,8 @@ bisect_state() {
|
||||
1,bad|1,good|1,skip)
|
||||
rev=$(git rev-parse --verify HEAD) ||
|
||||
die "Bad rev input: HEAD"
|
||||
bisect_write "$state" "$rev" ;;
|
||||
bisect_write "$state" "$rev"
|
||||
check_expected_revs "$rev" ;;
|
||||
2,bad|*,good|*,skip)
|
||||
shift
|
||||
eval=''
|
||||
@@ -191,7 +211,8 @@ bisect_state() {
|
||||
die "Bad rev input: $rev"
|
||||
eval="$eval bisect_write '$state' '$sha'; "
|
||||
done
|
||||
eval "$eval" ;;
|
||||
eval "$eval"
|
||||
check_expected_revs "$@" ;;
|
||||
*,bad)
|
||||
die "'git bisect bad' can take only one argument." ;;
|
||||
*)
|
||||
@@ -243,33 +264,18 @@ bisect_auto_next() {
|
||||
bisect_next_check && bisect_next || :
|
||||
}
|
||||
|
||||
eval_rev_list() {
|
||||
_eval="$1"
|
||||
|
||||
eval $_eval
|
||||
res=$?
|
||||
|
||||
if [ $res -ne 0 ]; then
|
||||
echo >&2 "'git rev-list --bisect-vars' failed:"
|
||||
echo >&2 "maybe you mistake good and bad revs?"
|
||||
exit $res
|
||||
fi
|
||||
|
||||
return $res
|
||||
}
|
||||
|
||||
filter_skipped() {
|
||||
_eval="$1"
|
||||
_skip="$2"
|
||||
|
||||
if [ -z "$_skip" ]; then
|
||||
eval_rev_list "$_eval"
|
||||
eval "$_eval"
|
||||
return
|
||||
fi
|
||||
|
||||
# Let's parse the output of:
|
||||
# "git rev-list --bisect-vars --bisect-all ..."
|
||||
eval_rev_list "$_eval" | while read hash line
|
||||
eval "$_eval" | while read hash line
|
||||
do
|
||||
case "$VARS,$FOUND,$TRIED,$hash" in
|
||||
# We display some vars.
|
||||
@@ -332,20 +338,133 @@ exit_if_skipped_commits () {
|
||||
fi
|
||||
}
|
||||
|
||||
bisect_checkout() {
|
||||
_rev="$1"
|
||||
_msg="$2"
|
||||
echo "Bisecting: $_msg"
|
||||
mark_expected_rev "$_rev"
|
||||
git checkout -q "$_rev" || exit
|
||||
git show-branch "$_rev"
|
||||
}
|
||||
|
||||
is_among() {
|
||||
_rev="$1"
|
||||
_list="$2"
|
||||
case "$_list" in *$_rev*) return 0 ;; esac
|
||||
return 1
|
||||
}
|
||||
|
||||
handle_bad_merge_base() {
|
||||
_badmb="$1"
|
||||
_good="$2"
|
||||
if is_expected_rev "$_badmb"; then
|
||||
cat >&2 <<EOF
|
||||
The merge base $_badmb is bad.
|
||||
This means the bug has been fixed between $_badmb and [$_good].
|
||||
EOF
|
||||
exit 3
|
||||
else
|
||||
cat >&2 <<EOF
|
||||
Some good revs are not ancestor of the bad rev.
|
||||
git bisect cannot work properly in this case.
|
||||
Maybe you mistake good and bad revs?
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
handle_skipped_merge_base() {
|
||||
_mb="$1"
|
||||
_bad="$2"
|
||||
_good="$3"
|
||||
cat >&2 <<EOF
|
||||
Warning: the merge base between $_bad and [$_good] must be skipped.
|
||||
So we cannot be sure the first bad commit is between $_mb and $_bad.
|
||||
We continue anyway.
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# "check_merge_bases" checks that merge bases are not "bad".
|
||||
#
|
||||
# - If one is "good", that's good, we have nothing to do.
|
||||
# - If one is "bad", it means the user assumed something wrong
|
||||
# and we must exit.
|
||||
# - If one is "skipped", we can't know but we should warn.
|
||||
# - If we don't know, we should check it out and ask the user to test.
|
||||
#
|
||||
# In the last case we will return 1, and otherwise 0.
|
||||
#
|
||||
check_merge_bases() {
|
||||
_bad="$1"
|
||||
_good="$2"
|
||||
_skip="$3"
|
||||
for _mb in $(git merge-base --all $_bad $_good)
|
||||
do
|
||||
if is_among "$_mb" "$_good"; then
|
||||
continue
|
||||
elif test "$_mb" = "$_bad"; then
|
||||
handle_bad_merge_base "$_bad" "$_good"
|
||||
elif is_among "$_mb" "$_skip"; then
|
||||
handle_skipped_merge_base "$_mb" "$_bad" "$_good"
|
||||
else
|
||||
bisect_checkout "$_mb" "a merge base must be tested"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# "check_good_are_ancestors_of_bad" checks that all "good" revs are
|
||||
# ancestor of the "bad" rev.
|
||||
#
|
||||
# If that's not the case, we need to check the merge bases.
|
||||
# If a merge base must be tested by the user we return 1 and
|
||||
# otherwise 0.
|
||||
#
|
||||
check_good_are_ancestors_of_bad() {
|
||||
test -f "$GIT_DIR/BISECT_ANCESTORS_OK" &&
|
||||
return
|
||||
|
||||
_bad="$1"
|
||||
_good=$(echo $2 | sed -e 's/\^//g')
|
||||
_skip="$3"
|
||||
|
||||
# Bisecting with no good rev is ok
|
||||
test -z "$_good" && return
|
||||
|
||||
_side=$(git rev-list $_good ^$_bad)
|
||||
if test -n "$_side"; then
|
||||
# Return if a checkout was done
|
||||
check_merge_bases "$_bad" "$_good" "$_skip" || return
|
||||
fi
|
||||
|
||||
: > "$GIT_DIR/BISECT_ANCESTORS_OK"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
bisect_next() {
|
||||
case "$#" in 0) ;; *) usage ;; esac
|
||||
bisect_autostart
|
||||
bisect_next_check good
|
||||
|
||||
skip=$(git for-each-ref --format='%(objectname)' \
|
||||
"refs/bisect/skip-*" | tr '\012' ' ') || exit
|
||||
|
||||
BISECT_OPT=''
|
||||
test -n "$skip" && BISECT_OPT='--bisect-all'
|
||||
|
||||
# Get bad, good and skipped revs
|
||||
bad=$(git rev-parse --verify refs/bisect/bad) &&
|
||||
good=$(git for-each-ref --format='^%(objectname)' \
|
||||
"refs/bisect/good-*" | tr '\012' ' ') &&
|
||||
skip=$(git for-each-ref --format='%(objectname)' \
|
||||
"refs/bisect/skip-*" | tr '\012' ' ') &&
|
||||
|
||||
# Maybe some merge bases must be tested first
|
||||
check_good_are_ancestors_of_bad "$bad" "$good" "$skip"
|
||||
# Return now if a checkout has already been done
|
||||
test "$?" -eq "1" && return
|
||||
|
||||
# Get bisection information
|
||||
BISECT_OPT=''
|
||||
test -n "$skip" && BISECT_OPT='--bisect-all'
|
||||
eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
|
||||
eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
|
||||
eval=$(filter_skipped "$eval" "$skip") &&
|
||||
@@ -366,9 +485,7 @@ bisect_next() {
|
||||
# commit is also a "skip" commit (see above).
|
||||
exit_if_skipped_commits "$bisect_rev"
|
||||
|
||||
echo "Bisecting: $bisect_nr revisions left to test after this"
|
||||
git checkout -q "$bisect_rev" || exit
|
||||
git show-branch "$bisect_rev"
|
||||
bisect_checkout "$bisect_rev" "$bisect_nr revisions left to test after this"
|
||||
}
|
||||
|
||||
bisect_visualize() {
|
||||
@@ -415,6 +532,8 @@ bisect_clean_state() {
|
||||
do
|
||||
git update-ref -d $ref $hash || exit
|
||||
done
|
||||
rm -f "$GIT_DIR/BISECT_EXPECTED_REV" &&
|
||||
rm -f "$GIT_DIR/BISECT_ANCESTORS_OK" &&
|
||||
rm -f "$GIT_DIR/BISECT_LOG" &&
|
||||
rm -f "$GIT_DIR/BISECT_NAMES" &&
|
||||
rm -f "$GIT_DIR/BISECT_RUN" &&
|
||||
|
||||
@@ -284,7 +284,7 @@ do_next () {
|
||||
pick_one $sha1 ||
|
||||
die_with_patch $sha1 "Could not apply $sha1... $rest"
|
||||
make_patch $sha1
|
||||
: > "$DOTEST"/amend
|
||||
git rev-parse --verify HEAD > "$DOTEST"/amend
|
||||
warn "Stopped at $sha1... $rest"
|
||||
warn "You can amend the commit now, with"
|
||||
warn
|
||||
@@ -427,14 +427,22 @@ do
|
||||
else
|
||||
. "$DOTEST"/author-script ||
|
||||
die "Cannot find the author identity"
|
||||
amend=
|
||||
if test -f "$DOTEST"/amend
|
||||
then
|
||||
amend=$(git rev-parse --verify HEAD)
|
||||
test "$amend" = $(cat "$DOTEST"/amend) ||
|
||||
die "\
|
||||
You have uncommitted changes in your working tree. Please, commit them
|
||||
first and then run 'git rebase --continue' again."
|
||||
git reset --soft HEAD^ ||
|
||||
die "Cannot rewind the HEAD"
|
||||
fi
|
||||
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
|
||||
git commit --no-verify -F "$DOTEST"/message -e ||
|
||||
die "Could not commit staged changes."
|
||||
git commit --no-verify -F "$DOTEST"/message -e || {
|
||||
test -n "$amend" && git reset --soft $amend
|
||||
die "Could not commit staged changes."
|
||||
}
|
||||
fi
|
||||
|
||||
require_clean_work_tree
|
||||
|
||||
@@ -10,7 +10,7 @@ git repack [options]
|
||||
a pack everything in a single pack
|
||||
A same as -a, and turn unreachable objects loose
|
||||
d remove redundant packs, and run git-prune-packed
|
||||
f pass --no-reuse-delta to git-pack-objects
|
||||
f pass --no-reuse-object to git-pack-objects
|
||||
n do not run git-update-server-info
|
||||
q,quiet be quiet
|
||||
l pass --local to git-pack-objects
|
||||
|
||||
56
git-svn.perl
56
git-svn.perl
@@ -2626,9 +2626,9 @@ sub rebuild_from_rev_db {
|
||||
sub rebuild {
|
||||
my ($self) = @_;
|
||||
my $map_path = $self->map_path;
|
||||
return if (-e $map_path && ! -z $map_path);
|
||||
my $partial = (-e $map_path && ! -z $map_path);
|
||||
return unless ::verify_ref($self->refname.'^0');
|
||||
if ($self->use_svm_props || $self->no_metadata) {
|
||||
if (!$partial && ($self->use_svm_props || $self->no_metadata)) {
|
||||
my $rev_db = $self->rev_db_path;
|
||||
$self->rebuild_from_rev_db($rev_db);
|
||||
if ($self->use_svm_props) {
|
||||
@@ -2638,10 +2638,13 @@ sub rebuild {
|
||||
$self->unlink_rev_db_symlink;
|
||||
return;
|
||||
}
|
||||
print "Rebuilding $map_path ...\n";
|
||||
print "Rebuilding $map_path ...\n" if (!$partial);
|
||||
my ($base_rev, $head) = ($partial ? $self->rev_map_max_norebuild(1) :
|
||||
(undef, undef));
|
||||
my ($log, $ctx) =
|
||||
command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/,
|
||||
$self->refname, '--');
|
||||
($head ? "$head.." : "") . $self->refname,
|
||||
'--');
|
||||
my $metadata_url = $self->metadata_url;
|
||||
remove_username($metadata_url);
|
||||
my $svn_uuid = $self->ra_uuid;
|
||||
@@ -2664,12 +2667,17 @@ sub rebuild {
|
||||
($metadata_url && $url && ($url ne $metadata_url))) {
|
||||
next;
|
||||
}
|
||||
if ($partial && $head) {
|
||||
print "Partial-rebuilding $map_path ...\n";
|
||||
print "Currently at $base_rev = $head\n";
|
||||
$head = undef;
|
||||
}
|
||||
|
||||
$self->rev_map_set($rev, $c);
|
||||
print "r$rev = $c\n";
|
||||
}
|
||||
command_close_pipe($log, $ctx);
|
||||
print "Done rebuilding $map_path\n";
|
||||
print "Done rebuilding $map_path\n" if (!$partial || !$head);
|
||||
my $rev_db_path = $self->rev_db_path;
|
||||
if (-f $self->rev_db_path) {
|
||||
unlink $self->rev_db_path or croak "unlink: $!";
|
||||
@@ -2809,6 +2817,12 @@ sub rev_map_set {
|
||||
sub rev_map_max {
|
||||
my ($self, $want_commit) = @_;
|
||||
$self->rebuild;
|
||||
my ($r, $c) = $self->rev_map_max_norebuild($want_commit);
|
||||
$want_commit ? ($r, $c) : $r;
|
||||
}
|
||||
|
||||
sub rev_map_max_norebuild {
|
||||
my ($self, $want_commit) = @_;
|
||||
my $map_path = $self->map_path;
|
||||
stat $map_path or return $want_commit ? (0, undef) : 0;
|
||||
sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
|
||||
@@ -3304,7 +3318,7 @@ sub close_file {
|
||||
my $out = syswrite($tmp_fh, $str, $res);
|
||||
defined($out) && $out == $res
|
||||
or croak("write ",
|
||||
$tmp_fh->filename,
|
||||
Git::temp_path($tmp_fh),
|
||||
": $!\n");
|
||||
}
|
||||
defined $res or croak $!;
|
||||
@@ -3315,7 +3329,7 @@ sub close_file {
|
||||
}
|
||||
|
||||
$hash = $::_repository->hash_and_insert_object(
|
||||
$fh->filename);
|
||||
Git::temp_path($fh));
|
||||
$hash =~ /^[a-f\d]{40}$/ or die "not a sha1: $hash\n";
|
||||
|
||||
Git::temp_release($fb->{base}, 1);
|
||||
@@ -4010,21 +4024,21 @@ sub gs_do_switch {
|
||||
my $old_url = $full_url;
|
||||
$full_url .= '/' . escape_uri_only($path) if length $path;
|
||||
my ($ra, $reparented);
|
||||
if ($old_url ne $full_url) {
|
||||
if ($old_url !~ m#^svn(\+ssh)?://#) {
|
||||
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url,
|
||||
$pool);
|
||||
$self->{url} = $full_url;
|
||||
$reparented = 1;
|
||||
} else {
|
||||
$_[0] = undef;
|
||||
$self = undef;
|
||||
$RA = undef;
|
||||
$ra = Git::SVN::Ra->new($full_url);
|
||||
$ra_invalid = 1;
|
||||
}
|
||||
|
||||
if ($old_url =~ m#^svn(\+ssh)?://#) {
|
||||
$_[0] = undef;
|
||||
$self = undef;
|
||||
$RA = undef;
|
||||
$ra = Git::SVN::Ra->new($full_url);
|
||||
$ra_invalid = 1;
|
||||
} elsif ($old_url ne $full_url) {
|
||||
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);
|
||||
$self->{url} = $full_url;
|
||||
$reparented = 1;
|
||||
}
|
||||
|
||||
$ra ||= $self;
|
||||
$url_b = escape_url($url_b);
|
||||
my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
|
||||
my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
|
||||
$reporter->set_path('', $rev_a, 0, @lock, $pool);
|
||||
@@ -4424,7 +4438,7 @@ sub config_pager {
|
||||
|
||||
sub run_pager {
|
||||
return unless -t *STDOUT && defined $pager;
|
||||
pipe my $rfd, my $wfd or return;
|
||||
pipe my ($rfd, $wfd) or return;
|
||||
defined(my $pid = fork) or ::fatal "Can't fork: $!";
|
||||
if (!$pid) {
|
||||
open STDOUT, '>&', $wfd or
|
||||
|
||||
6
git.c
6
git.c
@@ -364,7 +364,7 @@ static void handle_internal_command(int argc, const char **argv)
|
||||
if (sizeof(ext) > 1) {
|
||||
i = strlen(argv[0]) - strlen(ext);
|
||||
if (i > 0 && !strcmp(argv[0] + i, ext)) {
|
||||
char *argv0 = strdup(argv[0]);
|
||||
char *argv0 = xstrdup(argv[0]);
|
||||
argv[0] = cmd = argv0;
|
||||
argv0[i] = '\0';
|
||||
}
|
||||
@@ -499,7 +499,9 @@ int main(int argc, const char **argv)
|
||||
cmd, argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
help_unknown_cmd(cmd);
|
||||
argv[0] = help_unknown_cmd(cmd);
|
||||
handle_internal_command(argc, argv);
|
||||
execv_dashed_external(argv);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Failed to run command '%s': %s\n",
|
||||
|
||||
@@ -145,6 +145,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files cvs
|
||||
%defattr(-,root,root)
|
||||
%doc Documentation/*git-cvs*.txt
|
||||
%{_bindir}/git-cvsserver
|
||||
%{_libexecdir}/git-core/*cvs*
|
||||
%{!?_without_docs: %{_mandir}/man1/*cvs*.1*}
|
||||
%{!?_without_docs: %doc Documentation/*git-cvs*.html }
|
||||
@@ -188,6 +189,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
# No files for you!
|
||||
|
||||
%changelog
|
||||
* Fri Sep 12 2008 Quy Tonthat <qtonthat@gmail.com>
|
||||
- move git-cvsserver to bindir.
|
||||
|
||||
* Sun Jun 15 2008 Junio C Hamano <gitster@pobox.com>
|
||||
- Remove curl from Requires list.
|
||||
|
||||
|
||||
@@ -2123,7 +2123,7 @@ sub parse_commit_text {
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($co{'title'} eq "") {
|
||||
if (! defined $co{'title'} || $co{'title'} eq "") {
|
||||
$co{'title'} = $co{'title_short'} = '(no commit message)';
|
||||
}
|
||||
# remove added spaces
|
||||
|
||||
89
help.c
89
help.c
@@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "builtin.h"
|
||||
#include "exec_cmd.h"
|
||||
#include "levenshtein.h"
|
||||
#include "help.h"
|
||||
|
||||
/* most GUI terminals set COLUMNS (although some don't export it) */
|
||||
@@ -37,6 +38,16 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len)
|
||||
cmds->names[cmds->cnt++] = ent;
|
||||
}
|
||||
|
||||
static void clean_cmdnames(struct cmdnames *cmds)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < cmds->cnt; ++i)
|
||||
free(cmds->names[i]);
|
||||
free(cmds->names);
|
||||
cmds->cnt = 0;
|
||||
cmds->alloc = 0;
|
||||
}
|
||||
|
||||
static int cmdname_compare(const void *a_, const void *b_)
|
||||
{
|
||||
struct cmdname *a = *(struct cmdname **)a_;
|
||||
@@ -250,9 +261,85 @@ int is_in_cmdlist(struct cmdnames *c, const char *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void help_unknown_cmd(const char *cmd)
|
||||
static int autocorrect;
|
||||
|
||||
static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
if (!strcmp(var, "help.autocorrect"))
|
||||
autocorrect = git_config_int(var,value);
|
||||
|
||||
return git_default_config(var, value, cb);
|
||||
}
|
||||
|
||||
static int levenshtein_compare(const void *p1, const void *p2)
|
||||
{
|
||||
const struct cmdname *const *c1 = p1, *const *c2 = p2;
|
||||
const char *s1 = (*c1)->name, *s2 = (*c2)->name;
|
||||
int l1 = (*c1)->len;
|
||||
int l2 = (*c2)->len;
|
||||
return l1 != l2 ? l1 - l2 : strcmp(s1, s2);
|
||||
}
|
||||
|
||||
const char *help_unknown_cmd(const char *cmd)
|
||||
{
|
||||
int i, n, best_similarity = 0;
|
||||
struct cmdnames main_cmds, other_cmds;
|
||||
|
||||
memset(&main_cmds, 0, sizeof(main_cmds));
|
||||
memset(&other_cmds, 0, sizeof(main_cmds));
|
||||
|
||||
git_config(git_unknown_cmd_config, NULL);
|
||||
|
||||
load_command_list("git-", &main_cmds, &other_cmds);
|
||||
|
||||
ALLOC_GROW(main_cmds.names, main_cmds.cnt + other_cmds.cnt,
|
||||
main_cmds.alloc);
|
||||
memcpy(main_cmds.names + main_cmds.cnt, other_cmds.names,
|
||||
other_cmds.cnt * sizeof(other_cmds.names[0]));
|
||||
main_cmds.cnt += other_cmds.cnt;
|
||||
free(other_cmds.names);
|
||||
|
||||
/* This reuses cmdname->len for similarity index */
|
||||
for (i = 0; i < main_cmds.cnt; ++i)
|
||||
main_cmds.names[i]->len =
|
||||
levenshtein(cmd, main_cmds.names[i]->name, 0, 2, 1, 4);
|
||||
|
||||
qsort(main_cmds.names, main_cmds.cnt,
|
||||
sizeof(*main_cmds.names), levenshtein_compare);
|
||||
|
||||
if (!main_cmds.cnt)
|
||||
die ("Uh oh. Your system reports no Git commands at all.");
|
||||
|
||||
best_similarity = main_cmds.names[0]->len;
|
||||
n = 1;
|
||||
while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)
|
||||
++n;
|
||||
if (autocorrect && n == 1) {
|
||||
const char *assumed = main_cmds.names[0]->name;
|
||||
main_cmds.names[0] = NULL;
|
||||
clean_cmdnames(&main_cmds);
|
||||
fprintf(stderr, "WARNING: You called a Git program named '%s', "
|
||||
"which does not exist.\n"
|
||||
"Continuing under the assumption that you meant '%s'\n",
|
||||
cmd, assumed);
|
||||
if (autocorrect > 0) {
|
||||
fprintf(stderr, "in %0.1f seconds automatically...\n",
|
||||
(float)autocorrect/10.0);
|
||||
poll(NULL, 0, autocorrect * 100);
|
||||
}
|
||||
return assumed;
|
||||
}
|
||||
|
||||
fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
|
||||
|
||||
if (best_similarity < 6) {
|
||||
fprintf(stderr, "\nDid you mean %s?\n",
|
||||
n < 2 ? "this": "one of these");
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
fprintf(stderr, "\t%s\n", main_cmds.names[i]->name);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
2
help.h
2
help.h
@@ -5,7 +5,7 @@ struct cmdnames {
|
||||
int alloc;
|
||||
int cnt;
|
||||
struct cmdname {
|
||||
size_t len;
|
||||
size_t len; /* also used for similarity index in help.c */
|
||||
char name[FLEX_ARRAY];
|
||||
} **names;
|
||||
};
|
||||
|
||||
@@ -2237,7 +2237,7 @@ int main(int argc, char **argv)
|
||||
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
|
||||
|
||||
if (remote->url && remote->url[strlen(remote->url)-1] != '/') {
|
||||
rewritten_url = malloc(strlen(remote->url)+2);
|
||||
rewritten_url = xmalloc(strlen(remote->url)+2);
|
||||
strcpy(rewritten_url, remote->url);
|
||||
strcat(rewritten_url, "/");
|
||||
remote->url = rewritten_url;
|
||||
|
||||
13
http.c
13
http.c
@@ -165,7 +165,16 @@ static CURL* get_curl_handle(void)
|
||||
{
|
||||
CURL* result = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
|
||||
if (!curl_ssl_verify) {
|
||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
} else {
|
||||
/* Verify authenticity of the peer's certificate */
|
||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
|
||||
/* The name in the cert must match whom we tried to connect */
|
||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x070907
|
||||
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
|
||||
#endif
|
||||
@@ -402,7 +411,7 @@ static struct fill_chain *fill_cfg = NULL;
|
||||
|
||||
void add_fill_function(void *data, int (*fill)(void *))
|
||||
{
|
||||
struct fill_chain *new = malloc(sizeof(*new));
|
||||
struct fill_chain *new = xmalloc(sizeof(*new));
|
||||
struct fill_chain **linkp = &fill_cfg;
|
||||
new->data = data;
|
||||
new->fill = fill;
|
||||
|
||||
47
levenshtein.c
Normal file
47
levenshtein.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "cache.h"
|
||||
#include "levenshtein.h"
|
||||
|
||||
int levenshtein(const char *string1, const char *string2,
|
||||
int w, int s, int a, int d)
|
||||
{
|
||||
int len1 = strlen(string1), len2 = strlen(string2);
|
||||
int *row0 = xmalloc(sizeof(int) * (len2 + 1));
|
||||
int *row1 = xmalloc(sizeof(int) * (len2 + 1));
|
||||
int *row2 = xmalloc(sizeof(int) * (len2 + 1));
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j <= len2; j++)
|
||||
row1[j] = j * a;
|
||||
for (i = 0; i < len1; i++) {
|
||||
int *dummy;
|
||||
|
||||
row2[0] = (i + 1) * d;
|
||||
for (j = 0; j < len2; j++) {
|
||||
/* substitution */
|
||||
row2[j + 1] = row1[j] + s * (string1[i] != string2[j]);
|
||||
/* swap */
|
||||
if (i > 0 && j > 0 && string1[i - 1] == string2[j] &&
|
||||
string1[i] == string2[j - 1] &&
|
||||
row2[j + 1] > row0[j - 1] + w)
|
||||
row2[j + 1] = row0[j - 1] + w;
|
||||
/* deletion */
|
||||
if (j + 1 < len2 && row2[j + 1] > row1[j + 1] + d)
|
||||
row2[j + 1] = row1[j + 1] + d;
|
||||
/* insertion */
|
||||
if (row2[j + 1] > row2[j] + a)
|
||||
row2[j + 1] = row2[j] + a;
|
||||
}
|
||||
|
||||
dummy = row0;
|
||||
row0 = row1;
|
||||
row1 = row2;
|
||||
row2 = dummy;
|
||||
}
|
||||
|
||||
i = row1[len2];
|
||||
free(row0);
|
||||
free(row1);
|
||||
free(row2);
|
||||
|
||||
return i;
|
||||
}
|
||||
8
levenshtein.h
Normal file
8
levenshtein.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef LEVENSHTEIN_H
|
||||
#define LEVENSHTEIN_H
|
||||
|
||||
int levenshtein(const char *string1, const char *string2,
|
||||
int swap_penalty, int substition_penalty,
|
||||
int insertion_penalty, int deletion_penalty);
|
||||
|
||||
#endif
|
||||
36
log-tree.c
36
log-tree.c
@@ -1,12 +1,48 @@
|
||||
#include "cache.h"
|
||||
#include "diff.h"
|
||||
#include "commit.h"
|
||||
#include "tag.h"
|
||||
#include "graph.h"
|
||||
#include "log-tree.h"
|
||||
#include "reflog-walk.h"
|
||||
#include "refs.h"
|
||||
|
||||
struct decoration name_decoration = { "object names" };
|
||||
|
||||
static void add_name_decoration(const char *prefix, const char *name, struct object *obj)
|
||||
{
|
||||
int plen = strlen(prefix);
|
||||
int nlen = strlen(name);
|
||||
struct name_decoration *res = xmalloc(sizeof(struct name_decoration) + plen + nlen);
|
||||
memcpy(res->name, prefix, plen);
|
||||
memcpy(res->name + plen, name, nlen + 1);
|
||||
res->next = add_decoration(&name_decoration, obj, res);
|
||||
}
|
||||
|
||||
static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
|
||||
{
|
||||
struct object *obj = parse_object(sha1);
|
||||
if (!obj)
|
||||
return 0;
|
||||
add_name_decoration("", refname, obj);
|
||||
while (obj->type == OBJ_TAG) {
|
||||
obj = ((struct tag *)obj)->tagged;
|
||||
if (!obj)
|
||||
break;
|
||||
add_name_decoration("tag: ", refname, obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void load_ref_decorations(void)
|
||||
{
|
||||
static int loaded;
|
||||
if (!loaded) {
|
||||
loaded = 1;
|
||||
for_each_ref(add_ref_decoration, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void show_parents(struct commit *commit, int abbrev)
|
||||
{
|
||||
struct commit_list *p;
|
||||
|
||||
@@ -17,5 +17,6 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
|
||||
const char **subject_p,
|
||||
const char **extra_headers_p,
|
||||
int *need_8bit_cte_p);
|
||||
void load_ref_decorations(void);
|
||||
|
||||
#endif
|
||||
|
||||
13
object.h
13
object.h
@@ -41,7 +41,18 @@ extern int type_from_string(const char *str);
|
||||
extern unsigned int get_max_object_index(void);
|
||||
extern struct object *get_indexed_object(unsigned int);
|
||||
|
||||
/** Internal only **/
|
||||
/*
|
||||
* This can be used to see if we have heard of the object before, but
|
||||
* it can return "yes we have, and here is a half-initialised object"
|
||||
* for an object that we haven't loaded/parsed yet.
|
||||
*
|
||||
* When parsing a commit to create an in-core commit object, its
|
||||
* parents list holds commit objects that represent its parents, but
|
||||
* they are expected to be lazily initialized and do not know what
|
||||
* their trees or parents are yet. When this function returns such a
|
||||
* half-initialised objects, the caller is expected to initialize them
|
||||
* by calling parse_object() on them.
|
||||
*/
|
||||
struct object *lookup_object(const unsigned char *sha1);
|
||||
|
||||
extern void *create_object(const unsigned char *sha1, int type, void *obj);
|
||||
|
||||
42
perl/Git.pm
42
perl/Git.pm
@@ -58,7 +58,7 @@ require Exporter;
|
||||
command_bidi_pipe command_close_bidi_pipe
|
||||
version exec_path hash_object git_cmd_try
|
||||
remote_refs
|
||||
temp_acquire temp_release temp_reset);
|
||||
temp_acquire temp_release temp_reset temp_path);
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -937,7 +937,7 @@ sub _close_cat_blob {
|
||||
|
||||
{ # %TEMP_* Lexical Context
|
||||
|
||||
my (%TEMP_LOCKS, %TEMP_FILES);
|
||||
my (%TEMP_FILEMAP, %TEMP_FILES);
|
||||
|
||||
=item temp_acquire ( NAME )
|
||||
|
||||
@@ -965,7 +965,7 @@ sub temp_acquire {
|
||||
|
||||
my $temp_fd = _temp_cache($name);
|
||||
|
||||
$TEMP_LOCKS{$temp_fd} = 1;
|
||||
$TEMP_FILES{$temp_fd}{locked} = 1;
|
||||
$temp_fd;
|
||||
}
|
||||
|
||||
@@ -991,16 +991,16 @@ the same string.
|
||||
sub temp_release {
|
||||
my ($self, $temp_fd, $trunc) = _maybe_self(@_);
|
||||
|
||||
if (ref($temp_fd) ne 'File::Temp') {
|
||||
if (exists $TEMP_FILEMAP{$temp_fd}) {
|
||||
$temp_fd = $TEMP_FILES{$temp_fd};
|
||||
}
|
||||
unless ($TEMP_LOCKS{$temp_fd}) {
|
||||
unless ($TEMP_FILES{$temp_fd}{locked}) {
|
||||
carp "Attempt to release temp file '",
|
||||
$temp_fd, "' that has not been locked";
|
||||
}
|
||||
temp_reset($temp_fd) if $trunc and $temp_fd->opened;
|
||||
|
||||
$TEMP_LOCKS{$temp_fd} = 0;
|
||||
$TEMP_FILES{$temp_fd}{locked} = 0;
|
||||
undef;
|
||||
}
|
||||
|
||||
@@ -1009,9 +1009,9 @@ sub _temp_cache {
|
||||
|
||||
_verify_require();
|
||||
|
||||
my $temp_fd = \$TEMP_FILES{$name};
|
||||
my $temp_fd = \$TEMP_FILEMAP{$name};
|
||||
if (defined $$temp_fd and $$temp_fd->opened) {
|
||||
if ($TEMP_LOCKS{$$temp_fd}) {
|
||||
if ($TEMP_FILES{$$temp_fd}{locked}) {
|
||||
throw Error::Simple("Temp file with moniker '",
|
||||
$name, "' already in use");
|
||||
}
|
||||
@@ -1021,12 +1021,13 @@ sub _temp_cache {
|
||||
carp "Temp file '", $name,
|
||||
"' was closed. Opening replacement.";
|
||||
}
|
||||
$$temp_fd = File::Temp->new(
|
||||
TEMPLATE => 'Git_XXXXXX',
|
||||
DIR => File::Spec->tmpdir
|
||||
my $fname;
|
||||
($$temp_fd, $fname) = File::Temp->tempfile(
|
||||
'Git_XXXXXX', UNLINK => 1
|
||||
) or throw Error::Simple("couldn't open new temp file");
|
||||
$$temp_fd->autoflush;
|
||||
binmode $$temp_fd;
|
||||
$TEMP_FILES{$$temp_fd}{fname} = $fname;
|
||||
}
|
||||
$$temp_fd;
|
||||
}
|
||||
@@ -1053,8 +1054,25 @@ sub temp_reset {
|
||||
or throw Error::Simple("expected file position to be reset");
|
||||
}
|
||||
|
||||
=item temp_path ( NAME )
|
||||
|
||||
=item temp_path ( FILEHANDLE )
|
||||
|
||||
Returns the filename associated with the given tempfile.
|
||||
|
||||
=cut
|
||||
|
||||
sub temp_path {
|
||||
my ($self, $temp_fd) = _maybe_self(@_);
|
||||
|
||||
if (exists $TEMP_FILEMAP{$temp_fd}) {
|
||||
$temp_fd = $TEMP_FILEMAP{$temp_fd};
|
||||
}
|
||||
$TEMP_FILES{$temp_fd}{fname};
|
||||
}
|
||||
|
||||
sub END {
|
||||
unlink values %TEMP_FILES if %TEMP_FILES;
|
||||
unlink values %TEMP_FILEMAP if %TEMP_FILEMAP;
|
||||
}
|
||||
|
||||
} # %TEMP_* Lexical Context
|
||||
|
||||
21
pretty.c
21
pretty.c
@@ -5,6 +5,7 @@
|
||||
#include "revision.h"
|
||||
#include "string-list.h"
|
||||
#include "mailmap.h"
|
||||
#include "log-tree.h"
|
||||
|
||||
static char *user_format;
|
||||
|
||||
@@ -481,6 +482,23 @@ static void parse_commit_header(struct format_commit_context *context)
|
||||
context->commit_header_parsed = 1;
|
||||
}
|
||||
|
||||
static void format_decoration(struct strbuf *sb, const struct commit *commit)
|
||||
{
|
||||
struct name_decoration *d;
|
||||
const char *prefix = " (";
|
||||
|
||||
load_ref_decorations();
|
||||
d = lookup_decoration(&name_decoration, &commit->object);
|
||||
while (d) {
|
||||
strbuf_addstr(sb, prefix);
|
||||
prefix = ", ";
|
||||
strbuf_addstr(sb, d->name);
|
||||
d = d->next;
|
||||
}
|
||||
if (prefix[0] == ',')
|
||||
strbuf_addch(sb, ')');
|
||||
}
|
||||
|
||||
static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
|
||||
void *context)
|
||||
{
|
||||
@@ -573,6 +591,9 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
|
||||
? '<'
|
||||
: '>');
|
||||
return 1;
|
||||
case 'd':
|
||||
format_decoration(sb, commit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* For the rest we have to parse the commit header. */
|
||||
|
||||
@@ -1253,6 +1253,7 @@ int discard_index(struct index_state *istate)
|
||||
istate->cache_nr = 0;
|
||||
istate->cache_changed = 0;
|
||||
istate->timestamp = 0;
|
||||
istate->name_hash_initialized = 0;
|
||||
free_hash(&istate->name_hash);
|
||||
cache_tree_free(&(istate->cache_tree));
|
||||
free(istate->alloc);
|
||||
|
||||
20
refs.c
20
refs.c
@@ -390,6 +390,18 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the "reading" argument is set, this function finds out what _object_
|
||||
* the ref points at by "reading" the ref. The ref, if it is not symbolic,
|
||||
* has to exist, and if it is symbolic, it has to point at an existing ref,
|
||||
* because the "read" goes through the symref to the ref it points at.
|
||||
*
|
||||
* The access that is not "reading" may often be "writing", but does not
|
||||
* have to; it can be merely checking _where it leads to_. If it is a
|
||||
* prelude to "writing" to the ref, a write to a symref that points at
|
||||
* yet-to-be-born ref will create the real ref pointed by the symref.
|
||||
* reading=0 allows the caller to check where such a symref leads to.
|
||||
*/
|
||||
const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *flag)
|
||||
{
|
||||
int depth = MAXDEPTH;
|
||||
@@ -409,13 +421,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
||||
if (--depth < 0)
|
||||
return NULL;
|
||||
|
||||
/* Special case: non-existing file.
|
||||
* Not having the refs/heads/new-branch is OK
|
||||
* if we are writing into it, so is .git/HEAD
|
||||
* that points at refs/heads/master still to be
|
||||
* born. It is NOT OK if we are resolving for
|
||||
* reading.
|
||||
*/
|
||||
/* Special case: non-existing file. */
|
||||
if (lstat(path, &st) < 0) {
|
||||
struct ref_list *list = get_packed_refs();
|
||||
while (list) {
|
||||
|
||||
4
remote.c
4
remote.c
@@ -69,7 +69,7 @@ static const char *alias_url(const char *url)
|
||||
if (!longest)
|
||||
return url;
|
||||
|
||||
ret = malloc(rewrite[longest_i]->baselen +
|
||||
ret = xmalloc(rewrite[longest_i]->baselen +
|
||||
(strlen(url) - longest->len) + 1);
|
||||
strcpy(ret, rewrite[longest_i]->base);
|
||||
strcpy(ret + rewrite[longest_i]->baselen, url + longest->len);
|
||||
@@ -152,7 +152,7 @@ static struct branch *make_branch(const char *name, int len)
|
||||
ret->name = xstrndup(name, len);
|
||||
else
|
||||
ret->name = xstrdup(name);
|
||||
refname = malloc(strlen(name) + strlen("refs/heads/") + 1);
|
||||
refname = xmalloc(strlen(name) + strlen("refs/heads/") + 1);
|
||||
strcpy(refname, "refs/heads/");
|
||||
strcpy(refname + strlen("refs/heads/"), ret->name);
|
||||
ret->refname = refname;
|
||||
|
||||
38
revision.c
38
revision.c
@@ -1793,26 +1793,6 @@ static struct commit *get_revision_internal(struct rev_info *revs)
|
||||
return c;
|
||||
}
|
||||
|
||||
if (revs->reverse) {
|
||||
int limit = -1;
|
||||
|
||||
if (0 <= revs->max_count) {
|
||||
limit = revs->max_count;
|
||||
if (0 < revs->skip_count)
|
||||
limit += revs->skip_count;
|
||||
}
|
||||
l = NULL;
|
||||
while ((c = get_revision_1(revs))) {
|
||||
commit_list_insert(c, &l);
|
||||
if ((0 < limit) && !--limit)
|
||||
break;
|
||||
}
|
||||
revs->commits = l;
|
||||
revs->reverse = 0;
|
||||
revs->max_count = -1;
|
||||
c = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now pick up what they want to give us
|
||||
*/
|
||||
@@ -1885,7 +1865,23 @@ static struct commit *get_revision_internal(struct rev_info *revs)
|
||||
|
||||
struct commit *get_revision(struct rev_info *revs)
|
||||
{
|
||||
struct commit *c = get_revision_internal(revs);
|
||||
struct commit *c;
|
||||
struct commit_list *reversed;
|
||||
|
||||
if (revs->reverse) {
|
||||
reversed = NULL;
|
||||
while ((c = get_revision_internal(revs))) {
|
||||
commit_list_insert(c, &reversed);
|
||||
}
|
||||
revs->commits = reversed;
|
||||
revs->reverse = 0;
|
||||
revs->reverse_output_stage = 1;
|
||||
}
|
||||
|
||||
if (revs->reverse_output_stage)
|
||||
return pop_commit(&revs->commits);
|
||||
|
||||
c = get_revision_internal(revs);
|
||||
if (c && revs->graph)
|
||||
graph_update(revs->graph, c);
|
||||
return c;
|
||||
|
||||
@@ -54,6 +54,7 @@ struct rev_info {
|
||||
rewrite_parents:1,
|
||||
print_parents:1,
|
||||
reverse:1,
|
||||
reverse_output_stage:1,
|
||||
cherry_pick:1,
|
||||
first_parent_only:1;
|
||||
|
||||
|
||||
@@ -2136,7 +2136,9 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len,
|
||||
*/
|
||||
int move_temp_to_file(const char *tmpfile, const char *filename)
|
||||
{
|
||||
int ret = link(tmpfile, filename);
|
||||
int ret = 0;
|
||||
if (link(tmpfile, filename))
|
||||
ret = errno;
|
||||
|
||||
/*
|
||||
* Coda hack - coda doesn't like cross-directory links,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
. ./test-lib.sh
|
||||
|
||||
remotes_git_svn=remotes/git""-svn
|
||||
git_svn_id=git""-svn-id
|
||||
|
||||
if test -n "$NO_SVN_TESTS"
|
||||
then
|
||||
test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' :
|
||||
test_expect_success 'skipping git svn tests, NO_SVN_TESTS defined' :
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
@@ -14,7 +17,7 @@ SVN_TREE=$GIT_SVN_DIR/svn-tree
|
||||
svn >/dev/null 2>&1
|
||||
if test $? -ne 1
|
||||
then
|
||||
test_expect_success 'skipping git-svn tests, svn not found' :
|
||||
test_expect_success 'skipping git svn tests, svn not found' :
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
@@ -88,7 +91,7 @@ start_httpd () {
|
||||
mkdir "$GIT_DIR"/logs
|
||||
|
||||
cat > "$GIT_DIR/httpd.conf" <<EOF
|
||||
ServerName "git-svn test"
|
||||
ServerName "git svn test"
|
||||
ServerRoot "$GIT_DIR"
|
||||
DocumentRoot "$GIT_DIR"
|
||||
PidFile "$GIT_DIR/httpd.pid"
|
||||
@@ -135,3 +138,20 @@ close $wr or die $!;
|
||||
close $rd or die $!;
|
||||
EOF
|
||||
}
|
||||
|
||||
require_svnserve () {
|
||||
if test -z "$SVNSERVE_PORT"
|
||||
then
|
||||
say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
start_svnserve () {
|
||||
svnserve --listen-port $SVNSERVE_PORT \
|
||||
--root "$rawsvnrepo" \
|
||||
--listen-once \
|
||||
--listen-host 127.0.0.1 &
|
||||
}
|
||||
|
||||
|
||||
46
t/t0024-crlf-archive.sh
Normal file
46
t/t0024-crlf-archive.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='respect crlf in git archive'
|
||||
|
||||
. ./test-lib.sh
|
||||
UNZIP=${UNZIP:-unzip}
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
git config core.autocrlf true
|
||||
|
||||
printf "CRLF line ending\r\nAnd another\r\n" > sample &&
|
||||
git add sample &&
|
||||
|
||||
test_tick &&
|
||||
git commit -m Initial
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'tar archive' '
|
||||
|
||||
git archive --format=tar HEAD |
|
||||
( mkdir untarred && cd untarred && "$TAR" -xf - )
|
||||
|
||||
test_cmp sample untarred/sample
|
||||
|
||||
'
|
||||
|
||||
"$UNZIP" -v >/dev/null 2>&1
|
||||
if [ $? -eq 127 ]; then
|
||||
echo "Skipping ZIP test, because unzip was not found"
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
test_expect_success 'zip archive' '
|
||||
|
||||
git archive --format=zip HEAD >test.zip &&
|
||||
|
||||
( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
|
||||
|
||||
test_cmp sample unzipped/sample
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
@@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' '
|
||||
test_must_fail git diff --no-index Beer.java Beer-correct.java
|
||||
'
|
||||
|
||||
test_expect_success 'alternation in pattern' '
|
||||
git config diff.java.funcname "^[ ]*\\(\\(public\\|static\\).*\\)$"
|
||||
git diff --no-index Beer.java Beer-correct.java |
|
||||
grep "^@@.*@@ public static void main("
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -178,4 +178,16 @@ test_expect_success 'trailing empty lines (2)' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'do not color trailing cr in context' '
|
||||
git config --unset core.whitespace
|
||||
rm -f .gitattributes &&
|
||||
echo AAAQ | tr Q "\015" >G &&
|
||||
git add G &&
|
||||
echo BBBQ | tr Q "\015" >>G
|
||||
git diff --color G | tr "\015" Q >output &&
|
||||
grep "BBB.*${blue_grep}Q" output &&
|
||||
grep "AAA.*\[mQ" output
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -284,7 +284,8 @@ test_expect_success \
|
||||
|
||||
test_expect_success \
|
||||
'make sure index-pack detects the SHA1 collision' \
|
||||
'test_must_fail git index-pack -o bad.idx test-3.pack'
|
||||
'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
|
||||
grep "SHA1 COLLISION FOUND" msg'
|
||||
|
||||
test_expect_success \
|
||||
'honor pack.packSizeLimit' \
|
||||
|
||||
@@ -303,4 +303,24 @@ test_expect_success 'pushing nonexistent branch by mistake should not segv' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'auto tag following fetches minimum' '
|
||||
|
||||
cd "$D" &&
|
||||
git clone .git follow &&
|
||||
git checkout HEAD^0 &&
|
||||
(
|
||||
for i in 1 2 3 4 5 6 7
|
||||
do
|
||||
echo $i >>file &&
|
||||
git commit -m $i -a &&
|
||||
git tag -a -m $i excess-$i || exit 1
|
||||
done
|
||||
) &&
|
||||
git checkout master &&
|
||||
(
|
||||
cd follow &&
|
||||
git fetch
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
42
t/t6013-rev-list-reverse-parents.sh
Executable file
42
t/t6013-rev-list-reverse-parents.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='--reverse combines with --parents'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
|
||||
commit () {
|
||||
test_tick &&
|
||||
echo $1 > foo &&
|
||||
git add foo &&
|
||||
git commit -m "$1"
|
||||
}
|
||||
|
||||
test_expect_success 'set up --reverse example' '
|
||||
commit one &&
|
||||
git tag root &&
|
||||
commit two &&
|
||||
git checkout -b side HEAD^ &&
|
||||
commit three &&
|
||||
git checkout master &&
|
||||
git merge -s ours side &&
|
||||
commit five
|
||||
'
|
||||
|
||||
test_expect_success '--reverse --parents --full-history combines correctly' '
|
||||
git rev-list --parents --full-history master -- foo |
|
||||
perl -e "print reverse <>" > expected &&
|
||||
git rev-list --reverse --parents --full-history master -- foo \
|
||||
> actual &&
|
||||
test_cmp actual expected
|
||||
'
|
||||
|
||||
test_expect_success '--boundary does too' '
|
||||
git rev-list --boundary --parents --full-history master ^root -- foo |
|
||||
perl -e "print reverse <>" > expected &&
|
||||
git rev-list --boundary --reverse --parents --full-history \
|
||||
master ^root -- foo > actual &&
|
||||
test_cmp actual expected
|
||||
'
|
||||
|
||||
test_done
|
||||
@@ -150,8 +150,8 @@ test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
|
||||
|
||||
'
|
||||
|
||||
sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit;/" < new6.txt > new8.txt
|
||||
sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit --/" < new7.txt > new9.txt
|
||||
sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt
|
||||
sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt
|
||||
|
||||
test_expect_success 'ZEALOUS_ALNUM' '
|
||||
|
||||
|
||||
@@ -350,6 +350,120 @@ test_expect_success 'bisect does not create a "bisect" branch' '
|
||||
git branch -D bisect
|
||||
'
|
||||
|
||||
# This creates a "side" branch to test "siblings" cases.
|
||||
#
|
||||
# H1-H2-H3-H4-H5-H6-H7 <--other
|
||||
# \
|
||||
# S5-S6-S7 <--side
|
||||
#
|
||||
test_expect_success 'side branch creation' '
|
||||
git bisect reset &&
|
||||
git checkout -b side $HASH4 &&
|
||||
add_line_into_file "5(side): first line on a side branch" hello2 &&
|
||||
SIDE_HASH5=$(git rev-parse --verify HEAD) &&
|
||||
add_line_into_file "6(side): second line on a side branch" hello2 &&
|
||||
SIDE_HASH6=$(git rev-parse --verify HEAD) &&
|
||||
add_line_into_file "7(side): third line on a side branch" hello2 &&
|
||||
SIDE_HASH7=$(git rev-parse --verify HEAD)
|
||||
'
|
||||
|
||||
test_expect_success 'good merge base when good and bad are siblings' '
|
||||
git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
|
||||
grep "merge base must be tested" my_bisect_log.txt &&
|
||||
grep $HASH4 my_bisect_log.txt &&
|
||||
git bisect good > my_bisect_log.txt &&
|
||||
test_must_fail grep "merge base must be tested" my_bisect_log.txt &&
|
||||
grep $HASH6 my_bisect_log.txt &&
|
||||
git bisect reset
|
||||
'
|
||||
test_expect_success 'skipped merge base when good and bad are siblings' '
|
||||
git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
|
||||
grep "merge base must be tested" my_bisect_log.txt &&
|
||||
grep $HASH4 my_bisect_log.txt &&
|
||||
git bisect skip > my_bisect_log.txt 2>&1 &&
|
||||
grep "Warning" my_bisect_log.txt &&
|
||||
grep $SIDE_HASH6 my_bisect_log.txt &&
|
||||
git bisect reset
|
||||
'
|
||||
|
||||
test_expect_success 'bad merge base when good and bad are siblings' '
|
||||
git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
|
||||
grep "merge base must be tested" my_bisect_log.txt &&
|
||||
grep $HASH4 my_bisect_log.txt &&
|
||||
test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
|
||||
grep "merge base $HASH4 is bad" my_bisect_log.txt &&
|
||||
grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
|
||||
git bisect reset
|
||||
'
|
||||
|
||||
# This creates a few more commits (A and B) to test "siblings" cases
|
||||
# when a good and a bad rev have many merge bases.
|
||||
#
|
||||
# We should have the following:
|
||||
#
|
||||
# H1-H2-H3-H4-H5-H6-H7
|
||||
# \ \ \
|
||||
# S5-A \
|
||||
# \ \
|
||||
# S6-S7----B
|
||||
#
|
||||
# And there A and B have 2 merge bases (S5 and H5) that should be
|
||||
# reported by "git merge-base --all A B".
|
||||
#
|
||||
test_expect_success 'many merge bases creation' '
|
||||
git checkout "$SIDE_HASH5" &&
|
||||
git merge -m "merge HASH5 and SIDE_HASH5" "$HASH5" &&
|
||||
A_HASH=$(git rev-parse --verify HEAD) &&
|
||||
git checkout side &&
|
||||
git merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" &&
|
||||
B_HASH=$(git rev-parse --verify HEAD) &&
|
||||
git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt &&
|
||||
test $(wc -l < merge_bases.txt) = "2" &&
|
||||
grep "$HASH5" merge_bases.txt &&
|
||||
grep "$SIDE_HASH5" merge_bases.txt
|
||||
'
|
||||
|
||||
test_expect_success 'good merge bases when good and bad are siblings' '
|
||||
git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
|
||||
grep "merge base must be tested" my_bisect_log.txt &&
|
||||
git bisect good > my_bisect_log2.txt &&
|
||||
grep "merge base must be tested" my_bisect_log2.txt &&
|
||||
{
|
||||
{
|
||||
grep "$SIDE_HASH5" my_bisect_log.txt &&
|
||||
grep "$HASH5" my_bisect_log2.txt
|
||||
} || {
|
||||
grep "$SIDE_HASH5" my_bisect_log2.txt &&
|
||||
grep "$HASH5" my_bisect_log.txt
|
||||
}
|
||||
} &&
|
||||
git bisect reset
|
||||
'
|
||||
|
||||
check_trace() {
|
||||
grep "$1" "$GIT_TRACE" | grep "\^$2" | grep "$3" >/dev/null
|
||||
}
|
||||
|
||||
test_expect_success 'optimized merge base checks' '
|
||||
GIT_TRACE="$(pwd)/trace.log" &&
|
||||
export GIT_TRACE &&
|
||||
git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
|
||||
grep "merge base must be tested" my_bisect_log.txt &&
|
||||
grep "$HASH4" my_bisect_log.txt &&
|
||||
check_trace "rev-list" "$HASH7" "$SIDE_HASH7" &&
|
||||
git bisect good > my_bisect_log2.txt &&
|
||||
test -f ".git/BISECT_ANCESTORS_OK" &&
|
||||
test "$HASH6" = $(git rev-parse --verify HEAD) &&
|
||||
: > "$GIT_TRACE" &&
|
||||
git bisect bad > my_bisect_log3.txt &&
|
||||
test_must_fail check_trace "rev-list" "$HASH6" "$SIDE_HASH7" &&
|
||||
git bisect good "$A_HASH" > my_bisect_log4.txt &&
|
||||
grep "merge base must be tested" my_bisect_log4.txt &&
|
||||
test_must_fail test -f ".git/BISECT_ANCESTORS_OK" &&
|
||||
check_trace "rev-list" "$HASH6" "$A_HASH" &&
|
||||
unset GIT_TRACE
|
||||
'
|
||||
|
||||
#
|
||||
#
|
||||
test_done
|
||||
|
||||
@@ -262,6 +262,50 @@ for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
|
||||
"
|
||||
done
|
||||
|
||||
cat >expected <<\EOF
|
||||
master
|
||||
testtag
|
||||
EOF
|
||||
|
||||
test_expect_success 'Check short refname format' '
|
||||
(git for-each-ref --format="%(refname:short)" refs/heads &&
|
||||
git for-each-ref --format="%(refname:short)" refs/tags) >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'Check for invalid refname format' '
|
||||
test_must_fail git for-each-ref --format="%(refname:INVALID)"
|
||||
'
|
||||
|
||||
cat >expected <<\EOF
|
||||
heads/master
|
||||
master
|
||||
EOF
|
||||
|
||||
test_expect_success 'Check ambiguous head and tag refs' '
|
||||
git checkout -b newtag &&
|
||||
echo "Using $datestamp" > one &&
|
||||
git add one &&
|
||||
git commit -m "Branch" &&
|
||||
setdate_and_increment &&
|
||||
git tag -m "Tagging at $datestamp" master &&
|
||||
git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
cat >expected <<\EOF
|
||||
heads/ambiguous
|
||||
ambiguous
|
||||
EOF
|
||||
|
||||
test_expect_success 'Check ambiguous head and tag refs II' '
|
||||
git checkout master &&
|
||||
git tag ambiguous testtag^0 &&
|
||||
git branch ambiguous testtag^0 &&
|
||||
git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'an unusual tag with an incomplete line' '
|
||||
|
||||
git tag -m "bogo" bogo &&
|
||||
|
||||
@@ -373,4 +373,36 @@ test_expect_success \
|
||||
'checkout with --track, but without -b, fails with too short tracked name' '
|
||||
test_must_fail git checkout --track renamer'
|
||||
|
||||
test_expect_success 'checkout an unmerged path should fail' '
|
||||
rm -f .git/index &&
|
||||
O=$(echo original | git hash-object -w --stdin) &&
|
||||
A=$(echo ourside | git hash-object -w --stdin) &&
|
||||
B=$(echo theirside | git hash-object -w --stdin) &&
|
||||
(
|
||||
echo "100644 $A 0 fild" &&
|
||||
echo "100644 $O 1 file" &&
|
||||
echo "100644 $A 2 file" &&
|
||||
echo "100644 $B 3 file" &&
|
||||
echo "100644 $A 0 filf"
|
||||
) | git update-index --index-info &&
|
||||
echo "none of the above" >sample &&
|
||||
cat sample >fild &&
|
||||
cat sample >file &&
|
||||
cat sample >filf &&
|
||||
test_must_fail git checkout fild file filf &&
|
||||
test_cmp sample fild &&
|
||||
test_cmp sample filf &&
|
||||
test_cmp sample file
|
||||
'
|
||||
|
||||
test_expect_success 'failing checkout -b should not break working tree' '
|
||||
git reset --hard master &&
|
||||
git symbolic-ref HEAD refs/heads/master &&
|
||||
test_must_fail git checkout -b renamer side^ &&
|
||||
test $(git symbolic-ref HEAD) = refs/heads/master &&
|
||||
git diff --exit-code &&
|
||||
git diff --cached --exit-code
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -141,7 +141,7 @@ EOF
|
||||
|
||||
test_expect_success \
|
||||
'validate git rev-list output.' \
|
||||
'diff current expected'
|
||||
'test_cmp expected current'
|
||||
|
||||
test_expect_success 'partial commit that involves removal (1)' '
|
||||
|
||||
@@ -151,7 +151,7 @@ test_expect_success 'partial commit that involves removal (1)' '
|
||||
git commit -m "Partial: add elif" elif &&
|
||||
git diff-tree --name-status HEAD^ HEAD >current &&
|
||||
echo "A elif" >expected &&
|
||||
diff expected current
|
||||
test_cmp expected current
|
||||
|
||||
'
|
||||
|
||||
@@ -160,7 +160,7 @@ test_expect_success 'partial commit that involves removal (2)' '
|
||||
git commit -m "Partial: remove file" file &&
|
||||
git diff-tree --name-status HEAD^ HEAD >current &&
|
||||
echo "D file" >expected &&
|
||||
diff expected current
|
||||
test_cmp expected current
|
||||
|
||||
'
|
||||
|
||||
@@ -171,7 +171,7 @@ test_expect_success 'partial commit that involves removal (3)' '
|
||||
git commit -m "Partial: modify elif" elif &&
|
||||
git diff-tree --name-status HEAD^ HEAD >current &&
|
||||
echo "M elif" >expected &&
|
||||
diff expected current
|
||||
test_cmp expected current
|
||||
|
||||
'
|
||||
|
||||
@@ -187,7 +187,7 @@ test_expect_success 'amend commit to fix author' '
|
||||
expected &&
|
||||
git commit --amend --author="$author" &&
|
||||
git cat-file -p HEAD > current &&
|
||||
diff expected current
|
||||
test_cmp expected current
|
||||
|
||||
'
|
||||
|
||||
@@ -256,7 +256,7 @@ test_expect_success 'amend commit to fix author' '
|
||||
expected &&
|
||||
git commit --amend --author="$author" &&
|
||||
git cat-file -p HEAD > current &&
|
||||
diff expected current
|
||||
test_cmp expected current
|
||||
|
||||
'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='git-merge
|
||||
test_description='git merge
|
||||
|
||||
Testing a custom strategy.'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2006 Eric Wong
|
||||
#
|
||||
|
||||
test_description='git-svn basic tests'
|
||||
test_description='git svn basic tests'
|
||||
GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
|
||||
|
||||
case "$GIT_SVN_LC_ALL" in
|
||||
@@ -17,10 +17,10 @@ esac
|
||||
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
say 'define NO_SVN_TESTS to skip git-svn tests'
|
||||
say 'define NO_SVN_TESTS to skip git svn tests'
|
||||
|
||||
test_expect_success \
|
||||
'initialize git-svn' '
|
||||
'initialize git svn' '
|
||||
mkdir import &&
|
||||
cd import &&
|
||||
echo foo > foo &&
|
||||
@@ -31,26 +31,26 @@ test_expect_success \
|
||||
echo "zzz" > bar/zzz &&
|
||||
echo "#!/bin/sh" > exec.sh &&
|
||||
chmod +x exec.sh &&
|
||||
svn import -m "import for git-svn" . "$svnrepo" >/dev/null &&
|
||||
svn import -m "import for git svn" . "$svnrepo" >/dev/null &&
|
||||
cd .. &&
|
||||
rm -rf import &&
|
||||
git-svn init "$svnrepo"'
|
||||
git svn init "$svnrepo"'
|
||||
|
||||
test_expect_success \
|
||||
'import an SVN revision into git' \
|
||||
'git-svn fetch'
|
||||
'git svn fetch'
|
||||
|
||||
test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"'
|
||||
|
||||
name='try a deep --rmdir with a commit'
|
||||
test_expect_success "$name" '
|
||||
git checkout -f -b mybranch remotes/git-svn &&
|
||||
git checkout -f -b mybranch ${remotes_git_svn} &&
|
||||
mv dir/a/b/c/d/e/file dir/file &&
|
||||
cp dir/file file &&
|
||||
git update-index --add --remove dir/a/b/c/d/e/file dir/file file &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a'
|
||||
|
||||
@@ -63,61 +63,61 @@ test_expect_success "$name" "
|
||||
git update-index --remove dir/file &&
|
||||
git update-index --add dir/file/file &&
|
||||
git commit -m '$name' &&
|
||||
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch" || true
|
||||
test_must_fail git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch" || true
|
||||
|
||||
|
||||
name='detect node change from directory to file #1'
|
||||
test_expect_success "$name" '
|
||||
rm -rf dir "$GIT_DIR"/index &&
|
||||
git checkout -f -b mybranch2 remotes/git-svn &&
|
||||
git checkout -f -b mybranch2 ${remotes_git_svn} &&
|
||||
mv bar/zzz zzz &&
|
||||
rm -rf bar &&
|
||||
mv zzz bar &&
|
||||
git update-index --remove -- bar/zzz &&
|
||||
git update-index --add -- bar &&
|
||||
git commit -m "$name" &&
|
||||
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch2' || true
|
||||
test_must_fail git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch2' || true
|
||||
|
||||
|
||||
name='detect node change from file to directory #2'
|
||||
test_expect_success "$name" '
|
||||
rm -f "$GIT_DIR"/index &&
|
||||
git checkout -f -b mybranch3 remotes/git-svn &&
|
||||
git checkout -f -b mybranch3 ${remotes_git_svn} &&
|
||||
rm bar/zzz &&
|
||||
git update-index --remove bar/zzz &&
|
||||
mkdir bar/zzz &&
|
||||
echo yyy > bar/zzz/yyy &&
|
||||
git update-index --add bar/zzz/yyy &&
|
||||
git commit -m "$name" &&
|
||||
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch3' || true
|
||||
test_must_fail git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch3' || true
|
||||
|
||||
|
||||
name='detect node change from directory to file #2'
|
||||
test_expect_success "$name" '
|
||||
rm -f "$GIT_DIR"/index &&
|
||||
git checkout -f -b mybranch4 remotes/git-svn &&
|
||||
git checkout -f -b mybranch4 ${remotes_git_svn} &&
|
||||
rm -rf dir &&
|
||||
git update-index --remove -- dir/file &&
|
||||
touch dir &&
|
||||
echo asdf > dir &&
|
||||
git update-index --add -- dir &&
|
||||
git commit -m "$name" &&
|
||||
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch4' || true
|
||||
test_must_fail git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch4' || true
|
||||
|
||||
|
||||
name='remove executable bit from a file'
|
||||
test_expect_success "$name" '
|
||||
rm -f "$GIT_DIR"/index &&
|
||||
git checkout -f -b mybranch5 remotes/git-svn &&
|
||||
git checkout -f -b mybranch5 ${remotes_git_svn} &&
|
||||
chmod -x exec.sh &&
|
||||
git update-index exec.sh &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch5 &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch5 &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test ! -x "$SVN_TREE"/exec.sh'
|
||||
|
||||
@@ -127,8 +127,8 @@ test_expect_success "$name" '
|
||||
chmod +x exec.sh &&
|
||||
git update-index exec.sh &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch5 &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch5 &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test -x "$SVN_TREE"/exec.sh'
|
||||
|
||||
@@ -139,8 +139,8 @@ test_expect_success "$name" '
|
||||
ln -s bar/zzz exec.sh &&
|
||||
git update-index exec.sh &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch5 &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch5 &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test -L "$SVN_TREE"/exec.sh'
|
||||
|
||||
@@ -151,8 +151,8 @@ test_expect_success "$name" '
|
||||
ln -s bar/zzz exec-2.sh &&
|
||||
git update-index --add bar/zzz exec-2.sh &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch5 &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch5 &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test -x "$SVN_TREE"/bar/zzz &&
|
||||
test -L "$SVN_TREE"/exec-2.sh'
|
||||
@@ -164,8 +164,8 @@ test_expect_success "$name" '
|
||||
cp help exec-2.sh &&
|
||||
git update-index exec-2.sh &&
|
||||
git commit -m "$name" &&
|
||||
git-svn set-tree --find-copies-harder --rmdir \
|
||||
remotes/git-svn..mybranch5 &&
|
||||
git svn set-tree --find-copies-harder --rmdir \
|
||||
${remotes_git_svn}..mybranch5 &&
|
||||
svn up "$SVN_TREE" &&
|
||||
test -f "$SVN_TREE"/exec-2.sh &&
|
||||
test ! -L "$SVN_TREE"/exec-2.sh &&
|
||||
@@ -180,7 +180,7 @@ then
|
||||
echo '# hello' >> exec-2.sh &&
|
||||
git update-index exec-2.sh &&
|
||||
git commit -m 'éï∏' &&
|
||||
git-svn set-tree HEAD"
|
||||
git svn set-tree HEAD"
|
||||
unset LC_ALL
|
||||
else
|
||||
say "UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)"
|
||||
@@ -190,8 +190,8 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
|
||||
GIT_SVN_ID=alt
|
||||
export GIT_SVN_ID
|
||||
test_expect_success "$name" \
|
||||
'git-svn init "$svnrepo" && git-svn fetch &&
|
||||
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
|
||||
'git svn init "$svnrepo" && git svn fetch &&
|
||||
git rev-list --pretty=raw ${remotes_git_svn} | grep ^tree | uniq > a &&
|
||||
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
|
||||
test_cmp a b'
|
||||
|
||||
@@ -215,45 +215,45 @@ test_expect_success "$name" "test_cmp a expected"
|
||||
|
||||
test_expect_success 'exit if remote refs are ambigious' "
|
||||
git config --add svn-remote.svn.fetch \
|
||||
bar:refs/remotes/git-svn &&
|
||||
test_must_fail git-svn migrate
|
||||
bar:refs/${remotes_git_svn} &&
|
||||
test_must_fail git svn migrate
|
||||
"
|
||||
|
||||
test_expect_success 'exit if init-ing a would clobber a URL' '
|
||||
svnadmin create "${PWD}/svnrepo2" &&
|
||||
svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
|
||||
git config --unset svn-remote.svn.fetch \
|
||||
"^bar:refs/remotes/git-svn$" &&
|
||||
test_must_fail git-svn init "${svnrepo}2/bar"
|
||||
"^bar:refs/${remotes_git_svn}$" &&
|
||||
test_must_fail git svn init "${svnrepo}2/bar"
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'init allows us to connect to another directory in the same repo' '
|
||||
git-svn init --minimize-url -i bar "$svnrepo/bar" &&
|
||||
git svn init --minimize-url -i bar "$svnrepo/bar" &&
|
||||
git config --get svn-remote.svn.fetch \
|
||||
"^bar:refs/remotes/bar$" &&
|
||||
git config --get svn-remote.svn.fetch \
|
||||
"^:refs/remotes/git-svn$"
|
||||
"^:refs/${remotes_git_svn}$"
|
||||
'
|
||||
|
||||
test_expect_success 'able to dcommit to a subdirectory' "
|
||||
git-svn fetch -i bar &&
|
||||
git svn fetch -i bar &&
|
||||
git checkout -b my-bar refs/remotes/bar &&
|
||||
echo abc > d &&
|
||||
git update-index --add d &&
|
||||
git commit -m '/bar/d should be in the log' &&
|
||||
git-svn dcommit -i bar &&
|
||||
git svn dcommit -i bar &&
|
||||
test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
|
||||
mkdir newdir &&
|
||||
echo new > newdir/dir &&
|
||||
git update-index --add newdir/dir &&
|
||||
git commit -m 'add a new directory' &&
|
||||
git-svn dcommit -i bar &&
|
||||
git svn dcommit -i bar &&
|
||||
test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
|
||||
echo foo >> newdir/dir &&
|
||||
git update-index newdir/dir &&
|
||||
git commit -m 'modify a file in new directory' &&
|
||||
git-svn dcommit -i bar &&
|
||||
git svn dcommit -i bar &&
|
||||
test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
|
||||
"
|
||||
|
||||
@@ -261,7 +261,7 @@ test_expect_success 'able to set-tree to a subdirectory' "
|
||||
echo cba > d &&
|
||||
git update-index d &&
|
||||
git commit -m 'update /bar/d' &&
|
||||
git-svn set-tree -i bar HEAD &&
|
||||
git svn set-tree -i bar HEAD &&
|
||||
test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
|
||||
"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2006 Eric Wong
|
||||
#
|
||||
|
||||
test_description='git-svn property tests'
|
||||
test_description='git svn property tests'
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
mkdir import
|
||||
@@ -26,29 +26,29 @@ cd import
|
||||
EOF
|
||||
|
||||
printf "Hello\r\nWorld\r\n" > crlf
|
||||
a_crlf=`git-hash-object -w crlf`
|
||||
a_crlf=`git hash-object -w crlf`
|
||||
printf "Hello\rWorld\r" > cr
|
||||
a_cr=`git-hash-object -w cr`
|
||||
a_cr=`git hash-object -w cr`
|
||||
printf "Hello\nWorld\n" > lf
|
||||
a_lf=`git-hash-object -w lf`
|
||||
a_lf=`git hash-object -w lf`
|
||||
|
||||
printf "Hello\r\nWorld" > ne_crlf
|
||||
a_ne_crlf=`git-hash-object -w ne_crlf`
|
||||
a_ne_crlf=`git hash-object -w ne_crlf`
|
||||
printf "Hello\nWorld" > ne_lf
|
||||
a_ne_lf=`git-hash-object -w ne_lf`
|
||||
a_ne_lf=`git hash-object -w ne_lf`
|
||||
printf "Hello\rWorld" > ne_cr
|
||||
a_ne_cr=`git-hash-object -w ne_cr`
|
||||
a_ne_cr=`git hash-object -w ne_cr`
|
||||
|
||||
touch empty
|
||||
a_empty=`git-hash-object -w empty`
|
||||
a_empty=`git hash-object -w empty`
|
||||
printf "\n" > empty_lf
|
||||
a_empty_lf=`git-hash-object -w empty_lf`
|
||||
a_empty_lf=`git hash-object -w empty_lf`
|
||||
printf "\r" > empty_cr
|
||||
a_empty_cr=`git-hash-object -w empty_cr`
|
||||
a_empty_cr=`git hash-object -w empty_cr`
|
||||
printf "\r\n" > empty_crlf
|
||||
a_empty_crlf=`git-hash-object -w empty_crlf`
|
||||
a_empty_crlf=`git hash-object -w empty_crlf`
|
||||
|
||||
svn import --no-auto-props -m 'import for git-svn' . "$svnrepo" >/dev/null
|
||||
svn import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
|
||||
cd ..
|
||||
|
||||
rm -rf import
|
||||
@@ -66,16 +66,16 @@ test_expect_success 'setup some commits to svn' \
|
||||
svn commit -m "Propset Id" &&
|
||||
cd ..'
|
||||
|
||||
test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"'
|
||||
test_expect_success 'fetch revisions from svn' 'git-svn fetch'
|
||||
test_expect_success 'initialize git svn' 'git svn init "$svnrepo"'
|
||||
test_expect_success 'fetch revisions from svn' 'git svn fetch'
|
||||
|
||||
name='test svn:keywords ignoring'
|
||||
test_expect_success "$name" \
|
||||
'git checkout -b mybranch remotes/git-svn &&
|
||||
'git checkout -b mybranch ${remotes_git_svn} &&
|
||||
echo Hi again >> kw.c &&
|
||||
git commit -a -m "test keywords ignoring" &&
|
||||
git-svn set-tree remotes/git-svn..mybranch &&
|
||||
git pull . remotes/git-svn'
|
||||
git svn set-tree ${remotes_git_svn}..mybranch &&
|
||||
git pull . ${remotes_git_svn}'
|
||||
|
||||
expect='/* $Id$ */'
|
||||
got="`sed -ne 2p kw.c`"
|
||||
@@ -90,8 +90,8 @@ test_expect_success "propset CR on crlf files" \
|
||||
cd ..'
|
||||
|
||||
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
|
||||
'git-svn fetch &&
|
||||
git pull . remotes/git-svn &&
|
||||
'git svn fetch &&
|
||||
git pull . ${remotes_git_svn} &&
|
||||
svn co "$svnrepo" new_wc'
|
||||
|
||||
for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
|
||||
@@ -103,8 +103,8 @@ done
|
||||
cd test_wc
|
||||
printf '$Id$\rHello\rWorld\r' > cr
|
||||
printf '$Id$\rHello\rWorld' > ne_cr
|
||||
a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git-hash-object --stdin`
|
||||
a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git-hash-object --stdin`
|
||||
a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin`
|
||||
a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin`
|
||||
test_expect_success 'Set CRLF on cr files' \
|
||||
'svn propset svn:eol-style CRLF cr &&
|
||||
svn propset svn:eol-style CRLF ne_cr &&
|
||||
@@ -113,10 +113,10 @@ cd test_wc
|
||||
svn commit -m "propset CRLF on cr files"'
|
||||
cd ..
|
||||
test_expect_success 'fetch and pull latest from svn' \
|
||||
'git-svn fetch && git pull . remotes/git-svn'
|
||||
'git svn fetch && git pull . ${remotes_git_svn}'
|
||||
|
||||
b_cr="`git-hash-object cr`"
|
||||
b_ne_cr="`git-hash-object ne_cr`"
|
||||
b_cr="`git hash-object cr`"
|
||||
b_ne_cr="`git hash-object ne_cr`"
|
||||
|
||||
test_expect_success 'CRLF + $Id$' "test '$a_cr' = '$b_cr'"
|
||||
test_expect_success 'CRLF + $Id$ (no newline)' "test '$a_ne_cr' = '$b_ne_cr'"
|
||||
@@ -145,7 +145,7 @@ test_expect_success 'test show-ignore' "
|
||||
svn propset -R svn:ignore 'no-such-file*' .
|
||||
svn commit -m 'propset svn:ignore'
|
||||
cd .. &&
|
||||
git-svn show-ignore > show-ignore.got &&
|
||||
git svn show-ignore > show-ignore.got &&
|
||||
cmp show-ignore.expect show-ignore.got
|
||||
"
|
||||
|
||||
@@ -161,8 +161,8 @@ cat >create-ignore-index.expect <<\EOF
|
||||
EOF
|
||||
|
||||
test_expect_success 'test create-ignore' "
|
||||
git-svn fetch && git pull . remotes/git-svn &&
|
||||
git-svn create-ignore &&
|
||||
git svn fetch && git pull . ${remotes_git_svn} &&
|
||||
git svn create-ignore &&
|
||||
cmp ./.gitignore create-ignore.expect &&
|
||||
cmp ./deeply/.gitignore create-ignore.expect &&
|
||||
cmp ./deeply/nested/.gitignore create-ignore.expect &&
|
||||
@@ -182,15 +182,15 @@ EOF
|
||||
# pattern, it can pass even though the propget did not execute on the
|
||||
# right directory.
|
||||
test_expect_success 'test propget' "
|
||||
git-svn propget svn:ignore . | cmp - prop.expect &&
|
||||
git svn propget svn:ignore . | cmp - prop.expect &&
|
||||
cd deeply &&
|
||||
git-svn propget svn:ignore . | cmp - ../prop.expect &&
|
||||
git-svn propget svn:entry:committed-rev nested/directory/.keep \
|
||||
git svn propget svn:ignore . | cmp - ../prop.expect &&
|
||||
git svn propget svn:entry:committed-rev nested/directory/.keep \
|
||||
| cmp - ../prop2.expect &&
|
||||
git-svn propget svn:ignore .. | cmp - ../prop.expect &&
|
||||
git-svn propget svn:ignore nested/ | cmp - ../prop.expect &&
|
||||
git-svn propget svn:ignore ./nested | cmp - ../prop.expect &&
|
||||
git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
|
||||
git svn propget svn:ignore .. | cmp - ../prop.expect &&
|
||||
git svn propget svn:ignore nested/ | cmp - ../prop.expect &&
|
||||
git svn propget svn:ignore ./nested | cmp - ../prop.expect &&
|
||||
git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
|
||||
"
|
||||
|
||||
cat >prop.expect <<\EOF
|
||||
@@ -210,8 +210,8 @@ Properties on 'nested/directory/.keep':
|
||||
EOF
|
||||
|
||||
test_expect_success 'test proplist' "
|
||||
git-svn proplist . | cmp - prop.expect &&
|
||||
git-svn proplist nested/directory/.keep | cmp - prop2.expect
|
||||
git svn proplist . | cmp - prop.expect &&
|
||||
git svn proplist nested/directory/.keep | cmp - prop2.expect
|
||||
"
|
||||
|
||||
test_done
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
test_description='git-svn rmdir'
|
||||
test_description='git svn rmdir'
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
test_expect_success 'initialize repo' '
|
||||
@@ -9,20 +9,20 @@ test_expect_success 'initialize repo' '
|
||||
mkdir -p deeply/nested/directory/number/2 &&
|
||||
echo foo > deeply/nested/directory/number/1/file &&
|
||||
echo foo > deeply/nested/directory/number/2/another &&
|
||||
svn import -m "import for git-svn" . "$svnrepo" &&
|
||||
svn import -m "import for git svn" . "$svnrepo" &&
|
||||
cd ..
|
||||
'
|
||||
|
||||
test_expect_success 'mirror via git-svn' '
|
||||
git-svn init "$svnrepo" &&
|
||||
git-svn fetch &&
|
||||
git checkout -f -b test-rmdir remotes/git-svn
|
||||
test_expect_success 'mirror via git svn' '
|
||||
git svn init "$svnrepo" &&
|
||||
git svn fetch &&
|
||||
git checkout -f -b test-rmdir ${remotes_git_svn}
|
||||
'
|
||||
|
||||
test_expect_success 'Try a commit on rmdir' '
|
||||
git rm -f deeply/nested/directory/number/2/another &&
|
||||
git commit -a -m "remove another" &&
|
||||
git-svn set-tree --rmdir HEAD &&
|
||||
git svn set-tree --rmdir HEAD &&
|
||||
svn ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1
|
||||
'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2007 Eric Wong
|
||||
#
|
||||
|
||||
test_description='git-svn tracking removed top-level path'
|
||||
test_description='git svn tracking removed top-level path'
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
test_expect_success 'make history for tracking' '
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2006 Eric Wong
|
||||
#
|
||||
|
||||
test_description='git-svn fetching'
|
||||
test_description='git svn fetching'
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
test_expect_success 'initialize repo' '
|
||||
@@ -27,8 +27,8 @@ test_expect_success 'initialize repo' '
|
||||
'
|
||||
|
||||
test_expect_success 'init and fetch a moved directory' '
|
||||
git-svn init --minimize-url -i thunk "$svnrepo"/thunk &&
|
||||
git-svn fetch -i thunk &&
|
||||
git svn init --minimize-url -i thunk "$svnrepo"/thunk &&
|
||||
git svn fetch -i thunk &&
|
||||
test "`git rev-parse --verify refs/remotes/thunk@2`" \
|
||||
= "`git rev-parse --verify refs/remotes/thunk~1`" &&
|
||||
test "`git cat-file blob refs/remotes/thunk:readme |\
|
||||
@@ -43,7 +43,7 @@ test_expect_success 'init and fetch from one svn-remote' '
|
||||
trunk:refs/remotes/svn/trunk &&
|
||||
git config --add svn-remote.svn.fetch \
|
||||
thunk:refs/remotes/svn/thunk &&
|
||||
git-svn fetch -i svn/thunk &&
|
||||
git svn fetch -i svn/thunk &&
|
||||
test "`git rev-parse --verify refs/remotes/svn/trunk`" \
|
||||
= "`git rev-parse --verify refs/remotes/svn/thunk~1`" &&
|
||||
test "`git cat-file blob refs/remotes/svn/thunk:readme |\
|
||||
@@ -57,8 +57,8 @@ test_expect_success 'follow deleted parent' '
|
||||
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
|
||||
git config --add svn-remote.svn.fetch \
|
||||
junk:refs/remotes/svn/junk &&
|
||||
git-svn fetch -i svn/thunk &&
|
||||
git-svn fetch -i svn/junk &&
|
||||
git svn fetch -i svn/thunk &&
|
||||
git svn fetch -i svn/junk &&
|
||||
test -z "`git diff svn/junk svn/trunk`" &&
|
||||
test "`git merge-base svn/junk svn/trunk`" \
|
||||
= "`git rev-parse svn/trunk`"
|
||||
@@ -69,9 +69,9 @@ test_expect_success 'follow larger parent' '
|
||||
echo hi > import/trunk/thunk/bump/thud/file &&
|
||||
svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
|
||||
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
|
||||
git-svn init --minimize-url -i larger \
|
||||
git svn init --minimize-url -i larger \
|
||||
"$svnrepo"/another-larger/trunk/thunk/bump/thud &&
|
||||
git-svn fetch -i larger &&
|
||||
git svn fetch -i larger &&
|
||||
git rev-parse --verify refs/remotes/larger &&
|
||||
git rev-parse --verify \
|
||||
refs/remotes/larger-parent/trunk/thunk/bump/thud &&
|
||||
@@ -92,15 +92,15 @@ test_expect_success 'follow higher-level parent' '
|
||||
cd ..
|
||||
svn mkdir -m "new glob at top level" "$svnrepo"/glob &&
|
||||
svn mv -m "move blob down a level" "$svnrepo"/blob "$svnrepo"/glob/blob &&
|
||||
git-svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
|
||||
git-svn fetch -i blob
|
||||
git svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
|
||||
git svn fetch -i blob
|
||||
'
|
||||
|
||||
test_expect_success 'follow deleted directory' '
|
||||
svn mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
|
||||
svn rm -m "remove glob" "$svnrepo"/glob &&
|
||||
git-svn init --minimize-url -i glob "$svnrepo"/glob &&
|
||||
git-svn fetch -i glob &&
|
||||
git svn init --minimize-url -i glob "$svnrepo"/glob &&
|
||||
git svn fetch -i glob &&
|
||||
test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
|
||||
test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1
|
||||
'
|
||||
@@ -129,9 +129,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
|
||||
poke native/t/c.t &&
|
||||
svn commit -m "reorg test" &&
|
||||
cd .. &&
|
||||
git-svn init --minimize-url -i r9270-t \
|
||||
git svn init --minimize-url -i r9270-t \
|
||||
"$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
|
||||
git-svn fetch -i r9270-t &&
|
||||
git svn fetch -i r9270-t &&
|
||||
test `git rev-list r9270-t | wc -l` -eq 2 &&
|
||||
test "`git ls-tree --name-only r9270-t~1`" = \
|
||||
"`git ls-tree --name-only r9270-t`"
|
||||
@@ -139,9 +139,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
|
||||
|
||||
test_expect_success "track initial change if it was only made to parent" '
|
||||
svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
|
||||
git-svn init --minimize-url -i r9270-d \
|
||||
git svn init --minimize-url -i r9270-d \
|
||||
"$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
|
||||
git-svn fetch -i r9270-d &&
|
||||
git svn fetch -i r9270-d &&
|
||||
test `git rev-list r9270-d | wc -l` -eq 3 &&
|
||||
test "`git ls-tree --name-only r9270-t`" = \
|
||||
"`git ls-tree --name-only r9270-d`" &&
|
||||
@@ -151,19 +151,19 @@ test_expect_success "track initial change if it was only made to parent" '
|
||||
|
||||
test_expect_success "track multi-parent paths" '
|
||||
svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
|
||||
git-svn multi-fetch &&
|
||||
git svn multi-fetch &&
|
||||
test `git cat-file commit refs/remotes/glob | \
|
||||
grep "^parent " | wc -l` -eq 2
|
||||
'
|
||||
|
||||
test_expect_success "multi-fetch continues to work" "
|
||||
git-svn multi-fetch
|
||||
git svn multi-fetch
|
||||
"
|
||||
|
||||
test_expect_success "multi-fetch works off a 'clean' repository" '
|
||||
rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" &&
|
||||
mkdir "$GIT_DIR/svn" &&
|
||||
git-svn multi-fetch
|
||||
git svn multi-fetch
|
||||
'
|
||||
|
||||
test_debug 'gitk --all &'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user