Compare commits
78 Commits
Author | SHA1 | Date | |
---|---|---|---|
fa1c8542cb | |||
b91779f17e | |||
9db41eba42 | |||
cb198b3b67 | |||
abf411e28d | |||
ec82874ad4 | |||
88fcc52e44 | |||
3017ed62f4 | |||
ada6a4117e | |||
3055d78f97 | |||
b1735b1ab7 | |||
f7e3bd37fb | |||
6838d1ad6b | |||
175659b4cc | |||
18a1d8953b | |||
40d675f417 | |||
b69fb7866b | |||
6b090e1710 | |||
5b57076e58 | |||
006f424b2d | |||
37ad7ca7db | |||
e0cbf12bf7 | |||
187b259dce | |||
c6d059bbcc | |||
7bf040c5bf | |||
aa78384156 | |||
af41867169 | |||
1a3e302a25 | |||
4b5f94cdde | |||
6aa6a92fb6 | |||
11cf80dc70 | |||
8577def6fc | |||
a59c87265b | |||
5605685a71 | |||
ded4dfd519 | |||
ae0a37cd6b | |||
d3334d9c44 | |||
fa8f1ca2a4 | |||
8828aa3418 | |||
5b02b9baf7 | |||
f34e9edc7b | |||
c4f4157ee8 | |||
9474a029d5 | |||
d43e90732b | |||
6f5185bd2d | |||
1462d1af69 | |||
dfc2dcd9ac | |||
0fdadc501e | |||
cf688cc273 | |||
3793a30901 | |||
1966d9f37b | |||
6cfc028641 | |||
2bcd9ec501 | |||
ffa1eeaeea | |||
729ec9e23a | |||
f39f72d8cf | |||
3cf8fe1d26 | |||
b2be2f6aea | |||
15431ca651 | |||
6f02a5a33a | |||
0b803a6cc6 | |||
3d5854e765 | |||
81536b2dfa | |||
e10dfb62ee | |||
ac58c4c795 | |||
c8525c302b | |||
f6ce1f2588 | |||
2d502e1f37 | |||
aae1f6acf1 | |||
cefd43b7f9 | |||
7b8c705188 | |||
71064a956b | |||
c50c4316e1 | |||
8837d33595 | |||
a1980c4efc | |||
3328acedc6 | |||
d48b284183 | |||
311e2ea006 |
20
Documentation/RelNotes/1.6.4.5.txt
Normal file
20
Documentation/RelNotes/1.6.4.5.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Git v1.6.4.5 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.6.4.4
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* Simplified base85 implementation.
|
||||||
|
|
||||||
|
* An overlong line after ".gitdir: " in a git file caused out of bounds
|
||||||
|
access to an array on the stack.
|
||||||
|
|
||||||
|
* "git count-objects" did not handle packs larger than 4G.
|
||||||
|
|
||||||
|
* "git rev-parse --parseopt --stop-at-non-option" did not stop at non option
|
||||||
|
when --keep-dashdash was in effect.
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
||||||
|
|
||||||
|
Other minor fixes and documentation updates are included.
|
18
Documentation/RelNotes/1.6.5.9.txt
Normal file
18
Documentation/RelNotes/1.6.5.9.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Git v1.6.5.9 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.6.5.8
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* An overlong line after ".gitdir: " in a git file caused out of bounds
|
||||||
|
access to an array on the stack.
|
||||||
|
|
||||||
|
* "git blame -L $start,$end" segfaulted when too large $start was given.
|
||||||
|
|
||||||
|
* "git rev-parse --parseopt --stop-at-non-option" did not stop at non option
|
||||||
|
when --keep-dashdash was in effect.
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
||||||
|
|
||||||
|
Other minor fixes and documentation updates are included.
|
23
Documentation/RelNotes/1.6.6.3.txt
Normal file
23
Documentation/RelNotes/1.6.6.3.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Git v1.6.6.3 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.6.6.2
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* An overlong line after ".gitdir: " in a git file caused out of bounds
|
||||||
|
access to an array on the stack.
|
||||||
|
|
||||||
|
* "git bisect $path" did not correctly diagnose an error when given a
|
||||||
|
non-existent path.
|
||||||
|
|
||||||
|
* "git blame -L $start,$end" segfaulted when too large $start was given.
|
||||||
|
|
||||||
|
* "git imap-send" did not write draft box with CRLF line endings per RFC.
|
||||||
|
|
||||||
|
* "git rev-parse --parseopt --stop-at-non-option" did not stop at non option
|
||||||
|
when --keep-dashdash was in effect.
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
||||||
|
|
||||||
|
Other minor fixes and documentation updates are included.
|
8
Documentation/RelNotes/1.7.0.9.txt
Normal file
8
Documentation/RelNotes/1.7.0.9.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Git v1.7.0.9 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.7.0.8
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
8
Documentation/RelNotes/1.7.1.4.txt
Normal file
8
Documentation/RelNotes/1.7.1.4.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Git v1.7.1.4 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.7.1.3
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
8
Documentation/RelNotes/1.7.2.5.txt
Normal file
8
Documentation/RelNotes/1.7.2.5.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Git v1.7.2.5 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.7.2.4
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
45
Documentation/RelNotes/1.7.3.4.txt
Normal file
45
Documentation/RelNotes/1.7.3.4.txt
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
Git v1.7.3.4 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.7.3.3
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* Smart HTTP transport used to incorrectly retry redirected POST
|
||||||
|
request with GET request.
|
||||||
|
|
||||||
|
* "git apply" did not correctly handle patches that only change modes
|
||||||
|
if told to apply while stripping leading paths with -p option.
|
||||||
|
|
||||||
|
* "git apply" can deal with patches with timezone formatted with a
|
||||||
|
colon between the hours and minutes part (e.g. "-08:00" instead of
|
||||||
|
"-0800").
|
||||||
|
|
||||||
|
* "git checkout" removed an untracked file "foo" from the working
|
||||||
|
tree when switching to a branch that contains a tracked path
|
||||||
|
"foo/bar". Prevent this, just like the case where the conflicting
|
||||||
|
path were "foo" (c752e7f..7980872d).
|
||||||
|
|
||||||
|
* "git cherry-pick" or "git revert" refused to work when a path that
|
||||||
|
would be modified by the operation was stat-dirty without a real
|
||||||
|
difference in the contents of the file.
|
||||||
|
|
||||||
|
* "git diff --check" reported an incorrect line number for added
|
||||||
|
blank lines at the end of file.
|
||||||
|
|
||||||
|
* "git imap-send" failed to build under NO_OPENSSL.
|
||||||
|
|
||||||
|
* Setting log.decorate configuration variable to "0" or "1" to mean
|
||||||
|
"false" or "true" did not work.
|
||||||
|
|
||||||
|
* "git push" over dumb HTTP protocol did not work against WebDAV
|
||||||
|
servers that did not terminate a collection name with a slash.
|
||||||
|
|
||||||
|
* "git tag -v" did not work with GPG signatures in rfc1991 mode.
|
||||||
|
|
||||||
|
* The post-receive-email sample hook was accidentally broken in 1.7.3.3
|
||||||
|
update.
|
||||||
|
|
||||||
|
* "gitweb" can sometimes be tricked into parrotting a filename argument
|
||||||
|
given in a request without properly quoting.
|
||||||
|
|
||||||
|
Other minor fixes and documentation updates are also included.
|
@ -98,8 +98,9 @@ include::merge-options.txt[]
|
|||||||
fetched, the rebase uses that information to avoid rebasing
|
fetched, the rebase uses that information to avoid rebasing
|
||||||
non-local changes.
|
non-local changes.
|
||||||
+
|
+
|
||||||
See `branch.<name>.rebase` in linkgit:git-config[1] if you want to make
|
See `branch.<name>.rebase` and `branch.autosetuprebase` in
|
||||||
`git pull` always use `{litdd}rebase` instead of merging.
|
linkgit:git-config[1] if you want to make `git pull` always use
|
||||||
|
`{litdd}rebase` instead of merging.
|
||||||
+
|
+
|
||||||
[NOTE]
|
[NOTE]
|
||||||
This is a potentially _dangerous_ mode of operation.
|
This is a potentially _dangerous_ mode of operation.
|
||||||
|
@ -89,8 +89,8 @@ the paths that have disappeared from the filesystem. However,
|
|||||||
depending on the use case, there are several ways that can be
|
depending on the use case, there are several ways that can be
|
||||||
done.
|
done.
|
||||||
|
|
||||||
Using "git commit -a"
|
Using ``git commit -a''
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
If you intend that your next commit should record all modifications
|
If you intend that your next commit should record all modifications
|
||||||
of tracked files in the working tree and record all removals of
|
of tracked files in the working tree and record all removals of
|
||||||
files that have been removed from the working tree with `rm`
|
files that have been removed from the working tree with `rm`
|
||||||
@ -98,8 +98,8 @@ files that have been removed from the working tree with `rm`
|
|||||||
automatically notice and record all removals. You can also have a
|
automatically notice and record all removals. You can also have a
|
||||||
similar effect without committing by using `git add -u`.
|
similar effect without committing by using `git add -u`.
|
||||||
|
|
||||||
Using "git add -A"
|
Using ``git add -A''
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
When accepting a new code drop for a vendor branch, you probably
|
When accepting a new code drop for a vendor branch, you probably
|
||||||
want to record both the removal of paths and additions of new paths
|
want to record both the removal of paths and additions of new paths
|
||||||
as well as modifications of existing paths.
|
as well as modifications of existing paths.
|
||||||
@ -111,8 +111,8 @@ tree using this command:
|
|||||||
git ls-files -z | xargs -0 rm -f
|
git ls-files -z | xargs -0 rm -f
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
and then "untar" the new code in the working tree. Alternately
|
and then untar the new code in the working tree. Alternately
|
||||||
you could "rsync" the changes into the working tree.
|
you could 'rsync' the changes into the working tree.
|
||||||
|
|
||||||
After that, the easiest way to record all removals, additions, and
|
After that, the easiest way to record all removals, additions, and
|
||||||
modifications in the working tree is:
|
modifications in the working tree is:
|
||||||
|
@ -292,6 +292,9 @@ have been specified, in which case default to 'compose'.
|
|||||||
Default is the value of 'sendemail.validate'; if this is not set,
|
Default is the value of 'sendemail.validate'; if this is not set,
|
||||||
default to '--validate'.
|
default to '--validate'.
|
||||||
|
|
||||||
|
--force::
|
||||||
|
Send emails even if safety checks would prevent it.
|
||||||
|
|
||||||
|
|
||||||
CONFIGURATION
|
CONFIGURATION
|
||||||
-------------
|
-------------
|
||||||
|
@ -14,11 +14,8 @@ DESCRIPTION
|
|||||||
|
|
||||||
A `gitignore` file specifies intentionally untracked files that
|
A `gitignore` file specifies intentionally untracked files that
|
||||||
git should ignore.
|
git should ignore.
|
||||||
Note that all the `gitignore` files really concern only files
|
Files already tracked by git are not affected; see the NOTES
|
||||||
that are not already tracked by git;
|
below for details.
|
||||||
in order to ignore uncommitted changes in already tracked files,
|
|
||||||
please refer to the 'git update-index --assume-unchanged'
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
Each line in a `gitignore` file specifies a pattern.
|
Each line in a `gitignore` file specifies a pattern.
|
||||||
When deciding whether to ignore a path, git normally checks
|
When deciding whether to ignore a path, git normally checks
|
||||||
@ -62,7 +59,8 @@ files specified by command-line options. Higher-level git
|
|||||||
tools, such as 'git status' and 'git add',
|
tools, such as 'git status' and 'git add',
|
||||||
use patterns from the sources specified above.
|
use patterns from the sources specified above.
|
||||||
|
|
||||||
Patterns have the following format:
|
PATTERN FORMAT
|
||||||
|
--------------
|
||||||
|
|
||||||
- A blank line matches no files, so it can serve as a separator
|
- A blank line matches no files, so it can serve as a separator
|
||||||
for readability.
|
for readability.
|
||||||
@ -98,7 +96,20 @@ Patterns have the following format:
|
|||||||
For example, "/{asterisk}.c" matches "cat-file.c" but not
|
For example, "/{asterisk}.c" matches "cat-file.c" but not
|
||||||
"mozilla-sha1/sha1.c".
|
"mozilla-sha1/sha1.c".
|
||||||
|
|
||||||
An example:
|
NOTES
|
||||||
|
-----
|
||||||
|
|
||||||
|
The purpose of gitignore files is to ensure that certain files
|
||||||
|
not tracked by git remain untracked.
|
||||||
|
|
||||||
|
To ignore uncommitted changes in a file that is already tracked,
|
||||||
|
use 'git update-index {litdd}assume-unchanged'.
|
||||||
|
|
||||||
|
To stop tracking a file that is currently tracked, use
|
||||||
|
'git rm --cached'.
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
$ git status
|
$ git status
|
||||||
@ -140,6 +151,11 @@ Another example:
|
|||||||
The second .gitignore prevents git from ignoring
|
The second .gitignore prevents git from ignoring
|
||||||
`arch/foo/kernel/vmlinux.lds.S`.
|
`arch/foo/kernel/vmlinux.lds.S`.
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
linkgit:git-rm[1], linkgit:git-update-index[1],
|
||||||
|
linkgit:gitrepository-layout[5]
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
Documentation by David Greaves, Junio C Hamano, Josh Triplett,
|
Documentation by David Greaves, Junio C Hamano, Josh Triplett,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
GVF=GIT-VERSION-FILE
|
GVF=GIT-VERSION-FILE
|
||||||
DEF_VER=v1.7.3.3
|
DEF_VER=v1.7.3.4
|
||||||
|
|
||||||
LF='
|
LF='
|
||||||
'
|
'
|
||||||
|
8
INSTALL
8
INSTALL
@ -67,10 +67,10 @@ Issues of note:
|
|||||||
- A POSIX-compliant shell is required to run many scripts needed
|
- A POSIX-compliant shell is required to run many scripts needed
|
||||||
for everyday use (e.g. "bisect", "pull").
|
for everyday use (e.g. "bisect", "pull").
|
||||||
|
|
||||||
- "Perl" is needed to use some of the features (e.g. preparing a
|
- "Perl" version 5.8 or later is needed to use some of the
|
||||||
partial commit using "git add -i/-p", interacting with svn
|
features (e.g. preparing a partial commit using "git add -i/-p",
|
||||||
repositories with "git svn"). If you can live without these, use
|
interacting with svn repositories with "git svn"). If you can
|
||||||
NO_PERL.
|
live without these, use NO_PERL.
|
||||||
|
|
||||||
- "openssl" library is used by git-imap-send to use IMAP over SSL.
|
- "openssl" library is used by git-imap-send to use IMAP over SSL.
|
||||||
If you don't need it, use NO_OPENSSL.
|
If you don't need it, use NO_OPENSSL.
|
||||||
|
6
Makefile
6
Makefile
@ -1262,11 +1262,15 @@ else
|
|||||||
BLK_SHA1 = 1
|
BLK_SHA1 = 1
|
||||||
OPENSSL_LIBSSL =
|
OPENSSL_LIBSSL =
|
||||||
endif
|
endif
|
||||||
|
ifdef NO_OPENSSL
|
||||||
|
LIB_4_CRYPTO =
|
||||||
|
else
|
||||||
ifdef NEEDS_SSL_WITH_CRYPTO
|
ifdef NEEDS_SSL_WITH_CRYPTO
|
||||||
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
|
||||||
else
|
else
|
||||||
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ifdef NEEDS_LIBICONV
|
ifdef NEEDS_LIBICONV
|
||||||
ifdef ICONVDIR
|
ifdef ICONVDIR
|
||||||
BASIC_CFLAGS += -I$(ICONVDIR)/include
|
BASIC_CFLAGS += -I$(ICONVDIR)/include
|
||||||
@ -1879,7 +1883,7 @@ builtin/tar-tree.o archive-tar.o: tar.h
|
|||||||
builtin/pack-objects.o: thread-utils.h
|
builtin/pack-objects.o: thread-utils.h
|
||||||
connect.o transport.o http-backend.o: url.h
|
connect.o transport.o http-backend.o: url.h
|
||||||
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
|
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
|
||||||
http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h
|
http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
|
||||||
|
|
||||||
xdiff-interface.o $(XDIFF_OBJS): \
|
xdiff-interface.o $(XDIFF_OBJS): \
|
||||||
xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
|
xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
|
||||||
|
2
RelNotes
2
RelNotes
@ -1 +1 @@
|
|||||||
Documentation/RelNotes/1.7.3.3.txt
|
Documentation/RelNotes/1.7.3.4.txt
|
@ -449,7 +449,7 @@ static char *find_name_gnu(const char *line, char *def, int p_value)
|
|||||||
return squash_slash(strbuf_detach(&name, NULL));
|
return squash_slash(strbuf_detach(&name, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t tz_len(const char *line, size_t len)
|
static size_t sane_tz_len(const char *line, size_t len)
|
||||||
{
|
{
|
||||||
const char *tz, *p;
|
const char *tz, *p;
|
||||||
|
|
||||||
@ -467,6 +467,24 @@ static size_t tz_len(const char *line, size_t len)
|
|||||||
return line + len - tz;
|
return line + len - tz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t tz_with_colon_len(const char *line, size_t len)
|
||||||
|
{
|
||||||
|
const char *tz, *p;
|
||||||
|
|
||||||
|
if (len < strlen(" +08:00") || line[len - strlen(":00")] != ':')
|
||||||
|
return 0;
|
||||||
|
tz = line + len - strlen(" +08:00");
|
||||||
|
|
||||||
|
if (tz[0] != ' ' || (tz[1] != '+' && tz[1] != '-'))
|
||||||
|
return 0;
|
||||||
|
p = tz + 2;
|
||||||
|
if (!isdigit(*p++) || !isdigit(*p++) || *p++ != ':' ||
|
||||||
|
!isdigit(*p++) || !isdigit(*p++))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return line + len - tz;
|
||||||
|
}
|
||||||
|
|
||||||
static size_t date_len(const char *line, size_t len)
|
static size_t date_len(const char *line, size_t len)
|
||||||
{
|
{
|
||||||
const char *date, *p;
|
const char *date, *p;
|
||||||
@ -561,7 +579,9 @@ static size_t diff_timestamp_len(const char *line, size_t len)
|
|||||||
if (!isdigit(end[-1]))
|
if (!isdigit(end[-1]))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
n = tz_len(line, end - line);
|
n = sane_tz_len(line, end - line);
|
||||||
|
if (!n)
|
||||||
|
n = tz_with_colon_len(line, end - line);
|
||||||
end -= n;
|
end -= n;
|
||||||
|
|
||||||
n = short_time_len(line, end - line);
|
n = short_time_len(line, end - line);
|
||||||
@ -733,8 +753,8 @@ static int has_epoch_timestamp(const char *nameline)
|
|||||||
" "
|
" "
|
||||||
"[0-2][0-9]:[0-5][0-9]:00(\\.0+)?"
|
"[0-2][0-9]:[0-5][0-9]:00(\\.0+)?"
|
||||||
" "
|
" "
|
||||||
"([-+][0-2][0-9][0-5][0-9])\n";
|
"([-+][0-2][0-9]:?[0-5][0-9])\n";
|
||||||
const char *timestamp = NULL, *cp;
|
const char *timestamp = NULL, *cp, *colon;
|
||||||
static regex_t *stamp;
|
static regex_t *stamp;
|
||||||
regmatch_t m[10];
|
regmatch_t m[10];
|
||||||
int zoneoffset;
|
int zoneoffset;
|
||||||
@ -764,8 +784,11 @@ static int has_epoch_timestamp(const char *nameline)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneoffset = strtol(timestamp + m[3].rm_so + 1, NULL, 10);
|
zoneoffset = strtol(timestamp + m[3].rm_so + 1, (char **) &colon, 10);
|
||||||
zoneoffset = (zoneoffset / 100) * 60 + (zoneoffset % 100);
|
if (*colon == ':')
|
||||||
|
zoneoffset = zoneoffset * 60 + strtol(colon + 1, NULL, 10);
|
||||||
|
else
|
||||||
|
zoneoffset = (zoneoffset / 100) * 60 + (zoneoffset % 100);
|
||||||
if (timestamp[m[3].rm_so] == '-')
|
if (timestamp[m[3].rm_so] == '-')
|
||||||
zoneoffset = -zoneoffset;
|
zoneoffset = -zoneoffset;
|
||||||
|
|
||||||
@ -919,28 +942,28 @@ static int gitdiff_newfile(const char *line, struct patch *patch)
|
|||||||
static int gitdiff_copysrc(const char *line, struct patch *patch)
|
static int gitdiff_copysrc(const char *line, struct patch *patch)
|
||||||
{
|
{
|
||||||
patch->is_copy = 1;
|
patch->is_copy = 1;
|
||||||
patch->old_name = find_name(line, NULL, 0, 0);
|
patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gitdiff_copydst(const char *line, struct patch *patch)
|
static int gitdiff_copydst(const char *line, struct patch *patch)
|
||||||
{
|
{
|
||||||
patch->is_copy = 1;
|
patch->is_copy = 1;
|
||||||
patch->new_name = find_name(line, NULL, 0, 0);
|
patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gitdiff_renamesrc(const char *line, struct patch *patch)
|
static int gitdiff_renamesrc(const char *line, struct patch *patch)
|
||||||
{
|
{
|
||||||
patch->is_rename = 1;
|
patch->is_rename = 1;
|
||||||
patch->old_name = find_name(line, NULL, 0, 0);
|
patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gitdiff_renamedst(const char *line, struct patch *patch)
|
static int gitdiff_renamedst(const char *line, struct patch *patch)
|
||||||
{
|
{
|
||||||
patch->is_rename = 1;
|
patch->is_rename = 1;
|
||||||
patch->new_name = find_name(line, NULL, 0, 0);
|
patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,7 +1048,7 @@ static char *git_header_name(char *line, int llen)
|
|||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *second = NULL;
|
const char *second = NULL;
|
||||||
size_t len;
|
size_t len, line_len;
|
||||||
|
|
||||||
line += strlen("diff --git ");
|
line += strlen("diff --git ");
|
||||||
llen -= strlen("diff --git ");
|
llen -= strlen("diff --git ");
|
||||||
@ -1125,6 +1148,10 @@ static char *git_header_name(char *line, int llen)
|
|||||||
* Accept a name only if it shows up twice, exactly the same
|
* Accept a name only if it shows up twice, exactly the same
|
||||||
* form.
|
* form.
|
||||||
*/
|
*/
|
||||||
|
second = strchr(name, '\n');
|
||||||
|
if (!second)
|
||||||
|
return NULL;
|
||||||
|
line_len = second - name;
|
||||||
for (len = 0 ; ; len++) {
|
for (len = 0 ; ; len++) {
|
||||||
switch (name[len]) {
|
switch (name[len]) {
|
||||||
default:
|
default:
|
||||||
@ -1132,15 +1159,11 @@ static char *git_header_name(char *line, int llen)
|
|||||||
case '\n':
|
case '\n':
|
||||||
return NULL;
|
return NULL;
|
||||||
case '\t': case ' ':
|
case '\t': case ' ':
|
||||||
second = name+len;
|
second = stop_at_slash(name + len, line_len - len);
|
||||||
for (;;) {
|
if (!second)
|
||||||
char c = *second++;
|
return NULL;
|
||||||
if (c == '\n')
|
second++;
|
||||||
return NULL;
|
if (second[len] == '\n' && !strncmp(name, second, len)) {
|
||||||
if (c == '/')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (second[len] == '\n' && !memcmp(name, second, len)) {
|
|
||||||
return xmemdupz(name, len);
|
return xmemdupz(name, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1298,9 +1298,23 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
|||||||
read_lock();
|
read_lock();
|
||||||
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
||||||
read_unlock();
|
read_unlock();
|
||||||
if (!src->data)
|
if (!src->data) {
|
||||||
|
if (src_entry->preferred_base) {
|
||||||
|
static int warned = 0;
|
||||||
|
if (!warned++)
|
||||||
|
warning("object %s cannot be read",
|
||||||
|
sha1_to_hex(src_entry->idx.sha1));
|
||||||
|
/*
|
||||||
|
* Those objects are not included in the
|
||||||
|
* resulting pack. Be resilient and ignore
|
||||||
|
* them if they can't be read, in case the
|
||||||
|
* pack could be created nevertheless.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
die("object %s cannot be read",
|
die("object %s cannot be read",
|
||||||
sha1_to_hex(src_entry->idx.sha1));
|
sha1_to_hex(src_entry->idx.sha1));
|
||||||
|
}
|
||||||
if (sz != src_size)
|
if (sz != src_size)
|
||||||
die("object %s inconsistent object length (%lu vs %lu)",
|
die("object %s inconsistent object length (%lu vs %lu)",
|
||||||
sha1_to_hex(src_entry->idx.sha1), sz, src_size);
|
sha1_to_hex(src_entry->idx.sha1), sz, src_size);
|
||||||
|
@ -547,6 +547,21 @@ static void prepare_revs(struct rev_info *revs)
|
|||||||
die("empty commit set passed");
|
die("empty commit set passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void read_and_refresh_cache(const char *me)
|
||||||
|
{
|
||||||
|
static struct lock_file index_lock;
|
||||||
|
int index_fd = hold_locked_index(&index_lock, 0);
|
||||||
|
if (read_index_preload(&the_index, NULL) < 0)
|
||||||
|
die("git %s: failed to read the index", me);
|
||||||
|
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
|
||||||
|
if (the_index.cache_changed) {
|
||||||
|
if (write_index(&the_index, index_fd) ||
|
||||||
|
commit_locked_index(&index_lock))
|
||||||
|
die("git %s: failed to refresh the index", me);
|
||||||
|
}
|
||||||
|
rollback_lock_file(&index_lock);
|
||||||
|
}
|
||||||
|
|
||||||
static int revert_or_cherry_pick(int argc, const char **argv)
|
static int revert_or_cherry_pick(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
@ -567,8 +582,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
|
|||||||
die("cherry-pick --ff cannot be used with --edit");
|
die("cherry-pick --ff cannot be used with --edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read_cache() < 0)
|
read_and_refresh_cache(me);
|
||||||
die("git %s: failed to read the index", me);
|
|
||||||
|
|
||||||
prepare_revs(&revs);
|
prepare_revs(&revs);
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ struct tag_filter {
|
|||||||
struct commit_list *with_commit;
|
struct commit_list *with_commit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
|
||||||
|
|
||||||
static int show_reference(const char *refname, const unsigned char *sha1,
|
static int show_reference(const char *refname, const unsigned char *sha1,
|
||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
@ -70,9 +68,9 @@ static int show_reference(const char *refname, const unsigned char *sha1,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* only take up to "lines" lines, and strip the signature */
|
/* only take up to "lines" lines, and strip the signature */
|
||||||
|
size = parse_signature(buf, size);
|
||||||
for (i = 0, sp += 2;
|
for (i = 0, sp += 2;
|
||||||
i < filter->lines && sp < buf + size &&
|
i < filter->lines && sp < buf + size;
|
||||||
prefixcmp(sp, PGP_SIGNATURE "\n");
|
|
||||||
i++) {
|
i++) {
|
||||||
if (i)
|
if (i)
|
||||||
printf("\n ");
|
printf("\n ");
|
||||||
@ -242,8 +240,7 @@ static void write_tag_body(int fd, const unsigned char *sha1)
|
|||||||
{
|
{
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
char *buf, *sp, *eob;
|
char *buf, *sp;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
buf = read_sha1_file(sha1, &type, &size);
|
buf = read_sha1_file(sha1, &type, &size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
@ -256,12 +253,7 @@ static void write_tag_body(int fd, const unsigned char *sha1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sp += 2; /* skip the 2 LFs */
|
sp += 2; /* skip the 2 LFs */
|
||||||
eob = strstr(sp, "\n" PGP_SIGNATURE "\n");
|
write_or_die(fd, sp, parse_signature(sp, buf + size - sp));
|
||||||
if (eob)
|
|
||||||
len = eob - sp;
|
|
||||||
else
|
|
||||||
len = buf + size - sp;
|
|
||||||
write_or_die(fd, sp, len);
|
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,11 @@ static const char * const verify_tag_usage[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
|
||||||
|
|
||||||
static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
|
static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
|
||||||
{
|
{
|
||||||
struct child_process gpg;
|
struct child_process gpg;
|
||||||
const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL};
|
const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL};
|
||||||
char path[PATH_MAX], *eol;
|
char path[PATH_MAX];
|
||||||
size_t len;
|
size_t len;
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
@ -37,11 +35,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
/* find the length without signature */
|
/* find the length without signature */
|
||||||
len = 0;
|
len = parse_signature(buf, size);
|
||||||
while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {
|
|
||||||
eol = memchr(buf + len, '\n', size - len);
|
|
||||||
len += eol ? eol - (buf + len) + 1 : size - len;
|
|
||||||
}
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
write_in_full(1, buf, len);
|
write_in_full(1, buf, len);
|
||||||
|
|
||||||
|
2
cache.h
2
cache.h
@ -859,7 +859,7 @@ struct cache_def {
|
|||||||
|
|
||||||
extern int has_symlink_leading_path(const char *name, int len);
|
extern int has_symlink_leading_path(const char *name, int len);
|
||||||
extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
|
extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
|
||||||
extern int has_symlink_or_noent_leading_path(const char *name, int len);
|
extern int check_leading_path(const char *name, int len);
|
||||||
extern int has_dirs_only_path(const char *name, int len, int prefix_len);
|
extern int has_dirs_only_path(const char *name, int len, int prefix_len);
|
||||||
extern void schedule_dir_for_removal(const char *name, int len);
|
extern void schedule_dir_for_removal(const char *name, int len);
|
||||||
extern void remove_scheduled_dirs(void);
|
extern void remove_scheduled_dirs(void);
|
||||||
|
16
config.c
16
config.c
@ -410,7 +410,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_config_maybe_bool(const char *name, const char *value)
|
static int git_config_maybe_bool_text(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
if (!value)
|
if (!value)
|
||||||
return 1;
|
return 1;
|
||||||
@ -427,9 +427,21 @@ int git_config_maybe_bool(const char *name, const char *value)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int git_config_maybe_bool(const char *name, const char *value)
|
||||||
|
{
|
||||||
|
int v = git_config_maybe_bool_text(name, value);
|
||||||
|
if (0 <= v)
|
||||||
|
return v;
|
||||||
|
if (!strcmp(value, "0"))
|
||||||
|
return 0;
|
||||||
|
if (!strcmp(value, "1"))
|
||||||
|
return 1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
|
int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
|
||||||
{
|
{
|
||||||
int v = git_config_maybe_bool(name, value);
|
int v = git_config_maybe_bool_text(name, value);
|
||||||
if (0 <= v) {
|
if (0 <= v) {
|
||||||
*is_bool = 1;
|
*is_bool = 1;
|
||||||
return v;
|
return v;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
# This tool is copyright (c) 2005, Matthias Urlichs.
|
# This tool is copyright (c) 2005, Matthias Urlichs.
|
||||||
# It is released under the Gnu Public License, version 2.
|
# It is released under the Gnu Public License, version 2.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
|
# Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
|
||||||
#
|
#
|
||||||
@ -140,6 +140,7 @@ by whitespace or other characters.
|
|||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
use integer;
|
use integer;
|
||||||
my $crlfmode = 0;
|
my $crlfmode = 0;
|
||||||
my @revs;
|
my @revs;
|
||||||
|
@ -144,13 +144,13 @@ prep_for_email()
|
|||||||
short_refname=${refname##refs/remotes/}
|
short_refname=${refname##refs/remotes/}
|
||||||
echo >&2 "*** Push-update of tracking branch, $refname"
|
echo >&2 "*** Push-update of tracking branch, $refname"
|
||||||
echo >&2 "*** - no email generated."
|
echo >&2 "*** - no email generated."
|
||||||
exit 0
|
return 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Anything else (is there anything else?)
|
# Anything else (is there anything else?)
|
||||||
echo >&2 "*** Unknown type of update to $refname ($rev_type)"
|
echo >&2 "*** Unknown type of update to $refname ($rev_type)"
|
||||||
echo >&2 "*** - no email generated"
|
echo >&2 "*** - no email generated"
|
||||||
return 0
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -166,10 +166,10 @@ prep_for_email()
|
|||||||
esac
|
esac
|
||||||
echo >&2 "*** $config_name is not set so no email will be sent"
|
echo >&2 "*** $config_name is not set so no email will be sent"
|
||||||
echo >&2 "*** for $refname update $oldrev->$newrev"
|
echo >&2 "*** for $refname update $oldrev->$newrev"
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
10
diff.c
10
diff.c
@ -2158,7 +2158,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
|
|||||||
|
|
||||||
ecbdata.ws_rule = data.ws_rule;
|
ecbdata.ws_rule = data.ws_rule;
|
||||||
check_blank_at_eof(&mf1, &mf2, &ecbdata);
|
check_blank_at_eof(&mf1, &mf2, &ecbdata);
|
||||||
blank_at_eof = ecbdata.blank_at_eof_in_preimage;
|
blank_at_eof = ecbdata.blank_at_eof_in_postimage;
|
||||||
|
|
||||||
if (blank_at_eof) {
|
if (blank_at_eof) {
|
||||||
static char *err;
|
static char *err;
|
||||||
@ -2391,10 +2391,14 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
if (size_only)
|
if (size_only) {
|
||||||
type = sha1_object_info(s->sha1, &s->size);
|
type = sha1_object_info(s->sha1, &s->size);
|
||||||
else {
|
if (type < 0)
|
||||||
|
die("unable to read %s", sha1_to_hex(s->sha1));
|
||||||
|
} else {
|
||||||
s->data = read_sha1_file(s->sha1, &type, &s->size);
|
s->data = read_sha1_file(s->sha1, &type, &s->size);
|
||||||
|
if (!s->data)
|
||||||
|
die("unable to read %s", sha1_to_hex(s->sha1));
|
||||||
s->should_free = 1;
|
s->should_free = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
entry.c
16
entry.c
@ -106,14 +106,14 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
|
|||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
new = read_blob_entry(ce, &size);
|
new = read_blob_entry(ce, &size);
|
||||||
if (!new)
|
if (!new)
|
||||||
return error("git checkout-index: unable to read sha1 file of %s (%s)",
|
return error("unable to read sha1 file of %s (%s)",
|
||||||
path, sha1_to_hex(ce->sha1));
|
path, sha1_to_hex(ce->sha1));
|
||||||
|
|
||||||
if (ce_mode_s_ifmt == S_IFLNK && has_symlinks && !to_tempfile) {
|
if (ce_mode_s_ifmt == S_IFLNK && has_symlinks && !to_tempfile) {
|
||||||
ret = symlink(new, path);
|
ret = symlink(new, path);
|
||||||
free(new);
|
free(new);
|
||||||
if (ret)
|
if (ret)
|
||||||
return error("git checkout-index: unable to create symlink %s (%s)",
|
return error("unable to create symlink %s (%s)",
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
|
|||||||
}
|
}
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
free(new);
|
free(new);
|
||||||
return error("git checkout-index: unable to create file %s (%s)",
|
return error("unable to create file %s (%s)",
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,16 +155,16 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
|
|||||||
close(fd);
|
close(fd);
|
||||||
free(new);
|
free(new);
|
||||||
if (wrote != size)
|
if (wrote != size)
|
||||||
return error("git checkout-index: unable to write file %s", path);
|
return error("unable to write file %s", path);
|
||||||
break;
|
break;
|
||||||
case S_IFGITLINK:
|
case S_IFGITLINK:
|
||||||
if (to_tempfile)
|
if (to_tempfile)
|
||||||
return error("git checkout-index: cannot create temporary subproject %s", path);
|
return error("cannot create temporary subproject %s", path);
|
||||||
if (mkdir(path, 0777) < 0)
|
if (mkdir(path, 0777) < 0)
|
||||||
return error("git checkout-index: cannot create subproject directory %s", path);
|
return error("cannot create subproject directory %s", path);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return error("git checkout-index: unknown file mode for %s", path);
|
return error("unknown file mode for %s in index", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->refresh_cache) {
|
if (state->refresh_cache) {
|
||||||
@ -211,7 +211,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
|
|||||||
return 0;
|
return 0;
|
||||||
if (!state->force) {
|
if (!state->force) {
|
||||||
if (!state->quiet)
|
if (!state->quiet)
|
||||||
fprintf(stderr, "git-checkout-index: %s already exists\n", path);
|
fprintf(stderr, "%s already exists, no checkout\n", path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
|
|||||||
static void setup_git_env(void)
|
static void setup_git_env(void)
|
||||||
{
|
{
|
||||||
git_dir = getenv(GIT_DIR_ENVIRONMENT);
|
git_dir = getenv(GIT_DIR_ENVIRONMENT);
|
||||||
|
git_dir = git_dir ? xstrdup(git_dir) : NULL;
|
||||||
if (!git_dir) {
|
if (!git_dir) {
|
||||||
git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
|
git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
|
||||||
git_dir = git_dir ? xstrdup(git_dir) : NULL;
|
git_dir = git_dir ? xstrdup(git_dir) : NULL;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
use Git;
|
use Git;
|
||||||
|
|
||||||
binmode(STDOUT, ":raw");
|
binmode(STDOUT, ":raw");
|
||||||
@ -87,6 +89,7 @@ my %patch_modes = (
|
|||||||
TARGET => '',
|
TARGET => '',
|
||||||
PARTICIPLE => 'staging',
|
PARTICIPLE => 'staging',
|
||||||
FILTER => 'file-only',
|
FILTER => 'file-only',
|
||||||
|
IS_REVERSE => 0,
|
||||||
},
|
},
|
||||||
'stash' => {
|
'stash' => {
|
||||||
DIFF => 'diff-index -p HEAD',
|
DIFF => 'diff-index -p HEAD',
|
||||||
@ -96,6 +99,7 @@ my %patch_modes = (
|
|||||||
TARGET => '',
|
TARGET => '',
|
||||||
PARTICIPLE => 'stashing',
|
PARTICIPLE => 'stashing',
|
||||||
FILTER => undef,
|
FILTER => undef,
|
||||||
|
IS_REVERSE => 0,
|
||||||
},
|
},
|
||||||
'reset_head' => {
|
'reset_head' => {
|
||||||
DIFF => 'diff-index -p --cached',
|
DIFF => 'diff-index -p --cached',
|
||||||
@ -105,6 +109,7 @@ my %patch_modes = (
|
|||||||
TARGET => '',
|
TARGET => '',
|
||||||
PARTICIPLE => 'unstaging',
|
PARTICIPLE => 'unstaging',
|
||||||
FILTER => 'index-only',
|
FILTER => 'index-only',
|
||||||
|
IS_REVERSE => 1,
|
||||||
},
|
},
|
||||||
'reset_nothead' => {
|
'reset_nothead' => {
|
||||||
DIFF => 'diff-index -R -p --cached',
|
DIFF => 'diff-index -R -p --cached',
|
||||||
@ -114,6 +119,7 @@ my %patch_modes = (
|
|||||||
TARGET => ' to index',
|
TARGET => ' to index',
|
||||||
PARTICIPLE => 'applying',
|
PARTICIPLE => 'applying',
|
||||||
FILTER => 'index-only',
|
FILTER => 'index-only',
|
||||||
|
IS_REVERSE => 0,
|
||||||
},
|
},
|
||||||
'checkout_index' => {
|
'checkout_index' => {
|
||||||
DIFF => 'diff-files -p',
|
DIFF => 'diff-files -p',
|
||||||
@ -123,6 +129,7 @@ my %patch_modes = (
|
|||||||
TARGET => ' from worktree',
|
TARGET => ' from worktree',
|
||||||
PARTICIPLE => 'discarding',
|
PARTICIPLE => 'discarding',
|
||||||
FILTER => 'file-only',
|
FILTER => 'file-only',
|
||||||
|
IS_REVERSE => 1,
|
||||||
},
|
},
|
||||||
'checkout_head' => {
|
'checkout_head' => {
|
||||||
DIFF => 'diff-index -p',
|
DIFF => 'diff-index -p',
|
||||||
@ -132,6 +139,7 @@ my %patch_modes = (
|
|||||||
TARGET => ' from index and worktree',
|
TARGET => ' from index and worktree',
|
||||||
PARTICIPLE => 'discarding',
|
PARTICIPLE => 'discarding',
|
||||||
FILTER => undef,
|
FILTER => undef,
|
||||||
|
IS_REVERSE => 1,
|
||||||
},
|
},
|
||||||
'checkout_nothead' => {
|
'checkout_nothead' => {
|
||||||
DIFF => 'diff-index -R -p',
|
DIFF => 'diff-index -R -p',
|
||||||
@ -141,6 +149,7 @@ my %patch_modes = (
|
|||||||
TARGET => ' to index and worktree',
|
TARGET => ' to index and worktree',
|
||||||
PARTICIPLE => 'applying',
|
PARTICIPLE => 'applying',
|
||||||
FILTER => undef,
|
FILTER => undef,
|
||||||
|
IS_REVERSE => 0,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -999,10 +1008,12 @@ sub edit_hunk_manually {
|
|||||||
print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
|
print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
|
||||||
print $fh @$oldtext;
|
print $fh @$oldtext;
|
||||||
my $participle = $patch_mode_flavour{PARTICIPLE};
|
my $participle = $patch_mode_flavour{PARTICIPLE};
|
||||||
|
my $is_reverse = $patch_mode_flavour{IS_REVERSE};
|
||||||
|
my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
|
||||||
print $fh <<EOF;
|
print $fh <<EOF;
|
||||||
# ---
|
# ---
|
||||||
# To remove '-' lines, make them ' ' lines (context).
|
# To remove '$remove_minus' lines, make them ' ' lines (context).
|
||||||
# To remove '+' lines, delete them.
|
# To remove '$remove_plus' lines, delete them.
|
||||||
# Lines starting with # will be removed.
|
# Lines starting with # will be removed.
|
||||||
#
|
#
|
||||||
# If the patch applies cleanly, the edited hunk will immediately be
|
# If the patch applies cleanly, the edited hunk will immediately be
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# This tool is copyright (c) 2005, Martin Langhoff.
|
# This tool is copyright (c) 2005, Martin Langhoff.
|
||||||
# It is released under the Gnu Public License, version 2.
|
# It is released under the Gnu Public License, version 2.
|
||||||
@ -54,6 +54,7 @@ and can contain multiple, unrelated branches.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
use File::Temp qw(tempdir);
|
use File::Temp qw(tempdir);
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
# This tool is copyright (c) 2005, Matthias Urlichs.
|
# This tool is copyright (c) 2005, Matthias Urlichs.
|
||||||
# It is released under the Gnu Public License, version 2.
|
# It is released under the Gnu Public License, version 2.
|
||||||
@ -13,6 +13,7 @@
|
|||||||
# The head revision is on branch "origin" by default.
|
# The head revision is on branch "origin" by default.
|
||||||
# You can change that with the '-o' option.
|
# You can change that with the '-o' option.
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
####
|
####
|
||||||
####
|
####
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use bytes;
|
use bytes;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#
|
#
|
||||||
# Any arguments that are unknown to this script are forwarded to 'git diff'.
|
# Any arguments that are unknown to this script are forwarded to 'git diff'.
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Cwd qw(abs_path);
|
use Cwd qw(abs_path);
|
||||||
|
@ -49,7 +49,8 @@ do_merge=
|
|||||||
dotest="$GIT_DIR"/rebase-merge
|
dotest="$GIT_DIR"/rebase-merge
|
||||||
prec=4
|
prec=4
|
||||||
verbose=
|
verbose=
|
||||||
diffstat=$(git config --bool rebase.stat)
|
diffstat=
|
||||||
|
test "$(git config --bool rebase.stat)" = true && diffstat=t
|
||||||
git_am_opt=
|
git_am_opt=
|
||||||
rebase_root=
|
rebase_root=
|
||||||
force_rebase=
|
force_rebase=
|
||||||
@ -274,15 +275,16 @@ do
|
|||||||
die "No rebase in progress?"
|
die "No rebase in progress?"
|
||||||
|
|
||||||
git rerere clear
|
git rerere clear
|
||||||
if test -d "$dotest"
|
|
||||||
then
|
test -d "$dotest" || dotest="$GIT_DIR"/rebase-apply
|
||||||
GIT_QUIET=$(cat "$dotest/quiet")
|
|
||||||
move_to_original_branch
|
head_name="$(cat "$dotest"/head-name)" &&
|
||||||
else
|
case "$head_name" in
|
||||||
dotest="$GIT_DIR"/rebase-apply
|
refs/*)
|
||||||
GIT_QUIET=$(cat "$dotest/quiet")
|
git symbolic-ref HEAD $head_name ||
|
||||||
move_to_original_branch
|
die "Could not move back to $head_name"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
git reset --hard $(cat "$dotest/orig-head")
|
git reset --hard $(cat "$dotest/orig-head")
|
||||||
rm -r "$dotest"
|
rm -r "$dotest"
|
||||||
exit
|
exit
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# Scan two git object-trees, and hardlink any common objects between them.
|
# Scan two git object-trees, and hardlink any common objects between them.
|
||||||
|
|
||||||
use 5.006;
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
|
# Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
|
||||||
# Copyright 2005 Ryan Anderson <ryan@michonline.com>
|
# Copyright 2005 Ryan Anderson <ryan@michonline.com>
|
||||||
@ -16,6 +16,7 @@
|
|||||||
# and second line is the subject of the message.
|
# and second line is the subject of the message.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Term::ReadLine;
|
use Term::ReadLine;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
# Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
|
# Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
|
||||||
# License: GPL v2 or later
|
# License: GPL v2 or later
|
||||||
|
use 5.008;
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
use vars qw/ $AUTHOR $VERSION
|
use vars qw/ $AUTHOR $VERSION
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#
|
#
|
||||||
# This program is licensed under the GPLv2
|
# This program is licensed under the GPLv2
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use CGI qw(:standard :escapeHTML -nosticky);
|
use CGI qw(:standard :escapeHTML -nosticky);
|
||||||
@ -1355,6 +1356,13 @@ sub esc_url {
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# quote unsafe characters in HTML attributes
|
||||||
|
sub esc_attr {
|
||||||
|
|
||||||
|
# for XHTML conformance escaping '"' to '"' is not enough
|
||||||
|
return esc_html(@_);
|
||||||
|
}
|
||||||
|
|
||||||
# replace invalid utf8 character with SUBSTITUTION sequence
|
# replace invalid utf8 character with SUBSTITUTION sequence
|
||||||
sub esc_html {
|
sub esc_html {
|
||||||
my $str = shift;
|
my $str = shift;
|
||||||
@ -1760,7 +1768,7 @@ sub format_ref_marker {
|
|||||||
hash=>$dest
|
hash=>$dest
|
||||||
)}, $name);
|
)}, $name);
|
||||||
|
|
||||||
$markers .= " <span class=\"$class\" title=\"$ref\">" .
|
$markers .= " <span class=\"".esc_attr($class)."\" title=\"".esc_attr($ref)."\">" .
|
||||||
$link . "</span>";
|
$link . "</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1844,7 +1852,7 @@ sub git_get_avatar {
|
|||||||
return $pre_white .
|
return $pre_white .
|
||||||
"<img width=\"$size\" " .
|
"<img width=\"$size\" " .
|
||||||
"class=\"avatar\" " .
|
"class=\"avatar\" " .
|
||||||
"src=\"$url\" " .
|
"src=\"".esc_url($url)."\" " .
|
||||||
"alt=\"\" " .
|
"alt=\"\" " .
|
||||||
"/>" . $post_white;
|
"/>" . $post_white;
|
||||||
} else {
|
} else {
|
||||||
@ -2555,7 +2563,7 @@ sub git_show_project_tagcloud {
|
|||||||
} else {
|
} else {
|
||||||
my @tags = sort { $cloud->{$a}->{count} <=> $cloud->{$b}->{count} } keys %$cloud;
|
my @tags = sort { $cloud->{$a}->{count} <=> $cloud->{$b}->{count} } keys %$cloud;
|
||||||
return '<p align="center">' . join (', ', map {
|
return '<p align="center">' . join (', ', map {
|
||||||
"<a href=\"$home_link?by_tag=$_\">$cloud->{$_}->{topname}</a>"
|
$cgi->a({-href=>"$home_link?by_tag=$_"}, $cloud->{$_}->{topname})
|
||||||
} splice(@tags, 0, $count)) . '</p>';
|
} splice(@tags, 0, $count)) . '</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3428,11 +3436,11 @@ EOF
|
|||||||
# print out each stylesheet that exist, providing backwards capability
|
# print out each stylesheet that exist, providing backwards capability
|
||||||
# for those people who defined $stylesheet in a config file
|
# for those people who defined $stylesheet in a config file
|
||||||
if (defined $stylesheet) {
|
if (defined $stylesheet) {
|
||||||
print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
|
print '<link rel="stylesheet" type="text/css" href="'.esc_url($stylesheet).'"/>'."\n";
|
||||||
} else {
|
} else {
|
||||||
foreach my $stylesheet (@stylesheets) {
|
foreach my $stylesheet (@stylesheets) {
|
||||||
next unless $stylesheet;
|
next unless $stylesheet;
|
||||||
print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
|
print '<link rel="stylesheet" type="text/css" href="'.esc_url($stylesheet).'"/>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (defined $project) {
|
if (defined $project) {
|
||||||
@ -3445,7 +3453,7 @@ EOF
|
|||||||
my $type = lc($format);
|
my $type = lc($format);
|
||||||
my %link_attr = (
|
my %link_attr = (
|
||||||
'-rel' => 'alternate',
|
'-rel' => 'alternate',
|
||||||
'-title' => "$project - $href_params{'-title'} - $format feed",
|
'-title' => esc_attr("$project - $href_params{'-title'} - $format feed"),
|
||||||
'-type' => "application/$type+xml"
|
'-type' => "application/$type+xml"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3472,13 +3480,13 @@ EOF
|
|||||||
} else {
|
} else {
|
||||||
printf('<link rel="alternate" title="%s projects list" '.
|
printf('<link rel="alternate" title="%s projects list" '.
|
||||||
'href="%s" type="text/plain; charset=utf-8" />'."\n",
|
'href="%s" type="text/plain; charset=utf-8" />'."\n",
|
||||||
$site_name, href(project=>undef, action=>"project_index"));
|
esc_attr($site_name), href(project=>undef, action=>"project_index"));
|
||||||
printf('<link rel="alternate" title="%s projects feeds" '.
|
printf('<link rel="alternate" title="%s projects feeds" '.
|
||||||
'href="%s" type="text/x-opml" />'."\n",
|
'href="%s" type="text/x-opml" />'."\n",
|
||||||
$site_name, href(project=>undef, action=>"opml"));
|
esc_attr($site_name), href(project=>undef, action=>"opml"));
|
||||||
}
|
}
|
||||||
if (defined $favicon) {
|
if (defined $favicon) {
|
||||||
print qq(<link rel="shortcut icon" href="$favicon" type="image/png" />\n);
|
print qq(<link rel="shortcut icon" href=").esc_url($favicon).qq(" type="image/png" />\n);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</head>\n" .
|
print "</head>\n" .
|
||||||
@ -3491,7 +3499,7 @@ EOF
|
|||||||
print "<div class=\"page_header\">\n" .
|
print "<div class=\"page_header\">\n" .
|
||||||
$cgi->a({-href => esc_url($logo_url),
|
$cgi->a({-href => esc_url($logo_url),
|
||||||
-title => $logo_label},
|
-title => $logo_label},
|
||||||
qq(<img src="$logo" width="72" height="27" alt="git" class="logo"/>));
|
qq(<img src=").esc_url($logo).qq(" width="72" height="27" alt="git" class="logo"/>));
|
||||||
print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / ";
|
print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / ";
|
||||||
if (defined $project) {
|
if (defined $project) {
|
||||||
print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
|
print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
|
||||||
@ -3589,7 +3597,7 @@ sub git_footer_html {
|
|||||||
insert_file($site_footer);
|
insert_file($site_footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
print qq!<script type="text/javascript" src="$javascript"></script>\n!;
|
print qq!<script type="text/javascript" src="!.esc_url($javascript).qq!"></script>\n!;
|
||||||
if (defined $action &&
|
if (defined $action &&
|
||||||
$action eq 'blame_incremental') {
|
$action eq 'blame_incremental') {
|
||||||
print qq!<script type="text/javascript">\n!.
|
print qq!<script type="text/javascript">\n!.
|
||||||
@ -5609,14 +5617,14 @@ sub git_blob {
|
|||||||
} else {
|
} else {
|
||||||
print "<div class=\"page_nav\">\n" .
|
print "<div class=\"page_nav\">\n" .
|
||||||
"<br/><br/></div>\n" .
|
"<br/><br/></div>\n" .
|
||||||
"<div class=\"title\">$hash</div>\n";
|
"<div class=\"title\">".esc_html($hash)."</div>\n";
|
||||||
}
|
}
|
||||||
git_print_page_path($file_name, "blob", $hash_base);
|
git_print_page_path($file_name, "blob", $hash_base);
|
||||||
print "<div class=\"page_body\">\n";
|
print "<div class=\"page_body\">\n";
|
||||||
if ($mimetype =~ m!^image/!) {
|
if ($mimetype =~ m!^image/!) {
|
||||||
print qq!<img type="$mimetype"!;
|
print qq!<img type="!.esc_attr($mimetype).qq!"!;
|
||||||
if ($file_name) {
|
if ($file_name) {
|
||||||
print qq! alt="$file_name" title="$file_name"!;
|
print qq! alt="!.esc_attr($file_name).qq!" title="!.esc_attr($file_name).qq!"!;
|
||||||
}
|
}
|
||||||
print qq! src="! .
|
print qq! src="! .
|
||||||
href(action=>"blob_plain", hash=>$hash,
|
href(action=>"blob_plain", hash=>$hash,
|
||||||
@ -5629,7 +5637,7 @@ sub git_blob {
|
|||||||
$nr++;
|
$nr++;
|
||||||
$line = untabify($line);
|
$line = untabify($line);
|
||||||
printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
|
printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
|
||||||
$nr, href(-replay => 1), $nr, $nr, $syntax ? $line : esc_html($line, -nbsp=>1);
|
$nr, esc_attr(href(-replay => 1)), $nr, $nr, $syntax ? $line : esc_html($line, -nbsp=>1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close $fd
|
close $fd
|
||||||
@ -5691,7 +5699,7 @@ sub git_tree {
|
|||||||
undef $hash_base;
|
undef $hash_base;
|
||||||
print "<div class=\"page_nav\">\n";
|
print "<div class=\"page_nav\">\n";
|
||||||
print "<br/><br/></div>\n";
|
print "<br/><br/></div>\n";
|
||||||
print "<div class=\"title\">$hash</div>\n";
|
print "<div class=\"title\">".esc_html($hash)."</div>\n";
|
||||||
}
|
}
|
||||||
if (defined $file_name) {
|
if (defined $file_name) {
|
||||||
$basedir = $file_name;
|
$basedir = $file_name;
|
||||||
@ -6159,7 +6167,7 @@ sub git_blobdiff {
|
|||||||
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
|
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
|
||||||
} else {
|
} else {
|
||||||
print "<div class=\"page_nav\"><br/>$formats_nav<br/></div>\n";
|
print "<div class=\"page_nav\"><br/>$formats_nav<br/></div>\n";
|
||||||
print "<div class=\"title\">$hash vs $hash_parent</div>\n";
|
print "<div class=\"title\">".esc_html("$hash vs $hash_parent")."</div>\n";
|
||||||
}
|
}
|
||||||
if (defined $file_name) {
|
if (defined $file_name) {
|
||||||
git_print_page_path($file_name, "blob", $hash_base);
|
git_print_page_path($file_name, "blob", $hash_base);
|
||||||
|
@ -510,9 +510,7 @@ static char* getdir(void)
|
|||||||
die("GIT_PROJECT_ROOT is set but PATH_INFO is not");
|
die("GIT_PROJECT_ROOT is set but PATH_INFO is not");
|
||||||
if (daemon_avoid_alias(pathinfo))
|
if (daemon_avoid_alias(pathinfo))
|
||||||
die("'%s': aliased", pathinfo);
|
die("'%s': aliased", pathinfo);
|
||||||
strbuf_addstr(&buf, root);
|
end_url_with_slash(&buf, root);
|
||||||
if (buf.buf[buf.len - 1] != '/')
|
|
||||||
strbuf_addch(&buf, '/');
|
|
||||||
if (pathinfo[0] == '/')
|
if (pathinfo[0] == '/')
|
||||||
pathinfo++;
|
pathinfo++;
|
||||||
strbuf_addstr(&buf, pathinfo);
|
strbuf_addstr(&buf, pathinfo);
|
||||||
|
16
http-fetch.c
16
http-fetch.c
@ -14,8 +14,7 @@ int main(int argc, const char **argv)
|
|||||||
int commits;
|
int commits;
|
||||||
const char **write_ref = NULL;
|
const char **write_ref = NULL;
|
||||||
char **commit_id;
|
char **commit_id;
|
||||||
const char *url;
|
char *url = NULL;
|
||||||
char *rewritten_url = NULL;
|
|
||||||
int arg = 1;
|
int arg = 1;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int get_tree = 0;
|
int get_tree = 0;
|
||||||
@ -57,19 +56,14 @@ int main(int argc, const char **argv)
|
|||||||
commit_id = (char **) &argv[arg++];
|
commit_id = (char **) &argv[arg++];
|
||||||
commits = 1;
|
commits = 1;
|
||||||
}
|
}
|
||||||
url = argv[arg];
|
|
||||||
|
if (argv[arg])
|
||||||
|
str_end_url_with_slash(argv[arg], &url);
|
||||||
|
|
||||||
prefix = setup_git_directory();
|
prefix = setup_git_directory();
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
git_config(git_default_config, NULL);
|
||||||
|
|
||||||
if (url && url[strlen(url)-1] != '/') {
|
|
||||||
rewritten_url = xmalloc(strlen(url)+2);
|
|
||||||
strcpy(rewritten_url, url);
|
|
||||||
strcat(rewritten_url, "/");
|
|
||||||
url = rewritten_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
http_init(NULL);
|
http_init(NULL);
|
||||||
walker = get_http_walker(url);
|
walker = get_http_walker(url);
|
||||||
walker->get_tree = get_tree;
|
walker->get_tree = get_tree;
|
||||||
@ -93,7 +87,7 @@ int main(int argc, const char **argv)
|
|||||||
walker_free(walker);
|
walker_free(walker);
|
||||||
http_cleanup();
|
http_cleanup();
|
||||||
|
|
||||||
free(rewritten_url);
|
free(url);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
31
http-push.c
31
http-push.c
@ -1090,6 +1090,10 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
|
|||||||
if (tag_closed) {
|
if (tag_closed) {
|
||||||
if (!strcmp(ctx->name, DAV_PROPFIND_RESP) && ls->dentry_name) {
|
if (!strcmp(ctx->name, DAV_PROPFIND_RESP) && ls->dentry_name) {
|
||||||
if (ls->dentry_flags & IS_DIR) {
|
if (ls->dentry_flags & IS_DIR) {
|
||||||
|
|
||||||
|
/* ensure collection names end with slash */
|
||||||
|
str_end_url_with_slash(ls->dentry_name, &ls->dentry_name);
|
||||||
|
|
||||||
if (ls->flags & PROCESS_DIRS) {
|
if (ls->flags & PROCESS_DIRS) {
|
||||||
ls->userFunc(ls);
|
ls->userFunc(ls);
|
||||||
}
|
}
|
||||||
@ -1112,8 +1116,16 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path) {
|
if (path) {
|
||||||
path += repo->path_len;
|
const char *url = repo->url;
|
||||||
ls->dentry_name = xstrdup(path);
|
if (repo->path)
|
||||||
|
url = repo->path;
|
||||||
|
if (strncmp(path, url, repo->path_len))
|
||||||
|
error("Parsed path '%s' does not match url: '%s'\n",
|
||||||
|
path, url);
|
||||||
|
else {
|
||||||
|
path += repo->path_len;
|
||||||
|
ls->dentry_name = xstrdup(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
|
} else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) {
|
||||||
ls->dentry_flags |= IS_DIR;
|
ls->dentry_flags |= IS_DIR;
|
||||||
@ -1789,7 +1801,6 @@ int main(int argc, char **argv)
|
|||||||
int new_refs;
|
int new_refs;
|
||||||
struct ref *ref, *local_refs;
|
struct ref *ref, *local_refs;
|
||||||
struct remote *remote;
|
struct remote *remote;
|
||||||
char *rewritten_url = NULL;
|
|
||||||
|
|
||||||
git_extract_argv0_path(argv[0]);
|
git_extract_argv0_path(argv[0]);
|
||||||
|
|
||||||
@ -1835,8 +1846,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (!repo->url) {
|
if (!repo->url) {
|
||||||
char *path = strstr(arg, "//");
|
char *path = strstr(arg, "//");
|
||||||
repo->url = arg;
|
str_end_url_with_slash(arg, &repo->url);
|
||||||
repo->path_len = strlen(arg);
|
repo->path_len = strlen(repo->url);
|
||||||
if (path) {
|
if (path) {
|
||||||
repo->path = strchr(path+2, '/');
|
repo->path = strchr(path+2, '/');
|
||||||
if (repo->path)
|
if (repo->path)
|
||||||
@ -1872,15 +1883,6 @@ int main(int argc, char **argv)
|
|||||||
remote->url[remote->url_nr++] = repo->url;
|
remote->url[remote->url_nr++] = repo->url;
|
||||||
http_init(remote);
|
http_init(remote);
|
||||||
|
|
||||||
if (repo->url && repo->url[strlen(repo->url)-1] != '/') {
|
|
||||||
rewritten_url = xmalloc(strlen(repo->url)+2);
|
|
||||||
strcpy(rewritten_url, repo->url);
|
|
||||||
strcat(rewritten_url, "/");
|
|
||||||
repo->path = rewritten_url + (repo->path - repo->url);
|
|
||||||
repo->path_len++;
|
|
||||||
repo->url = rewritten_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_CURL_MULTI
|
#ifdef USE_CURL_MULTI
|
||||||
is_running_queue = 0;
|
is_running_queue = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -2088,7 +2090,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
free(rewritten_url);
|
|
||||||
if (info_ref_lock)
|
if (info_ref_lock)
|
||||||
unlock_remote(info_ref_lock);
|
unlock_remote(info_ref_lock);
|
||||||
free(repo);
|
free(repo);
|
||||||
|
24
http.c
24
http.c
@ -2,6 +2,7 @@
|
|||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "sideband.h"
|
#include "sideband.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
|
#include "url.h"
|
||||||
|
|
||||||
int data_received;
|
int data_received;
|
||||||
int active_requests;
|
int active_requests;
|
||||||
@ -279,6 +280,11 @@ static CURL *get_curl_handle(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
|
curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x071301
|
||||||
|
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
|
||||||
|
#elif LIBCURL_VERSION_NUM >= 0x071101
|
||||||
|
curl_easy_setopt(result, CURLOPT_POST301, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (getenv("GIT_CURL_VERBOSE"))
|
if (getenv("GIT_CURL_VERBOSE"))
|
||||||
curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
|
curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
|
||||||
@ -297,7 +303,7 @@ static CURL *get_curl_handle(void)
|
|||||||
|
|
||||||
static void http_auth_init(const char *url)
|
static void http_auth_init(const char *url)
|
||||||
{
|
{
|
||||||
char *at, *colon, *cp, *slash;
|
char *at, *colon, *cp, *slash, *decoded;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
cp = strstr(url, "://");
|
cp = strstr(url, "://");
|
||||||
@ -322,16 +328,25 @@ static void http_auth_init(const char *url)
|
|||||||
user_name = xmalloc(len + 1);
|
user_name = xmalloc(len + 1);
|
||||||
memcpy(user_name, cp, len);
|
memcpy(user_name, cp, len);
|
||||||
user_name[len] = '\0';
|
user_name[len] = '\0';
|
||||||
|
decoded = url_decode(user_name);
|
||||||
|
free(user_name);
|
||||||
|
user_name = decoded;
|
||||||
user_pass = NULL;
|
user_pass = NULL;
|
||||||
} else {
|
} else {
|
||||||
len = colon - cp;
|
len = colon - cp;
|
||||||
user_name = xmalloc(len + 1);
|
user_name = xmalloc(len + 1);
|
||||||
memcpy(user_name, cp, len);
|
memcpy(user_name, cp, len);
|
||||||
user_name[len] = '\0';
|
user_name[len] = '\0';
|
||||||
|
decoded = url_decode(user_name);
|
||||||
|
free(user_name);
|
||||||
|
user_name = decoded;
|
||||||
len = at - (colon + 1);
|
len = at - (colon + 1);
|
||||||
user_pass = xmalloc(len + 1);
|
user_pass = xmalloc(len + 1);
|
||||||
memcpy(user_pass, colon + 1, len);
|
memcpy(user_pass, colon + 1, len);
|
||||||
user_pass[len] = '\0';
|
user_pass[len] = '\0';
|
||||||
|
decoded = url_decode(user_pass);
|
||||||
|
free(user_pass);
|
||||||
|
user_pass = decoded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,13 +743,6 @@ static inline int hex(int v)
|
|||||||
return 'A' + v - 10;
|
return 'A' + v - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void end_url_with_slash(struct strbuf *buf, const char *url)
|
|
||||||
{
|
|
||||||
strbuf_addstr(buf, url);
|
|
||||||
if (buf->len && buf->buf[buf->len - 1] != '/')
|
|
||||||
strbuf_addstr(buf, "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *quote_ref_url(const char *base, const char *ref)
|
static char *quote_ref_url(const char *base, const char *ref)
|
||||||
{
|
{
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
|
2
http.h
2
http.h
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "remote.h"
|
#include "remote.h"
|
||||||
|
#include "url.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We detect based on the cURL version if multi-transfer is
|
* We detect based on the cURL version if multi-transfer is
|
||||||
@ -117,7 +118,6 @@ extern void append_remote_object_url(struct strbuf *buf, const char *url,
|
|||||||
int only_two_digit_prefix);
|
int only_two_digit_prefix);
|
||||||
extern char *get_remote_object_url(const char *url, const char *hex,
|
extern char *get_remote_object_url(const char *url, const char *hex,
|
||||||
int only_two_digit_prefix);
|
int only_two_digit_prefix);
|
||||||
extern void end_url_with_slash(struct strbuf *buf, const char *url);
|
|
||||||
|
|
||||||
/* Options for http_request_*() */
|
/* Options for http_request_*() */
|
||||||
#define HTTP_NO_CACHE 1
|
#define HTTP_NO_CACHE 1
|
||||||
|
@ -7,6 +7,7 @@ Git - Perl interface to the Git version control system
|
|||||||
|
|
||||||
package Git;
|
package Git;
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +239,6 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
|
|||||||
|
|
||||||
commit->parents = xcalloc(sizeof(struct commit_list), 1);
|
commit->parents = xcalloc(sizeof(struct commit_list), 1);
|
||||||
commit->parents->item = commit_info->commit;
|
commit->parents->item = commit_info->commit;
|
||||||
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_reflog_selector(struct strbuf *sb,
|
void get_reflog_selector(struct strbuf *sb,
|
||||||
|
@ -2030,8 +2030,10 @@ static struct commit *get_revision_1(struct rev_info *revs)
|
|||||||
revs->commits = entry->next;
|
revs->commits = entry->next;
|
||||||
free(entry);
|
free(entry);
|
||||||
|
|
||||||
if (revs->reflog_info)
|
if (revs->reflog_info) {
|
||||||
fake_reflog_parent(revs->reflog_info, commit);
|
fake_reflog_parent(revs->reflog_info, commit);
|
||||||
|
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we haven't done the list limiting, we need to look at
|
* If we haven't done the list limiting, we need to look at
|
||||||
|
64
symlinks.c
64
symlinks.c
@ -64,11 +64,13 @@ static inline void reset_lstat_cache(struct cache_def *cache)
|
|||||||
* of the prefix, where the cache should use the stat() function
|
* of the prefix, where the cache should use the stat() function
|
||||||
* instead of the lstat() function to test each path component.
|
* instead of the lstat() function to test each path component.
|
||||||
*/
|
*/
|
||||||
static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
static int lstat_cache_matchlen(struct cache_def *cache,
|
||||||
int track_flags, int prefix_len_stat_func)
|
const char *name, int len,
|
||||||
|
int *ret_flags, int track_flags,
|
||||||
|
int prefix_len_stat_func)
|
||||||
{
|
{
|
||||||
int match_len, last_slash, last_slash_dir, previous_slash;
|
int match_len, last_slash, last_slash_dir, previous_slash;
|
||||||
int match_flags, ret_flags, save_flags, max_len, ret;
|
int save_flags, max_len, ret;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (cache->track_flags != track_flags ||
|
if (cache->track_flags != track_flags ||
|
||||||
@ -90,13 +92,13 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
|||||||
match_len = last_slash =
|
match_len = last_slash =
|
||||||
longest_path_match(name, len, cache->path, cache->len,
|
longest_path_match(name, len, cache->path, cache->len,
|
||||||
&previous_slash);
|
&previous_slash);
|
||||||
match_flags = cache->flags & track_flags & (FL_NOENT|FL_SYMLINK);
|
*ret_flags = cache->flags & track_flags & (FL_NOENT|FL_SYMLINK);
|
||||||
|
|
||||||
if (!(track_flags & FL_FULLPATH) && match_len == len)
|
if (!(track_flags & FL_FULLPATH) && match_len == len)
|
||||||
match_len = last_slash = previous_slash;
|
match_len = last_slash = previous_slash;
|
||||||
|
|
||||||
if (match_flags && match_len == cache->len)
|
if (*ret_flags && match_len == cache->len)
|
||||||
return match_flags;
|
return match_len;
|
||||||
/*
|
/*
|
||||||
* If we now have match_len > 0, we would know that
|
* If we now have match_len > 0, we would know that
|
||||||
* the matched part will always be a directory.
|
* the matched part will always be a directory.
|
||||||
@ -105,16 +107,16 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
|||||||
* a substring of the cache on a path component basis,
|
* a substring of the cache on a path component basis,
|
||||||
* we can return immediately.
|
* we can return immediately.
|
||||||
*/
|
*/
|
||||||
match_flags = track_flags & FL_DIR;
|
*ret_flags = track_flags & FL_DIR;
|
||||||
if (match_flags && len == match_len)
|
if (*ret_flags && len == match_len)
|
||||||
return match_flags;
|
return match_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Okay, no match from the cache so far, so now we have to
|
* Okay, no match from the cache so far, so now we have to
|
||||||
* check the rest of the path components.
|
* check the rest of the path components.
|
||||||
*/
|
*/
|
||||||
ret_flags = FL_DIR;
|
*ret_flags = FL_DIR;
|
||||||
last_slash_dir = last_slash;
|
last_slash_dir = last_slash;
|
||||||
max_len = len < PATH_MAX ? len : PATH_MAX;
|
max_len = len < PATH_MAX ? len : PATH_MAX;
|
||||||
while (match_len < max_len) {
|
while (match_len < max_len) {
|
||||||
@ -133,16 +135,16 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
|||||||
ret = lstat(cache->path, &st);
|
ret = lstat(cache->path, &st);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret_flags = FL_LSTATERR;
|
*ret_flags = FL_LSTATERR;
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
ret_flags |= FL_NOENT;
|
*ret_flags |= FL_NOENT;
|
||||||
} else if (S_ISDIR(st.st_mode)) {
|
} else if (S_ISDIR(st.st_mode)) {
|
||||||
last_slash_dir = last_slash;
|
last_slash_dir = last_slash;
|
||||||
continue;
|
continue;
|
||||||
} else if (S_ISLNK(st.st_mode)) {
|
} else if (S_ISLNK(st.st_mode)) {
|
||||||
ret_flags = FL_SYMLINK;
|
*ret_flags = FL_SYMLINK;
|
||||||
} else {
|
} else {
|
||||||
ret_flags = FL_ERR;
|
*ret_flags = FL_ERR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
|||||||
* path types, FL_NOENT, FL_SYMLINK and FL_DIR, can be cached
|
* path types, FL_NOENT, FL_SYMLINK and FL_DIR, can be cached
|
||||||
* for the moment!
|
* for the moment!
|
||||||
*/
|
*/
|
||||||
save_flags = ret_flags & track_flags & (FL_NOENT|FL_SYMLINK);
|
save_flags = *ret_flags & track_flags & (FL_NOENT|FL_SYMLINK);
|
||||||
if (save_flags && last_slash > 0 && last_slash <= PATH_MAX) {
|
if (save_flags && last_slash > 0 && last_slash <= PATH_MAX) {
|
||||||
cache->path[last_slash] = '\0';
|
cache->path[last_slash] = '\0';
|
||||||
cache->len = last_slash;
|
cache->len = last_slash;
|
||||||
@ -176,7 +178,16 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
|||||||
} else {
|
} else {
|
||||||
reset_lstat_cache(cache);
|
reset_lstat_cache(cache);
|
||||||
}
|
}
|
||||||
return ret_flags;
|
return match_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lstat_cache(struct cache_def *cache, const char *name, int len,
|
||||||
|
int track_flags, int prefix_len_stat_func)
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
(void)lstat_cache_matchlen(cache, name, len, &flags, track_flags,
|
||||||
|
prefix_len_stat_func);
|
||||||
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define USE_ONLY_LSTAT 0
|
#define USE_ONLY_LSTAT 0
|
||||||
@ -198,15 +209,26 @@ int has_symlink_leading_path(const char *name, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return non-zero if path 'name' has a leading symlink component or
|
* Return zero if path 'name' has a leading symlink component or
|
||||||
* if some leading path component does not exists.
|
* if some leading path component does not exists.
|
||||||
|
*
|
||||||
|
* Return -1 if leading path exists and is a directory.
|
||||||
|
*
|
||||||
|
* Return path length if leading path exists and is neither a
|
||||||
|
* directory nor a symlink.
|
||||||
*/
|
*/
|
||||||
int has_symlink_or_noent_leading_path(const char *name, int len)
|
int check_leading_path(const char *name, int len)
|
||||||
{
|
{
|
||||||
struct cache_def *cache = &default_cache; /* FIXME */
|
struct cache_def *cache = &default_cache; /* FIXME */
|
||||||
return lstat_cache(cache, name, len,
|
int flags;
|
||||||
FL_SYMLINK|FL_NOENT|FL_DIR, USE_ONLY_LSTAT) &
|
int match_len = lstat_cache_matchlen(cache, name, len, &flags,
|
||||||
(FL_SYMLINK|FL_NOENT);
|
FL_SYMLINK|FL_NOENT|FL_DIR, USE_ONLY_LSTAT);
|
||||||
|
if (flags & (FL_SYMLINK|FL_NOENT))
|
||||||
|
return 0;
|
||||||
|
else if (flags & FL_DIR)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return match_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -75,12 +75,14 @@ fi
|
|||||||
|
|
||||||
prepare_httpd() {
|
prepare_httpd() {
|
||||||
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
|
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
|
||||||
|
cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH"
|
||||||
|
|
||||||
ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules"
|
ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules"
|
||||||
|
|
||||||
if test -n "$LIB_HTTPD_SSL"
|
if test -n "$LIB_HTTPD_SSL"
|
||||||
then
|
then
|
||||||
HTTPD_URL=https://127.0.0.1:$LIB_HTTPD_PORT
|
HTTPD_URL=https://127.0.0.1:$LIB_HTTPD_PORT
|
||||||
|
AUTH_HTTPD_URL=https://user%40host:user%40host@127.0.0.1:$LIB_HTTPD_PORT
|
||||||
|
|
||||||
RANDFILE_PATH="$HTTPD_ROOT_PATH"/.rnd openssl req \
|
RANDFILE_PATH="$HTTPD_ROOT_PATH"/.rnd openssl req \
|
||||||
-config "$TEST_PATH/ssl.cnf" \
|
-config "$TEST_PATH/ssl.cnf" \
|
||||||
@ -92,6 +94,7 @@ prepare_httpd() {
|
|||||||
HTTPD_PARA="$HTTPD_PARA -DSSL"
|
HTTPD_PARA="$HTTPD_PARA -DSSL"
|
||||||
else
|
else
|
||||||
HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
|
HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
|
||||||
|
AUTH_HTTPD_URL=http://user%40host:user%40host@127.0.0.1:$LIB_HTTPD_PORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
|
if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
|
||||||
|
@ -17,8 +17,33 @@ ErrorLog error.log
|
|||||||
<IfModule !mod_env.c>
|
<IfModule !mod_env.c>
|
||||||
LoadModule env_module modules/mod_env.so
|
LoadModule env_module modules/mod_env.so
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
<IfModule !mod_rewrite.c>
|
||||||
|
LoadModule rewrite_module modules/mod_rewrite.so
|
||||||
|
</IFModule>
|
||||||
|
<IfModule !mod_version.c>
|
||||||
|
LoadModule version_module modules/mod_version.so
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfVersion < 2.1>
|
||||||
|
<IfModule !mod_auth.c>
|
||||||
|
LoadModule auth_module modules/mod_auth.so
|
||||||
|
</IfModule>
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
|
<IfVersion >= 2.1>
|
||||||
|
<IfModule !mod_auth_basic.c>
|
||||||
|
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !mod_authn_file.c>
|
||||||
|
LoadModule authn_file_module modules/mod_authn_file.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !mod_authz_user.c>
|
||||||
|
LoadModule authz_user_module modules/mod_authz_user.so
|
||||||
|
</IfModule>
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
Alias /dumb/ www/
|
Alias /dumb/ www/
|
||||||
|
Alias /auth/ www/auth/
|
||||||
|
|
||||||
<Location /smart/>
|
<Location /smart/>
|
||||||
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
|
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
|
||||||
@ -36,6 +61,10 @@ ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/
|
|||||||
Options ExecCGI
|
Options ExecCGI
|
||||||
</Files>
|
</Files>
|
||||||
|
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]
|
||||||
|
RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]
|
||||||
|
|
||||||
<IfDefine SSL>
|
<IfDefine SSL>
|
||||||
LoadModule ssl_module modules/mod_ssl.so
|
LoadModule ssl_module modules/mod_ssl.so
|
||||||
|
|
||||||
@ -48,6 +77,13 @@ SSLMutex file:ssl_mutex
|
|||||||
SSLEngine On
|
SSLEngine On
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
|
|
||||||
|
<Location /auth/>
|
||||||
|
AuthType Basic
|
||||||
|
AuthName "git-auth"
|
||||||
|
AuthUserFile passwd
|
||||||
|
Require valid-user
|
||||||
|
</Location>
|
||||||
|
|
||||||
<IfDefine DAV>
|
<IfDefine DAV>
|
||||||
LoadModule dav_module modules/mod_dav.so
|
LoadModule dav_module modules/mod_dav.so
|
||||||
LoadModule dav_fs_module modules/mod_dav_fs.so
|
LoadModule dav_fs_module modules/mod_dav_fs.so
|
||||||
|
1
t/lib-httpd/passwd
Normal file
1
t/lib-httpd/passwd
Normal file
@ -0,0 +1 @@
|
|||||||
|
user@host:nKpa8pZUHx/ic
|
34
t/t1412-reflog-loop.sh
Executable file
34
t/t1412-reflog-loop.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='reflog walk shows repeated commits again'
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
test_expect_success 'setup commits' '
|
||||||
|
test_tick &&
|
||||||
|
echo content >file && git add file && git commit -m one &&
|
||||||
|
git tag one &&
|
||||||
|
echo content >>file && git add file && git commit -m two &&
|
||||||
|
git tag two
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'setup reflog with alternating commits' '
|
||||||
|
git checkout -b topic &&
|
||||||
|
git reset one &&
|
||||||
|
git reset two &&
|
||||||
|
git reset one &&
|
||||||
|
git reset two
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'reflog shows all entries' '
|
||||||
|
cat >expect <<-\EOF
|
||||||
|
topic@{0} two: updating HEAD
|
||||||
|
topic@{1} one: updating HEAD
|
||||||
|
topic@{2} two: updating HEAD
|
||||||
|
topic@{3} one: updating HEAD
|
||||||
|
topic@{4} branch: Created from HEAD
|
||||||
|
EOF
|
||||||
|
git log -g --format="%gd %gs" topic >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
@ -72,6 +72,18 @@ testrebase() {
|
|||||||
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
|
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
|
||||||
test ! -d "$dotest"
|
test ! -d "$dotest"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "rebase$type --abort does not update reflog" '
|
||||||
|
cd "$work_dir" &&
|
||||||
|
# Clean up the state from the previous one
|
||||||
|
git reset --hard pre-rebase &&
|
||||||
|
git reflog show to-rebase > reflog_before &&
|
||||||
|
test_must_fail git rebase$type master &&
|
||||||
|
git rebase --abort &&
|
||||||
|
git reflog show to-rebase > reflog_after &&
|
||||||
|
test_cmp reflog_before reflog_after &&
|
||||||
|
rm reflog_before reflog_after
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
testrebase "" .git/rebase-apply
|
testrebase "" .git/rebase-apply
|
||||||
|
@ -81,6 +81,16 @@ test_expect_success 'revert after renaming branch' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'cherry-pick on stat-dirty working tree' '
|
||||||
|
git clone . copy &&
|
||||||
|
(
|
||||||
|
cd copy &&
|
||||||
|
git checkout initial &&
|
||||||
|
test-chmtime +40 oops &&
|
||||||
|
git cherry-pick added
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'revert forbidden on dirty working tree' '
|
test_expect_success 'revert forbidden on dirty working tree' '
|
||||||
|
|
||||||
echo content >extra_file &&
|
echo content >extra_file &&
|
||||||
|
@ -178,6 +178,15 @@ test_expect_success 'trailing empty lines (2)' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'checkdiff shows correct line number for trailing blank lines' '
|
||||||
|
|
||||||
|
printf "a\nb\n" > G &&
|
||||||
|
git add G &&
|
||||||
|
printf "x\nx\nx\na\nb\nc\n\n" > G &&
|
||||||
|
[ "$(git diff --check -- G)" = "G:7: new blank line at EOF." ]
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'do not color trailing cr in context' '
|
test_expect_success 'do not color trailing cr in context' '
|
||||||
git config --unset core.whitespace
|
git config --unset core.whitespace
|
||||||
rm -f .gitattributes &&
|
rm -f .gitattributes &&
|
||||||
|
@ -56,4 +56,30 @@ test_expect_success 'apply with too large -p and fancy filename' '
|
|||||||
grep "removing 3 leading" err
|
grep "removing 3 leading" err
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'apply (-p2) diff, mode change only' '
|
||||||
|
cat >patch.chmod <<-\EOF &&
|
||||||
|
diff --git a/sub/file1 b/sub/file1
|
||||||
|
old mode 100644
|
||||||
|
new mode 100755
|
||||||
|
EOF
|
||||||
|
chmod 644 file1 &&
|
||||||
|
git apply -p2 patch.chmod &&
|
||||||
|
test -x file1
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'apply (-p2) diff, rename' '
|
||||||
|
cat >patch.rename <<-\EOF &&
|
||||||
|
diff --git a/sub/file1 b/sub/file2
|
||||||
|
similarity index 100%
|
||||||
|
rename from sub/file1
|
||||||
|
rename to sub/file2
|
||||||
|
EOF
|
||||||
|
echo A >expected &&
|
||||||
|
|
||||||
|
cp file1.saved file1 &&
|
||||||
|
rm -f file2 &&
|
||||||
|
git apply -p2 patch.rename &&
|
||||||
|
test_cmp expected file2
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -30,6 +30,7 @@ test_expect_success setup '
|
|||||||
epocWest="1969-12-31 16:00:00.000000000 -0800" &&
|
epocWest="1969-12-31 16:00:00.000000000 -0800" &&
|
||||||
epocGMT="1970-01-01 00:00:00.000000000 +0000" &&
|
epocGMT="1970-01-01 00:00:00.000000000 +0000" &&
|
||||||
epocEast="1970-01-01 09:00:00.000000000 +0900" &&
|
epocEast="1970-01-01 09:00:00.000000000 +0900" &&
|
||||||
|
epocWest2="1969-12-31 16:00:00 -08:00" &&
|
||||||
|
|
||||||
sed -e "s/TS0/$epocWest/" -e "s/TS1/$timeWest/" <c >createWest.patch &&
|
sed -e "s/TS0/$epocWest/" -e "s/TS1/$timeWest/" <c >createWest.patch &&
|
||||||
sed -e "s/TS0/$epocEast/" -e "s/TS1/$timeEast/" <c >createEast.patch &&
|
sed -e "s/TS0/$epocEast/" -e "s/TS1/$timeEast/" <c >createEast.patch &&
|
||||||
@ -46,6 +47,7 @@ test_expect_success setup '
|
|||||||
sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest/" <d >removeWest.patch &&
|
sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest/" <d >removeWest.patch &&
|
||||||
sed -e "s/TS0/$timeEast/" -e "s/TS1/$epocEast/" <d >removeEast.patch &&
|
sed -e "s/TS0/$timeEast/" -e "s/TS1/$epocEast/" <d >removeEast.patch &&
|
||||||
sed -e "s/TS0/$timeGMT/" -e "s/TS1/$epocGMT/" <d >removeGMT.patch &&
|
sed -e "s/TS0/$timeGMT/" -e "s/TS1/$epocGMT/" <d >removeGMT.patch &&
|
||||||
|
sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest2/" <d >removeWest2.patch &&
|
||||||
|
|
||||||
echo something >something &&
|
echo something >something &&
|
||||||
>empty
|
>empty
|
||||||
|
@ -72,4 +72,20 @@ test_expect_success 'whitespace-damaged traditional patch' '
|
|||||||
test_cmp expected postimage.txt
|
test_cmp expected postimage.txt
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'traditional patch with colon in timezone' '
|
||||||
|
echo postimage >expected &&
|
||||||
|
reset_preimage &&
|
||||||
|
rm -f "post image.txt" &&
|
||||||
|
git apply "$vector/funny-tz.diff" &&
|
||||||
|
test_cmp expected "post image.txt"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'traditional, whitespace-damaged, colon in timezone' '
|
||||||
|
echo postimage >expected &&
|
||||||
|
reset_preimage &&
|
||||||
|
rm -f "post image.txt" &&
|
||||||
|
git apply "$vector/damaged-tz.diff" &&
|
||||||
|
test_cmp expected "post image.txt"
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
5
t/t4135/damaged-tz.diff
Normal file
5
t/t4135/damaged-tz.diff
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
diff -urN -X /usr/people/jes/exclude-linux linux-2.6.12-rc2-mm3-vanilla/post image.txt linux-2.6.12-rc2-mm3/post image.txt
|
||||||
|
--- linux-2.6.12-rc2-mm3-vanilla/post image.txt 1969-12-31 16:00:00 -08:00
|
||||||
|
+++ linux-2.6.12-rc2-mm3/post image.txt 2005-04-12 02:14:06 -07:00
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+postimage
|
5
t/t4135/funny-tz.diff
Normal file
5
t/t4135/funny-tz.diff
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
diff -urN -X /usr/people/jes/exclude-linux linux-2.6.12-rc2-mm3-vanilla/post image.txt linux-2.6.12-rc2-mm3/post image.txt
|
||||||
|
--- linux-2.6.12-rc2-mm3-vanilla/post image.txt 1969-12-31 16:00:00 -08:00
|
||||||
|
+++ linux-2.6.12-rc2-mm3/post image.txt 2005-04-12 02:14:06 -07:00
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+postimage
|
@ -421,6 +421,15 @@ test_expect_success 'log.decorate configuration' '
|
|||||||
git log --oneline --decorate=full >actual &&
|
git log --oneline --decorate=full >actual &&
|
||||||
test_cmp expect.full actual &&
|
test_cmp expect.full actual &&
|
||||||
|
|
||||||
|
git config --unset-all log.decorate &&
|
||||||
|
git config log.decorate 1 &&
|
||||||
|
git log --oneline >actual &&
|
||||||
|
test_cmp expect.short actual &&
|
||||||
|
git log --oneline --decorate=full >actual &&
|
||||||
|
test_cmp expect.full actual &&
|
||||||
|
git log --oneline --decorate=no >actual &&
|
||||||
|
test_cmp expect.none actual &&
|
||||||
|
|
||||||
git config --unset-all log.decorate &&
|
git config --unset-all log.decorate &&
|
||||||
git config log.decorate short &&
|
git config log.decorate short &&
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
|
@ -30,18 +30,37 @@ test_expect_success 'create http-accessible bare repository' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'clone http repository' '
|
test_expect_success 'clone http repository' '
|
||||||
git clone $HTTPD_URL/dumb/repo.git clone &&
|
git clone $HTTPD_URL/dumb/repo.git clone-tmpl &&
|
||||||
|
cp -R clone-tmpl clone &&
|
||||||
test_cmp file clone/file
|
test_cmp file clone/file
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'clone http repository with authentication' '
|
||||||
|
mkdir "$HTTPD_DOCUMENT_ROOT_PATH/auth/" &&
|
||||||
|
cp -Rf "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" "$HTTPD_DOCUMENT_ROOT_PATH/auth/repo.git" &&
|
||||||
|
git clone $AUTH_HTTPD_URL/auth/repo.git clone-auth &&
|
||||||
|
test_cmp file clone-auth/file
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'fetch changes via http' '
|
test_expect_success 'fetch changes via http' '
|
||||||
echo content >>file &&
|
echo content >>file &&
|
||||||
git commit -a -m two &&
|
git commit -a -m two &&
|
||||||
git push public
|
git push public &&
|
||||||
(cd clone && git pull) &&
|
(cd clone && git pull) &&
|
||||||
test_cmp file clone/file
|
test_cmp file clone/file
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fetch changes via manual http-fetch' '
|
||||||
|
cp -R clone-tmpl clone2 &&
|
||||||
|
|
||||||
|
HEAD=$(git rev-parse --verify HEAD) &&
|
||||||
|
(cd clone2 &&
|
||||||
|
git http-fetch -a -w heads/master-new $HEAD $(git config remote.origin.url) &&
|
||||||
|
git checkout master-new &&
|
||||||
|
test $HEAD = $(git rev-parse --verify HEAD)) &&
|
||||||
|
test_cmp file clone2/file
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'http remote detects correct HEAD' '
|
test_expect_success 'http remote detects correct HEAD' '
|
||||||
git push public master:other &&
|
git push public master:other &&
|
||||||
(cd clone &&
|
(cd clone &&
|
||||||
|
@ -101,5 +101,13 @@ test_expect_success 'used upload-pack service' '
|
|||||||
test_cmp exp act
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'follow redirects (301)' '
|
||||||
|
git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'follow redirects (302)' '
|
||||||
|
git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
|
||||||
|
'
|
||||||
|
|
||||||
stop_httpd
|
stop_httpd
|
||||||
test_done
|
test_done
|
||||||
|
@ -1030,6 +1030,72 @@ test_expect_success GPG \
|
|||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# usage with rfc1991 signatures
|
||||||
|
echo "rfc1991" > gpghome/gpg.conf
|
||||||
|
get_tag_header rfc1991-signed-tag $commit commit $time >expect
|
||||||
|
echo "RFC1991 signed tag" >>expect
|
||||||
|
echo '-----BEGIN PGP MESSAGE-----' >>expect
|
||||||
|
test_expect_success GPG \
|
||||||
|
'creating a signed tag with rfc1991' '
|
||||||
|
git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit &&
|
||||||
|
get_tag_msg rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
cat >fakeeditor <<'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
cp "$1" actual
|
||||||
|
EOF
|
||||||
|
chmod +x fakeeditor
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'reediting a signed tag body omits signature' '
|
||||||
|
echo "RFC1991 signed tag" >expect &&
|
||||||
|
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'verifying rfc1991 signature' '
|
||||||
|
git tag -v rfc1991-signed-tag
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'list tag with rfc1991 signature' '
|
||||||
|
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
||||||
|
git tag -l -n1 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git tag -l -n2 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git tag -l -n999 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
rm -f gpghome/gpg.conf
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'verifying rfc1991 signature without --rfc1991' '
|
||||||
|
git tag -v rfc1991-signed-tag
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'list tag with rfc1991 signature without --rfc1991' '
|
||||||
|
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
||||||
|
git tag -l -n1 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git tag -l -n2 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
git tag -l -n999 rfc1991-signed-tag >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success GPG \
|
||||||
|
'reediting a signed tag body omits signature' '
|
||||||
|
echo "RFC1991 signed tag" >expect &&
|
||||||
|
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
# try to sign with bad user.signingkey
|
# try to sign with bad user.signingkey
|
||||||
git config user.signingkey BobTheMouse
|
git config user.signingkey BobTheMouse
|
||||||
test_expect_success GPG \
|
test_expect_success GPG \
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
use 5.008;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use IO::Pty;
|
use IO::Pty;
|
||||||
|
@ -7,48 +7,54 @@ Do not overwrite changes.'
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
echo c0 > c0.c &&
|
test_commit c0 c0.c &&
|
||||||
git add c0.c &&
|
test_commit c1 c1.c &&
|
||||||
git commit -m c0 &&
|
test_commit c1a c1.c "c1 a" &&
|
||||||
git tag c0 &&
|
|
||||||
echo c1 > c1.c &&
|
|
||||||
git add c1.c &&
|
|
||||||
git commit -m c1 &&
|
|
||||||
git tag c1 &&
|
|
||||||
git reset --hard c0 &&
|
git reset --hard c0 &&
|
||||||
echo c2 > c2.c &&
|
test_commit c2 c2.c &&
|
||||||
git add c2.c &&
|
git reset --hard c0 &&
|
||||||
git commit -m c2 &&
|
mkdir sub &&
|
||||||
git tag c2 &&
|
echo "sub/f" > sub/f &&
|
||||||
git reset --hard c1 &&
|
mkdir sub2 &&
|
||||||
echo "c1 a" > c1.c &&
|
echo "sub2/f" > sub2/f &&
|
||||||
git add c1.c &&
|
git add sub/f sub2/f &&
|
||||||
git commit -m "c1 a" &&
|
git commit -m sub &&
|
||||||
git tag c1a &&
|
git tag sub &&
|
||||||
echo "VERY IMPORTANT CHANGES" > important
|
echo "VERY IMPORTANT CHANGES" > important
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'will not overwrite untracked file' '
|
test_expect_success 'will not overwrite untracked file' '
|
||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
cat important > c2.c &&
|
cp important c2.c &&
|
||||||
test_must_fail git merge c2 &&
|
test_must_fail git merge c2 &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
test_cmp important c2.c
|
test_cmp important c2.c
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'will overwrite tracked file' '
|
||||||
|
git reset --hard c1 &&
|
||||||
|
cp important c2.c &&
|
||||||
|
git add c2.c &&
|
||||||
|
git commit -m important &&
|
||||||
|
git checkout c2
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'will not overwrite new file' '
|
test_expect_success 'will not overwrite new file' '
|
||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
cat important > c2.c &&
|
cp important c2.c &&
|
||||||
git add c2.c &&
|
git add c2.c &&
|
||||||
test_must_fail git merge c2 &&
|
test_must_fail git merge c2 &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
test_cmp important c2.c
|
test_cmp important c2.c
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'will not overwrite staged changes' '
|
test_expect_success 'will not overwrite staged changes' '
|
||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
cat important > c2.c &&
|
cp important c2.c &&
|
||||||
git add c2.c &&
|
git add c2.c &&
|
||||||
rm c2.c &&
|
rm c2.c &&
|
||||||
test_must_fail git merge c2 &&
|
test_must_fail git merge c2 &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
git checkout c2.c &&
|
git checkout c2.c &&
|
||||||
test_cmp important c2.c
|
test_cmp important c2.c
|
||||||
'
|
'
|
||||||
@ -57,7 +63,7 @@ test_expect_success 'will not overwrite removed file' '
|
|||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
git rm c1.c &&
|
git rm c1.c &&
|
||||||
git commit -m "rm c1.c" &&
|
git commit -m "rm c1.c" &&
|
||||||
cat important > c1.c &&
|
cp important c1.c &&
|
||||||
test_must_fail git merge c1a &&
|
test_must_fail git merge c1a &&
|
||||||
test_cmp important c1.c
|
test_cmp important c1.c
|
||||||
'
|
'
|
||||||
@ -66,9 +72,10 @@ test_expect_success 'will not overwrite re-added file' '
|
|||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
git rm c1.c &&
|
git rm c1.c &&
|
||||||
git commit -m "rm c1.c" &&
|
git commit -m "rm c1.c" &&
|
||||||
cat important > c1.c &&
|
cp important c1.c &&
|
||||||
git add c1.c &&
|
git add c1.c &&
|
||||||
test_must_fail git merge c1a &&
|
test_must_fail git merge c1a &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
test_cmp important c1.c
|
test_cmp important c1.c
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -76,14 +83,63 @@ test_expect_success 'will not overwrite removed file with staged changes' '
|
|||||||
git reset --hard c1 &&
|
git reset --hard c1 &&
|
||||||
git rm c1.c &&
|
git rm c1.c &&
|
||||||
git commit -m "rm c1.c" &&
|
git commit -m "rm c1.c" &&
|
||||||
cat important > c1.c &&
|
cp important c1.c &&
|
||||||
git add c1.c &&
|
git add c1.c &&
|
||||||
rm c1.c &&
|
rm c1.c &&
|
||||||
test_must_fail git merge c1a &&
|
test_must_fail git merge c1a &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
git checkout c1.c &&
|
git checkout c1.c &&
|
||||||
test_cmp important c1.c
|
test_cmp important c1.c
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'will not overwrite untracked subtree' '
|
||||||
|
git reset --hard c0 &&
|
||||||
|
rm -rf sub &&
|
||||||
|
mkdir -p sub/f &&
|
||||||
|
cp important sub/f/important &&
|
||||||
|
test_must_fail git merge sub &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
|
test_cmp important sub/f/important
|
||||||
|
'
|
||||||
|
|
||||||
|
cat >expect <<\EOF
|
||||||
|
error: The following untracked working tree files would be overwritten by merge:
|
||||||
|
sub
|
||||||
|
sub2
|
||||||
|
Please move or remove them before you can merge.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_expect_success 'will not overwrite untracked file in leading path' '
|
||||||
|
git reset --hard c0 &&
|
||||||
|
rm -rf sub &&
|
||||||
|
cp important sub &&
|
||||||
|
cp important sub2 &&
|
||||||
|
test_must_fail git merge sub 2>out &&
|
||||||
|
test_cmp out expect &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD &&
|
||||||
|
test_cmp important sub &&
|
||||||
|
test_cmp important sub2 &&
|
||||||
|
rm -f sub sub2
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure SYMLINKS 'will not overwrite untracked symlink in leading path' '
|
||||||
|
git reset --hard c0 &&
|
||||||
|
rm -rf sub &&
|
||||||
|
mkdir sub2 &&
|
||||||
|
ln -s sub2 sub &&
|
||||||
|
test_must_fail git merge sub &&
|
||||||
|
test_path_is_missing .git/MERGE_HEAD
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success SYMLINKS 'will not be confused by symlink in leading path' '
|
||||||
|
git reset --hard c0 &&
|
||||||
|
rm -rf sub &&
|
||||||
|
ln -s sub2 sub &&
|
||||||
|
git add sub &&
|
||||||
|
git commit -m ln &&
|
||||||
|
git checkout sub
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: Untracked working tree file 'c0.c' would be overwritten by merge.
|
error: Untracked working tree file 'c0.c' would be overwritten by merge.
|
||||||
fatal: read-tree failed
|
fatal: read-tree failed
|
||||||
|
@ -27,10 +27,10 @@ test_expect_success 'setup' '
|
|||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: The following untracked working tree files would be overwritten by merge:
|
error: The following untracked working tree files would be overwritten by merge:
|
||||||
two
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
five
|
||||||
|
four
|
||||||
|
three
|
||||||
|
two
|
||||||
Please move or remove them before you can merge.
|
Please move or remove them before you can merge.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -49,9 +49,9 @@ test_expect_success 'untracked files overwritten by merge (fast and non-fast for
|
|||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: Your local changes to the following files would be overwritten by merge:
|
error: Your local changes to the following files would be overwritten by merge:
|
||||||
two
|
|
||||||
three
|
|
||||||
four
|
four
|
||||||
|
three
|
||||||
|
two
|
||||||
Please, commit your changes or stash them before you can merge.
|
Please, commit your changes or stash them before you can merge.
|
||||||
error: The following untracked working tree files would be overwritten by merge:
|
error: The following untracked working tree files would be overwritten by merge:
|
||||||
five
|
five
|
||||||
@ -68,8 +68,8 @@ test_expect_success 'untracked files or local changes ovewritten by merge' '
|
|||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: Your local changes to the following files would be overwritten by checkout:
|
error: Your local changes to the following files would be overwritten by checkout:
|
||||||
rep/two
|
|
||||||
rep/one
|
rep/one
|
||||||
|
rep/two
|
||||||
Please, commit your changes or stash them before you can switch branches.
|
Please, commit your changes or stash them before you can switch branches.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -89,8 +89,8 @@ test_expect_success 'cannot switch branches because of local changes' '
|
|||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: Your local changes to the following files would be overwritten by checkout:
|
error: Your local changes to the following files would be overwritten by checkout:
|
||||||
rep/two
|
|
||||||
rep/one
|
rep/one
|
||||||
|
rep/two
|
||||||
Please, commit your changes or stash them before you can switch branches.
|
Please, commit your changes or stash them before you can switch branches.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ test_expect_success 'not uptodate file porcelain checkout error' '
|
|||||||
|
|
||||||
cat >expect <<\EOF
|
cat >expect <<\EOF
|
||||||
error: Updating the following directories would lose untracked files in it:
|
error: Updating the following directories would lose untracked files in it:
|
||||||
rep2
|
|
||||||
rep
|
rep
|
||||||
|
rep2
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use lib (split(/:/, $ENV{GITPERLLIB}));
|
use lib (split(/:/, $ENV{GITPERLLIB}));
|
||||||
|
|
||||||
use 5.006002;
|
use 5.008;
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
15
tag.c
15
tag.c
@ -4,6 +4,9 @@
|
|||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
|
|
||||||
|
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
||||||
|
#define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----"
|
||||||
|
|
||||||
const char *tag_type = "tag";
|
const char *tag_type = "tag";
|
||||||
|
|
||||||
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
||||||
@ -133,3 +136,15 @@ int parse_tag(struct tag *item)
|
|||||||
free(data);
|
free(data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t parse_signature(const char *buf, unsigned long size)
|
||||||
|
{
|
||||||
|
char *eol;
|
||||||
|
size_t len = 0;
|
||||||
|
while (len < size && prefixcmp(buf + len, PGP_SIGNATURE) &&
|
||||||
|
prefixcmp(buf + len, PGP_MESSAGE)) {
|
||||||
|
eol = memchr(buf + len, '\n', size - len);
|
||||||
|
len += eol ? eol - (buf + len) + 1 : size - len;
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
1
tag.h
1
tag.h
@ -16,5 +16,6 @@ extern struct tag *lookup_tag(const unsigned char *sha1);
|
|||||||
extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
|
extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
|
||||||
extern int parse_tag(struct tag *item);
|
extern int parse_tag(struct tag *item);
|
||||||
extern struct object *deref_tag(struct object *, const char *, int);
|
extern struct object *deref_tag(struct object *, const char *, int);
|
||||||
|
extern size_t parse_signature(const char *buf, unsigned long size);
|
||||||
|
|
||||||
#endif /* TAG_H */
|
#endif /* TAG_H */
|
||||||
|
155
unpack-trees.c
155
unpack-trees.c
@ -53,6 +53,7 @@ const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
|
|||||||
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
||||||
const char *cmd)
|
const char *cmd)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
const char **msgs = opts->msgs;
|
const char **msgs = opts->msgs;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@ -96,6 +97,9 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
|||||||
"The following Working tree files would be removed by sparse checkout update:\n%s";
|
"The following Working tree files would be removed by sparse checkout update:\n%s";
|
||||||
|
|
||||||
opts->show_all_errors = 1;
|
opts->show_all_errors = 1;
|
||||||
|
/* rejected paths may not have a static buffer */
|
||||||
|
for (i = 0; i < ARRAY_SIZE(opts->unpack_rejects); i++)
|
||||||
|
opts->unpack_rejects[i].strdup_strings = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
|
static void add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
|
||||||
@ -124,7 +128,6 @@ static int add_rejected_path(struct unpack_trees_options *o,
|
|||||||
enum unpack_trees_error_types e,
|
enum unpack_trees_error_types e,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
struct rejected_paths_list *newentry;
|
|
||||||
if (!o->show_all_errors)
|
if (!o->show_all_errors)
|
||||||
return error(ERRORMSG(o, e), path);
|
return error(ERRORMSG(o, e), path);
|
||||||
|
|
||||||
@ -132,45 +135,28 @@ static int add_rejected_path(struct unpack_trees_options *o,
|
|||||||
* Otherwise, insert in a list for future display by
|
* Otherwise, insert in a list for future display by
|
||||||
* display_error_msgs()
|
* display_error_msgs()
|
||||||
*/
|
*/
|
||||||
newentry = xmalloc(sizeof(struct rejected_paths_list));
|
string_list_append(&o->unpack_rejects[e], path);
|
||||||
newentry->path = (char *)path;
|
|
||||||
newentry->next = o->unpack_rejects[e];
|
|
||||||
o->unpack_rejects[e] = newentry;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* free all the structures allocated for the error <e>
|
|
||||||
*/
|
|
||||||
static void free_rejected_paths(struct unpack_trees_options *o,
|
|
||||||
enum unpack_trees_error_types e)
|
|
||||||
{
|
|
||||||
while (o->unpack_rejects[e]) {
|
|
||||||
struct rejected_paths_list *del = o->unpack_rejects[e];
|
|
||||||
o->unpack_rejects[e] = o->unpack_rejects[e]->next;
|
|
||||||
free(del);
|
|
||||||
}
|
|
||||||
free(o->unpack_rejects[e]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* display all the error messages stored in a nice way
|
* display all the error messages stored in a nice way
|
||||||
*/
|
*/
|
||||||
static void display_error_msgs(struct unpack_trees_options *o)
|
static void display_error_msgs(struct unpack_trees_options *o)
|
||||||
{
|
{
|
||||||
int e;
|
int e, i;
|
||||||
int something_displayed = 0;
|
int something_displayed = 0;
|
||||||
for (e = 0; e < NB_UNPACK_TREES_ERROR_TYPES; e++) {
|
for (e = 0; e < NB_UNPACK_TREES_ERROR_TYPES; e++) {
|
||||||
if (o->unpack_rejects[e]) {
|
struct string_list *rejects = &o->unpack_rejects[e];
|
||||||
struct rejected_paths_list *rp;
|
if (rejects->nr > 0) {
|
||||||
struct strbuf path = STRBUF_INIT;
|
struct strbuf path = STRBUF_INIT;
|
||||||
something_displayed = 1;
|
something_displayed = 1;
|
||||||
for (rp = o->unpack_rejects[e]; rp; rp = rp->next)
|
for (i = 0; i < rejects->nr; i++)
|
||||||
strbuf_addf(&path, "\t%s\n", rp->path);
|
strbuf_addf(&path, "\t%s\n", rejects->items[i].string);
|
||||||
error(ERRORMSG(o, e), path.buf);
|
error(ERRORMSG(o, e), path.buf);
|
||||||
strbuf_release(&path);
|
strbuf_release(&path);
|
||||||
free_rejected_paths(o, e);
|
|
||||||
}
|
}
|
||||||
|
string_list_clear(rejects, 0);
|
||||||
}
|
}
|
||||||
if (something_displayed)
|
if (something_displayed)
|
||||||
printf("Aborting\n");
|
printf("Aborting\n");
|
||||||
@ -182,7 +168,7 @@ static void display_error_msgs(struct unpack_trees_options *o)
|
|||||||
*/
|
*/
|
||||||
static void unlink_entry(struct cache_entry *ce)
|
static void unlink_entry(struct cache_entry *ce)
|
||||||
{
|
{
|
||||||
if (has_symlink_or_noent_leading_path(ce->name, ce_namelen(ce)))
|
if (!check_leading_path(ce->name, ce_namelen(ce)))
|
||||||
return;
|
return;
|
||||||
if (remove_or_warn(ce->ce_mode, ce->name))
|
if (remove_or_warn(ce->ce_mode, ce->name))
|
||||||
return;
|
return;
|
||||||
@ -1127,14 +1113,65 @@ static int verify_clean_subdirectory(struct cache_entry *ce,
|
|||||||
* See if we can find a case-insensitive match in the index that also
|
* See if we can find a case-insensitive match in the index that also
|
||||||
* matches the stat information, and assume it's that other file!
|
* matches the stat information, and assume it's that other file!
|
||||||
*/
|
*/
|
||||||
static int icase_exists(struct unpack_trees_options *o, struct cache_entry *dst, struct stat *st)
|
static int icase_exists(struct unpack_trees_options *o, const char *name, int len, struct stat *st)
|
||||||
{
|
{
|
||||||
struct cache_entry *src;
|
struct cache_entry *src;
|
||||||
|
|
||||||
src = index_name_exists(o->src_index, dst->name, ce_namelen(dst), 1);
|
src = index_name_exists(o->src_index, name, len, 1);
|
||||||
return src && !ie_match_stat(o->src_index, src, st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
|
return src && !ie_match_stat(o->src_index, src, st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int check_ok_to_remove(const char *name, int len, int dtype,
|
||||||
|
struct cache_entry *ce, struct stat *st,
|
||||||
|
enum unpack_trees_error_types error_type,
|
||||||
|
struct unpack_trees_options *o)
|
||||||
|
{
|
||||||
|
struct cache_entry *result;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It may be that the 'lstat()' succeeded even though
|
||||||
|
* target 'ce' was absent, because there is an old
|
||||||
|
* entry that is different only in case..
|
||||||
|
*
|
||||||
|
* Ignore that lstat() if it matches.
|
||||||
|
*/
|
||||||
|
if (ignore_case && icase_exists(o, name, len, st))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (o->dir && excluded(o->dir, name, &dtype))
|
||||||
|
/*
|
||||||
|
* ce->name is explicitly excluded, so it is Ok to
|
||||||
|
* overwrite it.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
if (S_ISDIR(st->st_mode)) {
|
||||||
|
/*
|
||||||
|
* We are checking out path "foo" and
|
||||||
|
* found "foo/." in the working tree.
|
||||||
|
* This is tricky -- if we have modified
|
||||||
|
* files that are in "foo/" we would lose
|
||||||
|
* them.
|
||||||
|
*/
|
||||||
|
if (verify_clean_subdirectory(ce, error_type, o) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The previous round may already have decided to
|
||||||
|
* delete this path, which is in a subdirectory that
|
||||||
|
* is being replaced with a blob.
|
||||||
|
*/
|
||||||
|
result = index_name_exists(&o->result, name, len, 0);
|
||||||
|
if (result) {
|
||||||
|
if (result->ce_flags & CE_REMOVE)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return o->gently ? -1 :
|
||||||
|
add_rejected_path(o, error_type, name);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We do not want to remove or overwrite a working tree file that
|
* We do not want to remove or overwrite a working tree file that
|
||||||
* is not tracked, unless it is ignored.
|
* is not tracked, unless it is ignored.
|
||||||
@ -1143,63 +1180,31 @@ static int verify_absent_1(struct cache_entry *ce,
|
|||||||
enum unpack_trees_error_types error_type,
|
enum unpack_trees_error_types error_type,
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (o->index_only || o->reset || !o->update)
|
if (o->index_only || o->reset || !o->update)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (has_symlink_or_noent_leading_path(ce->name, ce_namelen(ce)))
|
len = check_leading_path(ce->name, ce_namelen(ce));
|
||||||
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
else if (len > 0) {
|
||||||
|
char path[PATH_MAX + 1];
|
||||||
|
memcpy(path, ce->name, len);
|
||||||
|
path[len] = 0;
|
||||||
|
lstat(path, &st);
|
||||||
|
|
||||||
if (!lstat(ce->name, &st)) {
|
return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
|
||||||
int dtype = ce_to_dtype(ce);
|
error_type, o);
|
||||||
struct cache_entry *result;
|
} else if (!lstat(ce->name, &st))
|
||||||
|
return check_ok_to_remove(ce->name, ce_namelen(ce),
|
||||||
|
ce_to_dtype(ce), ce, &st,
|
||||||
|
error_type, o);
|
||||||
|
|
||||||
/*
|
|
||||||
* It may be that the 'lstat()' succeeded even though
|
|
||||||
* target 'ce' was absent, because there is an old
|
|
||||||
* entry that is different only in case..
|
|
||||||
*
|
|
||||||
* Ignore that lstat() if it matches.
|
|
||||||
*/
|
|
||||||
if (ignore_case && icase_exists(o, ce, &st))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (o->dir && excluded(o->dir, ce->name, &dtype))
|
|
||||||
/*
|
|
||||||
* ce->name is explicitly excluded, so it is Ok to
|
|
||||||
* overwrite it.
|
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
|
||||||
/*
|
|
||||||
* We are checking out path "foo" and
|
|
||||||
* found "foo/." in the working tree.
|
|
||||||
* This is tricky -- if we have modified
|
|
||||||
* files that are in "foo/" we would lose
|
|
||||||
* them.
|
|
||||||
*/
|
|
||||||
if (verify_clean_subdirectory(ce, error_type, o) < 0)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The previous round may already have decided to
|
|
||||||
* delete this path, which is in a subdirectory that
|
|
||||||
* is being replaced with a blob.
|
|
||||||
*/
|
|
||||||
result = index_name_exists(&o->result, ce->name, ce_namelen(ce), 0);
|
|
||||||
if (result) {
|
|
||||||
if (result->ce_flags & CE_REMOVE)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return o->gently ? -1 :
|
|
||||||
add_rejected_path(o, error_type, ce->name);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_absent(struct cache_entry *ce,
|
static int verify_absent(struct cache_entry *ce,
|
||||||
enum unpack_trees_error_types error_type,
|
enum unpack_trees_error_types error_type,
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef UNPACK_TREES_H
|
#ifndef UNPACK_TREES_H
|
||||||
#define UNPACK_TREES_H
|
#define UNPACK_TREES_H
|
||||||
|
|
||||||
|
#include "string-list.h"
|
||||||
|
|
||||||
#define MAX_UNPACK_TREES 8
|
#define MAX_UNPACK_TREES 8
|
||||||
|
|
||||||
struct unpack_trees_options;
|
struct unpack_trees_options;
|
||||||
@ -29,11 +31,6 @@ enum unpack_trees_error_types {
|
|||||||
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
||||||
const char *cmd);
|
const char *cmd);
|
||||||
|
|
||||||
struct rejected_paths_list {
|
|
||||||
char *path;
|
|
||||||
struct rejected_paths_list *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct unpack_trees_options {
|
struct unpack_trees_options {
|
||||||
unsigned int reset,
|
unsigned int reset,
|
||||||
merge,
|
merge,
|
||||||
@ -59,7 +56,7 @@ struct unpack_trees_options {
|
|||||||
* Store error messages in an array, each case
|
* Store error messages in an array, each case
|
||||||
* corresponding to a error message type
|
* corresponding to a error message type
|
||||||
*/
|
*/
|
||||||
struct rejected_paths_list *unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
|
struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
|
||||||
|
|
||||||
int head_idx;
|
int head_idx;
|
||||||
int merge_size;
|
int merge_size;
|
||||||
|
14
url.c
14
url.c
@ -125,3 +125,17 @@ char *url_decode_parameter_value(const char **query)
|
|||||||
struct strbuf out = STRBUF_INIT;
|
struct strbuf out = STRBUF_INIT;
|
||||||
return url_decode_internal(query, "&", &out, 1);
|
return url_decode_internal(query, "&", &out, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void end_url_with_slash(struct strbuf *buf, const char *url)
|
||||||
|
{
|
||||||
|
strbuf_addstr(buf, url);
|
||||||
|
if (buf->len && buf->buf[buf->len - 1] != '/')
|
||||||
|
strbuf_addstr(buf, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
void str_end_url_with_slash(const char *url, char **dest) {
|
||||||
|
struct strbuf buf = STRBUF_INIT;
|
||||||
|
end_url_with_slash(&buf, url);
|
||||||
|
free(*dest);
|
||||||
|
*dest = strbuf_detach(&buf, NULL);
|
||||||
|
}
|
||||||
|
3
url.h
3
url.h
@ -7,4 +7,7 @@ extern char *url_decode(const char *url);
|
|||||||
extern char *url_decode_parameter_name(const char **query);
|
extern char *url_decode_parameter_name(const char **query);
|
||||||
extern char *url_decode_parameter_value(const char **query);
|
extern char *url_decode_parameter_value(const char **query);
|
||||||
|
|
||||||
|
extern void end_url_with_slash(struct strbuf *buf, const char *url);
|
||||||
|
extern void str_end_url_with_slash(const char *url, char **dest);
|
||||||
|
|
||||||
#endif /* URL_H */
|
#endif /* URL_H */
|
||||||
|
Reference in New Issue
Block a user