]> granicus.if.org Git - cgit/log
cgit
11 years agoui-summary: Disallow directory traversal
Jason A. Donenfeld [Sat, 25 May 2013 17:47:15 +0000 (19:47 +0200)]
ui-summary: Disallow directory traversal

Using the url= query string, it was possible request arbitrary files
from the filesystem if the readme for a given page was set to a
filesystem file. The following request would return my /etc/passwd file:

http://git.zx2c4.com/?url=/somerepo/about/../../../../etc/passwd
http://data.zx2c4.com/cgit-directory-traversal.png

This fix uses realpath(3) to canonicalize all paths, and then compares
the base components.

This fix introduces a subtle timing attack, whereby a client can check
whether or not strstr is called using timing measurements in order
to determine if a given file exists on the filesystem.

This fix also does not account for filesystem race conditions (TOCTOU)
in resolving symlinks.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agocgitrc.5: information on directory traversal and multiple readme files
Jason A. Donenfeld [Sat, 25 May 2013 18:30:57 +0000 (20:30 +0200)]
cgitrc.5: information on directory traversal and multiple readme files

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoreadme: Accept multiple candidates and test them.
Jason A. Donenfeld [Sat, 25 May 2013 14:32:37 +0000 (16:32 +0200)]
readme: Accept multiple candidates and test them.

The readme variable may now contain multiple space deliminated entries,
which per usual are either a filepath or a git ref filepath. If multiple
are specified, cgit will now select the first one in the list that
exists. This is to make it easier to specify multiple default readme
types in the main cgitrc file and have them automatically get applied to
each repo based on what exists.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoui-summary: Pass filename to about-filter
Jason A. Donenfeld [Sat, 25 May 2013 12:50:19 +0000 (14:50 +0200)]
ui-summary: Pass filename to about-filter

This gives the about-filter API the same semantics as source-filter,
where the filter receives the filename so it can decide what to do next
with it.

While we're at it, plug a memory leak.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoui-summary: Use default branch for readme if : prefix
Jason A. Donenfeld [Sat, 25 May 2013 12:19:10 +0000 (14:19 +0200)]
ui-summary: Use default branch for readme if : prefix

If the readme value begins with ":", and has no specified branch before
it, use the repository's default branch.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agocgit.c: Do not reset HOME after unsetting it.
Jason A. Donenfeld [Sat, 25 May 2013 17:25:56 +0000 (19:25 +0200)]
cgit.c: Do not reset HOME after unsetting it.

The number of odd cases in which git will try to read config is far too
great to keep putting a bandaid over each one, so we'll just unset it.

If it turns out that scripts really liked to know about $HOME, we can
always reset it in the filter forks.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agocgit.c: sync repo config printing with struct cgit_repo
Jason A. Donenfeld [Sat, 25 May 2013 12:05:06 +0000 (14:05 +0200)]
cgit.c: sync repo config printing with struct cgit_repo

We've now added quite a few config keys for repositories, but we've
forgotten to update the printing of it for cache files. Synchronize the
two.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agogit: update to 1.8.3
John Keeping [Sat, 25 May 2013 10:19:00 +0000 (11:19 +0100)]
git: update to 1.8.3

No changes required, just bump the submodule and Makefile versions.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocache.c: cache ls_cache output properly
John Keeping [Sat, 18 May 2013 17:46:39 +0000 (18:46 +0100)]
cache.c: cache ls_cache output properly

By using the standard library's printf, cache_ls does not redirect its
output to the cache when we change the process' stdout file descriptor
to point to the cache file.  Fix this by using "htmlf" in the same way
that we do for writing HTTP headers.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agotests: introduce strip_header() helper function
John Keeping [Sat, 18 May 2013 17:46:38 +0000 (18:46 +0100)]
tests: introduce strip_header() helper function

This means that we can avoid hardcoding the number of headers we expect
CGit to generate in test cases and simply remove whatever headers happen
to by there when we are checking body content.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoshared.c: use die_errno() where appropriate
John Keeping [Sat, 18 May 2013 15:21:36 +0000 (16:21 +0100)]
shared.c: use die_errno() where appropriate

This replaces some code that is re-implementing die_errno by just
calling the function.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agohtml.c: die when write fails
John Keeping [Sat, 18 May 2013 14:57:03 +0000 (15:57 +0100)]
html.c: die when write fails

If we fail to write HTML output once, there's no point carrying on so
just write a failure message once and die.  By using Git's die_errno
function we also let the user know in what way the write failed.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoui-log: add <span/> around commit decorations
John Keeping [Sat, 18 May 2013 14:54:49 +0000 (15:54 +0100)]
ui-log: add <span/> around commit decorations

This helps projects that have a large number of tags to display them all
using custom CSS.

The default stylesheet has not been updated since what is useful for
projects with a lot of tags is not the same as what is useful for
projects with only a small number of decorations per commit.

Suggested-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMakefile: fix parallel "make test"
John Keeping [Sat, 18 May 2013 14:17:08 +0000 (15:17 +0100)]
Makefile: fix parallel "make test"

When building the "test" target we depend on both cgit and building the
Git tools.  By doing this with two targets we end up running make in the
git/ directory twice, concurrently if using parallel make, which causes
us to build more than we need and potentially builds incorrectly if
multi-step build-then-move operations overlap.

Fix this by instead calling back into the makefile so that we alter the
"cgit" target to also build the Git tools.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocache.c: fix cache_ls
John Keeping [Sat, 18 May 2013 17:28:14 +0000 (18:28 +0100)]
cache.c: fix cache_ls

Commit fb3655d (use struct strbuf instead of static buffers, 2013-04-06)
broke the logic in cache.c::cache_ls by failing to set slot->cache_name
before calling open_slot.

While fixing this, also free the strbufs added by that commit once we're
done with them.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agot0109: "function" is a bash-ism
John Keeping [Thu, 9 May 2013 18:40:58 +0000 (19:40 +0100)]
t0109: "function" is a bash-ism

We try to stick to POSIX shell in the tests but a "function" keyword has
found its way into t0109.  Remove it.

This makes the tests work with dash again.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoNew mailing list.
Jason A. Donenfeld [Mon, 13 May 2013 12:00:50 +0000 (14:00 +0200)]
New mailing list.

11 years agoui-snapshot: do not access $HOME
Jason A. Donenfeld [Tue, 30 Apr 2013 10:27:41 +0000 (12:27 +0200)]
ui-snapshot: do not access $HOME

It's a bit tedious to have to do this here too. If we encounter other
issues with $HOME down the line, I'll look into adding some nice utility
functions to handle this, or perhaps giving up on the hope that we could
keep $HOME defined for scripts.

This commit additionally adds a test case, should the issue surface
again.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agot0001: validate Git -rcN version numbers correctly
John Keeping [Sat, 27 Apr 2013 09:48:56 +0000 (10:48 +0100)]
t0001: validate Git -rcN version numbers correctly

When creating the GIT-VERSION-FILE that we use to test that the version
of Git in git/ is the same as in the CGit Makefile, Git applies the
transform "s/-/./g" to the version string.  This doesn't affect released
versions but does change RC version numbers such as 1.8.3-rc0.

While CGit should only refer to a released Git version in general, it is
useful to developers who want to test upcoming Git releases if the tests
do work with RCs, so change t0001 to apply the same transform to our
Makefile version before comparing it to the contents of
GIT-VERSION-FILE.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agogit: update to 1.8.2.2
John Keeping [Sat, 27 Apr 2013 09:20:16 +0000 (10:20 +0100)]
git: update to 1.8.2.2

No changes required, just bump the submodule and Makefile version.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoscan-tree: fix regression in section-from-path=-1
John Keeping [Tue, 16 Apr 2013 17:39:58 +0000 (18:39 +0100)]
scan-tree: fix regression in section-from-path=-1

Commit fb3655d (use struct strbuf instead of static buffers -
2013-04-06) introduced a regression in the "section-from-path" handling
when the configured value is negative.  By changing the "rel" variable
so that it includes a trailing slash, counting slashes from the end of
the string no longer gives the same answer as it did before.

Fix this by ensuring that "rel" does not have a trailing slash.

Reported-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agot0001: ignore ".dirty" suffix on Git version
John Keeping [Sun, 14 Apr 2013 18:15:43 +0000 (19:15 +0100)]
t0001: ignore ".dirty" suffix on Git version

When testing modifications in Git that affect CGit, it is annoying to
have t0001 failing simply because the Git version has a ".dirty" suffix
when the version of Git there does indeed match that specified in the
CGit makefile.  Stop this by stripping the ".dirty" suffix from the
GIT_VERSION variable.

Note that this brings the "Git version" behaviour in line with the
"submodule version" case which does not check if the working tree in
git/ is modified.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agotests: set TEST_OUTPUT_DIRECTORY to the CGit test directory
John Keeping [Sun, 14 Apr 2013 16:59:30 +0000 (17:59 +0100)]
tests: set TEST_OUTPUT_DIRECTORY to the CGit test directory

By default, Git's test suite puts the trash directories and test-results
directory into its own directory, not that containing the tests being
run.  This is less convenient for inspecting test failures, so set the
output directory to CGit's tests/ directory instead.

Note that there is currently a bug in Git whereby it will create the
trash directories in our tests/ directory regardless of the value of
TEST_OUTPUT_DIRECTORY, and then fail to remove them once the tests are
done.  This change does currently affect the location of the
test-results/ directory though.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agot0109: test more URLs
John Keeping [Sun, 14 Apr 2013 16:07:41 +0000 (17:07 +0100)]
t0109: test more URLs

In order to ensure that we don't access $HOME at some point after
initial startup when rendering a specific view, run the strace test on a
range of different pages.

This ensures that we don't end up reading a configuration later for some
specific view.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocgitrc.5.txt: Specify when scan-path must be defined before.
Jason A. Donenfeld [Wed, 10 Apr 2013 12:42:49 +0000 (14:42 +0200)]
cgitrc.5.txt: Specify when scan-path must be defined before.

Several options must be specified prior to scan-path. This is consistant
source of user confusion. Document these facts.

Suggested-by: Lukas Fleischer <cgit@cryptocrack.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoui-snapshot.c: Prepend "V" when guessing ref names
Lukas Fleischer [Wed, 10 Apr 2013 11:04:03 +0000 (13:04 +0200)]
ui-snapshot.c: Prepend "V" when guessing ref names

In cgit_print_snapshot_links() we strip leading "v" and "V", while we
currently only prepend a lower case "v" when parsing a snapshot file
name. This results in broken snapshot links for tags that start with an
upper case "V". Avoid this by prepending a "V" as a fallback.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agot0107: Skip ZIP tests if unzip(1) isn't available
Lukas Fleischer [Tue, 9 Apr 2013 18:02:33 +0000 (20:02 +0200)]
t0107: Skip ZIP tests if unzip(1) isn't available

Note that we cannot use skip_all here since some tests have already been
executed when ZIP tests are reached. Use test prerequisites to skip
everything using unzip(1) if the binary is not available instead.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agotests/: Do not use `sed -i`
Lukas Fleischer [Tue, 9 Apr 2013 18:02:32 +0000 (20:02 +0200)]
tests/: Do not use `sed -i`

"-i" isn't part of the POSIX standard and doesn't work on several
platforms such as OpenBSD. Use a temporary file instead.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoAdd branch-sort and repo.branch-sort options.
Jason A. Donenfeld [Mon, 8 Apr 2013 14:57:12 +0000 (16:57 +0200)]
Add branch-sort and repo.branch-sort options.

When set to "name", branches are sorted by name, which is the current
default. When set to "age", branches are sorted by the age of the
repository.

This feature was requested by Konstantin Ryabitsev for use on
kernel.org.

Proposed-by: Konstantin Ryabitsev <mricon@kernel.org>
11 years agot0109: chain operations with &&
John Keeping [Wed, 10 Apr 2013 12:11:57 +0000 (13:11 +0100)]
t0109: chain operations with &&

Without '&&' between operations, we will not detect if strace or cgit
exit with an error status, which would cause a false positive test
status in this case.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocgit.c: Do not restore unset environment variables
Lukas Fleischer [Wed, 10 Apr 2013 10:30:52 +0000 (12:30 +0200)]
cgit.c: Do not restore unset environment variables

getenv() returns a NULL pointer if the specified variable name cannot be
found in the environment. However, some setenv() implementations crash
if a NULL pointer is passed as second argument. Only restore variables
that are not NULL.

See commit d96d2c98ebc4c2d3765f5b35c4142e0e828a421b for a related patch.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agot0107: Use `tar -z` for gzip'ed archives
Lukas Fleischer [Mon, 8 Apr 2013 22:13:52 +0000 (00:13 +0200)]
t0107: Use `tar -z` for gzip'ed archives

Some tar(1) versions do not support auto detection of the compression
type. Explicitly specify "-z" to decompress a ".tar.gz" archive.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agotests: Make sure that git does not access $HOME
Jason A. Donenfeld [Mon, 8 Apr 2013 20:18:21 +0000 (22:18 +0200)]
tests: Make sure that git does not access $HOME

With the latest changes to prevent git from accessing configuration
files that it should not, it's important to be sure that we won't
have further breakage in the future.

Use strace to implement a test to make sure cgit does not access()
anything built from $HOME.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agotests/.gitignore: update for using Git's test infrastructure
John Keeping [Mon, 8 Apr 2013 19:12:34 +0000 (20:12 +0100)]
tests/.gitignore: update for using Git's test infrastructure

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agotests: use Git's test framework
John Keeping [Mon, 1 Apr 2013 14:09:05 +0000 (15:09 +0100)]
tests: use Git's test framework

This allows tests to run in parallel as well as letting us use "prove"
or another TAP harness to run the tests.

Git's test framework requires Git to be fully built before letting any
tests run, so add a new target to the top-level Makefile which builds
all of Git instead of just libgit.a and make the "test" target depend on
that.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoDo not load user or system gitconfig and gitattributes
Jason A. Donenfeld [Mon, 8 Apr 2013 19:12:19 +0000 (21:12 +0200)]
Do not load user or system gitconfig and gitattributes

While doing any kind of git loading, unset HOME variables and set
NOSYSTEM variables so that cgit does not load any settings that a user
may have set for his own /usr/bin/git usage.

This fixes a fatal error introduced with git 1.8, whereupon git would
fatally exit when failing to access particular files.

The result of this is that only repo-local configuration files are
accessed:

zx2c4@thinkpad ~/Projects/cgit $ HOME=/root QUERY_STRING="url=foo/log"
CGIT_CONFIG=tests/trash/cgitrc strace -e access ./cgit >/dev/null
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
access("repos/foo/.git/objects", X_OK) = 0
access("repos/foo/.git/refs", X_OK) = 0
access("repos/foo/.git/config", R_OK) = 0
access("repos/foo/.git/config", R_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
access("repos/foo/.git/objects/b3/bafdbf0183f4897ef8b1319cb8c490ed54717e", F_OK) = 0
+++ exited with 0 +++

Reported-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agouse struct strbuf instead of static buffers
John Keeping [Sat, 6 Apr 2013 09:28:57 +0000 (10:28 +0100)]
use struct strbuf instead of static buffers

Use "struct strbuf" from Git to remove the limit on file path length.

Notes on scan-tree:
This is slightly involved since I decided to pass the strbuf into
add_repo() and modify if whenever a new file name is required, which
should avoid any extra allocations within that function.  The pattern
there is to append the filename, use it and then reset the buffer to its
original length (retaining a trailing '/').

Notes on ui-snapshot:
Since write_archive modifies the argv array passed to it we
copy the argv_array values into a new array of char* and then free the
original argv_array structure and the new array without worrying about
what the values now look like.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoRemove redundant calls to fmt("%s", ...)
John Keeping [Sat, 6 Apr 2013 09:49:22 +0000 (10:49 +0100)]
Remove redundant calls to fmt("%s", ...)

After this change there is one remaining call 'fmt("%s", delim)' in
ui-shared.c but is needed as delim is stack allocated and so cannot be
returned from the function.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoConvert cgit_print_error to a variadic function
John Keeping [Sat, 6 Apr 2013 10:23:52 +0000 (11:23 +0100)]
Convert cgit_print_error to a variadic function

This removes many uses of "fmt" which uses a fixed size static pool of
fixed size buffers.  Instead of relying on these, we now pass around
argument lists for as long as possible before using a strbuf to render
content of an arbitrary size.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoshared.c: add strbuf_ensure_end
John Keeping [Sun, 7 Apr 2013 13:03:47 +0000 (14:03 +0100)]
shared.c: add strbuf_ensure_end

This is a small helper so that we can easily ensure that a strbuf ends
with the specified character.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agohtml.c: add various strbuf and varadic helpers
John Keeping [Sun, 7 Apr 2013 13:40:50 +0000 (14:40 +0100)]
html.c: add various strbuf and varadic helpers

This adds the fmtalloc helper, html_txtf, html_vtxtf, and html_attrf.

These takes a printf style format string like htmlf but escapes the
resulting string.  The html_vtxtf variant takes a va_list whereas
html_txtf is variadic.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMark char* fields in struct cgit_page as const
John Keeping [Sun, 7 Apr 2013 11:46:45 +0000 (12:46 +0100)]
Mark char* fields in struct cgit_page as const

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoFix out-of-bounds memory accesses with virtual_root=""
John Keeping [Mon, 1 Apr 2013 18:03:34 +0000 (19:03 +0100)]
Fix out-of-bounds memory accesses with virtual_root=""

The CGit configuration variable virtual_root is normalized so that it
does not have a trailing '/' character, but it is allowed to be empty
(the empty string and NULL have different meanings here) and there is
code that is insufficiently cautious when checking if it ends in a '/':

if (virtual_root[strlen(virtual_root) - 1] != '/')

Clearly this check is redundant, but rather than simply removing it we
get a slight efficiency improvement by switching the normalization so
that the virtual_root variable always ends in '/'.  Do this with a new
"ensure_end" helper.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoui-refs.c: Refactor print_tag()
Lukas Fleischer [Sat, 6 Apr 2013 21:39:08 +0000 (23:39 +0200)]
ui-refs.c: Refactor print_tag()

The code snippets for OBJ_TAG and other object types are almost
equivalent. Merge them and use a couple of inline if conditions to
select proper fields.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-refs.c: Remove global header variable
Lukas Fleischer [Sat, 6 Apr 2013 21:39:07 +0000 (23:39 +0200)]
ui-refs.c: Remove global header variable

print_tag_header() is only called from cgit_print_tags() -- the
conditional invocation in print_tag() is never executed since
print_tag() is only called by cgit_print_tags() which already executes
print_tag_header() before (resulting in the global variable being always
set in when the condition is evaluated).

Remove the global variable and the conditional invocation.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agohtml.c: Replace strdup() with xstrdup()
Lukas Fleischer [Sat, 6 Apr 2013 11:30:54 +0000 (13:30 +0200)]
html.c: Replace strdup() with xstrdup()

Use the xstrdup() wrapper which already bails out if strdup() returns a
NULL pointer.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoAlways #include corresponding .h in .c files
John Keeping [Sat, 6 Apr 2013 10:37:59 +0000 (11:37 +0100)]
Always #include corresponding .h in .c files

While doing this, remove declarations from header files where the
corresponding definition is declared "static" in order to avoid build
errors.

Also re-order existing headers in ui-*.c so that the file-specific
header always comes immediately after "cgit.h", helping with future
consistency.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocgit.mk: fix dependency handling
John Keeping [Thu, 4 Apr 2013 17:32:24 +0000 (18:32 +0100)]
cgit.mk: fix dependency handling

Git calculates the dependency files to be included using a simply
expanded Makefile variable, so it does not include the CGit objects that
are added after that Makefile has been processed.

We therefore need to include the dependency files ourselves in order to
get the dependency calculations right.  Do this.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMakefile: re-include cgit.conf in cgit.mk
John Keeping [Mon, 1 Apr 2013 13:14:12 +0000 (14:14 +0100)]
Makefile: re-include cgit.conf in cgit.mk

This avoids needed to export every variable that might be used in
cgit.mk from the top-level Makefile.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoDo not unnecessarily strdup() environment variables
Lukas Fleischer [Mon, 1 Apr 2013 15:11:15 +0000 (17:11 +0200)]
Do not unnecessarily strdup() environment variables

This reverts the memory duplication introduced in commit 60a2627, while
keeping everything else that has been cleaned up. The environment
variables are never modified, so we do not need to call xstrdupn() here.

Also, remove xstrdupn() which is no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoMaŕk cgit_environment members const
Lukas Fleischer [Mon, 1 Apr 2013 15:11:14 +0000 (17:11 +0200)]
MaÅ•k cgit_environment members const

These reflect the values of environment variables and should never be
changed. Add another xstrdup() when we assign environment variables to
strings that are potentially non-constant.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoReturn const char * in cgit_{httpscheme, hosturl, rooturl}()
Lukas Fleischer [Mon, 1 Apr 2013 15:11:13 +0000 (17:11 +0200)]
Return const char * in cgit_{httpscheme, hosturl, rooturl}()

The return values of these functions are essentially constant and should
never be modified.

Note that this will introduce a compiler warning when we try to free the
return value of any of these functions. However, given that all of these
currently return statically allocated strings in some cases, they need
to be refactored before this can be done anyway.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoUpdate git to v1.8.2.1
John Keeping [Mon, 8 Apr 2013 08:00:22 +0000 (09:00 +0100)]
Update git to v1.8.2.1

This requires a small change to how we handle notes, but otherwise just
works.

Note that we can't use anything from v1.8.0 until v1.8.2.1 because some
of the symbols that we need for graph drawing were made private in
v1.8.0 and this was not reverted until v1.8.2.1.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoui-blob: don't segfault when no path is given
John Keeping [Sun, 7 Apr 2013 14:06:23 +0000 (15:06 +0100)]
ui-blob: don't segfault when no path is given

It it possible to inspect blobs by specifying only the SHA-1, and CGit
provides links to do so, for example if a tag points directly at a blob.
In this case the path_items structure is never used, but creating it
still causes strlen to be run on a null pointer.  Fix this.

This error was introduced by commit c1633c6 (Update git to v1.7.6.5 -
2013-03-02).

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoConvert pager navigation into a unordered list
Lukas Fleischer [Thu, 7 Mar 2013 07:56:22 +0000 (08:56 +0100)]
Convert pager navigation into a unordered list

It is common practice and semantically appropriate to use unordered
lists for long navigation lists.

This also fixes the layout of very long pager navigations in
Webkit-based browsers.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoMakefile: remove CGIT-CFLAGS files in clean stage
Jason A. Donenfeld [Wed, 20 Mar 2013 20:14:22 +0000 (21:14 +0100)]
Makefile: remove CGIT-CFLAGS files in clean stage

11 years agoui-summary.c: Move urls variable into print_urls()
Lukas Fleischer [Tue, 5 Mar 2013 15:48:27 +0000 (16:48 +0100)]
ui-summary.c: Move urls variable into print_urls()

There's no need for this variable to be global. Printing the header in
print_urls() instead of print_url() allows for moving this variable into
print_urls() without having to pass any status to print_url().

Note that this only works as long as we don't call print_urls() more
than once.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoFix colspan values
Lukas Fleischer [Tue, 5 Mar 2013 14:42:14 +0000 (15:42 +0100)]
Fix colspan values

This fixes a couple of minor oversights in previous commits and adjusts
all cells using colspan to use the correct width.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agohtml: check return value of write
Jason A. Donenfeld [Wed, 20 Mar 2013 19:44:20 +0000 (20:44 +0100)]
html: check return value of write

This squelches a gcc warning. It's also correct that we check to see if
there are any partial or failed writes. For now, we just print a warning
to stderr. In the future, perhaps it will prove wise to exit(1) on
partial writes.

11 years agoui-shared: squelch compiler warning.
Jason A. Donenfeld [Wed, 20 Mar 2013 19:43:13 +0000 (20:43 +0100)]
ui-shared: squelch compiler warning.

Since tail is initialized to 0, we will never get a warning on the last
if statement, but recent gcc complains anyway. So, we initialize len as
well. Future gcc versions should be able to optimize this out anyway.

11 years agocgit.mk: Use SHELL_PATH_SQ to run gen-version.sh
John Keeping [Wed, 6 Mar 2013 21:22:09 +0000 (21:22 +0000)]
cgit.mk: Use SHELL_PATH_SQ to run gen-version.sh

On some platforms (notably Solaris) /bin/sh doesn't support enough of
POSIX for gen-version.sh to run.  Git's Makefile provides SHELL_PATH_SQ
to address this issue so we just have to use it.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocgit.mk: don't rebuild everything if CGIT_VERSION changes
John Keeping [Wed, 6 Mar 2013 21:22:08 +0000 (21:22 +0000)]
cgit.mk: don't rebuild everything if CGIT_VERSION changes

If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example
because you have committed your changes) causes all of the CGit objects
to be rebuilt.  Avoid this by using EXTRA_CPPFLAGS to add the version
for only those files that are affected and make them depend on VERSION.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoui-patch: use cgit_version not CGIT_VERSION
John Keeping [Wed, 6 Mar 2013 21:22:07 +0000 (21:22 +0000)]
ui-patch: use cgit_version not CGIT_VERSION

We already have a global cgit_version which is set from the #define'd
CGIT_VERSION in cgit.c.  Change ui-patch.c to use this so that we only
need to rebuild cgit.o when the version changes.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMakefile: re-use Git's Makefile where possible
John Keeping [Wed, 6 Mar 2013 21:22:06 +0000 (21:22 +0000)]
Makefile: re-use Git's Makefile where possible

Git does quite a lot of platform-specific detection in its Makefile,
which can result in it defining preprocessor variables that are used in
its header files.  If CGit does not define the same variables it can
result in different sizes of some structures in different places in the
same application.

For example, on Solaris Git uses it's "compat" regex library which has a
different sized regex_t structure than that available in the platform
regex.h.  This has a knock-on effect on the size of "struct rev_info"
and leads to hard to diagnose runtime issues.

In order to avoid all of this, introduce a "cgit.mk" file that includes
Git's Makefile and make all of the existing logic apply to CGit's
objects as well.  This is slightly complicated because Git's Makefile
must run in Git's directory, so all references to CGit files need to be
prefixed with "../".

In addition, OBJECTS is a simply expanded variable in Git's Makefile so
we cannot just add our objects to it.  Instead we must copy the two
applicable rules into "cgit.mk".  This has the advantage that we can
split CGit-specific CFLAGS from Git's CFLAGS and hence avoid rebuilding
all of Git whenever a CGit-specific value changes.

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Jamie Couture <jamie.couture@gmail.com>
11 years agotests: check that Git version are in sync
John Keeping [Tue, 19 Mar 2013 20:00:29 +0000 (20:00 +0000)]
tests: check that Git version are in sync

This ensures that the Git version pointed at by the submodule is the
same as the one that will be fetched using "make get-git".

Suggested-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMerge branch 'wip'
Jason A. Donenfeld [Wed, 20 Mar 2013 19:21:25 +0000 (20:21 +0100)]
Merge branch 'wip'

11 years agoui-shared: fix return type of cgit_self_link
John Keeping [Wed, 6 Mar 2013 20:51:54 +0000 (20:51 +0000)]
ui-shared: fix return type of cgit_self_link

cgit_self_link() is a void function but implements each case it handles
by doing "return <another_void_function>" which is not valid C; section
6.8.6.4 of C11 says:

A return statement with an expression shall not appear in a
function whose return type is void.

Fix this by removing the return keywords and converting the final code
block into an "else".

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agocgit_print_snapshot_links(): Free prefix variable
Lukas Fleischer [Mon, 4 Mar 2013 12:25:38 +0000 (13:25 +0100)]
cgit_print_snapshot_links(): Free prefix variable

Fixes following memory leak seen with "PATH_INFO=/cgit/commit/":

    ==16894== 12 bytes in 1 blocks are definitely lost in loss record 9 of 92
    ==16894==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==16894==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==16894==    by 0x46CAC8: xstrdup (wrapper.c:35)
    ==16894==    by 0x414E34: cgit_print_snapshot_links (ui-shared.c:926)
    ==16894==    by 0x40CFA1: cgit_print_commit (ui-commit.c:102)
    ==16894==    by 0x407B06: commit_fn (cmd.c:54)
    ==16894==    by 0x405E16: process_request (cgit.c:574)
    ==16894==    by 0x4074C8: cache_process (cache.c:322)
    ==16894==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agocgit_print_commit(): Free tmp variable
Lukas Fleischer [Mon, 4 Mar 2013 12:25:37 +0000 (13:25 +0100)]
cgit_print_commit(): Free tmp variable

Fixes following memory leak seen with "PATH_INFO=/cgit/commit/":

    ==16894== 7 bytes in 1 blocks are definitely lost in loss record 4 of 92
    ==16894==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==16894==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==16894==    by 0x46CAC8: xstrdup (wrapper.c:35)
    ==16894==    by 0x40CD6F: cgit_print_commit (ui-commit.c:70)
    ==16894==    by 0x407B06: commit_fn (cmd.c:54)
    ==16894==    by 0x405E16: process_request (cgit.c:574)
    ==16894==    by 0x4074C8: cache_process (cache.c:322)
    ==16894==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agocgit_print_tree(): Free curr_rev after usage
Lukas Fleischer [Mon, 4 Mar 2013 12:25:36 +0000 (13:25 +0100)]
cgit_print_tree(): Free curr_rev after usage

Fixes following memory leak seen with "PATH_INFO=/cgit/tree/":

    ==15715== 7 bytes in 1 blocks are definitely lost in loss record 4 of 51
    ==15715==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==15715==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==15715==    by 0x46CAA8: xstrdup (wrapper.c:35)
    ==15715==    by 0x418A4C: cgit_print_tree (ui-tree.c:274)
    ==15715==    by 0x407D91: tree_fn (cmd.c:131)
    ==15715==    by 0x405E16: process_request (cgit.c:574)
    ==15715==    by 0x4074C8: cache_process (cache.c:322)
    ==15715==    by 0x406C4F: main (cgit.c:872)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agofind_default_branch(): Free refmatch after usage
Lukas Fleischer [Mon, 4 Mar 2013 12:25:35 +0000 (13:25 +0100)]
find_default_branch(): Free refmatch after usage

Fixes following memory leak seen with "PATH_INFO=/cgit/refs/":

    ==13408== 7 bytes in 1 blocks are definitely lost in loss record 4 of 52
    ==13408==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==13408==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==13408==    by 0x46CA78: xstrdup (wrapper.c:35)
    ==13408==    by 0x405840: find_current_ref (cgit.c:426)
    ==13408==    by 0x44BE5A: do_one_ref (refs.c:527)
    ==13408==    by 0x44D3E0: do_for_each_ref_in_dir (refs.c:553)
    ==13408==    by 0x44D85A: do_for_each_ref (refs.c:1298)
    ==13408==    by 0x405889: find_default_branch (cgit.c:438)
    ==13408==    by 0x405AC4: prepare_repo_cmd (cgit.c:490)
    ==13408==    by 0x405D97: process_request (cgit.c:557)
    ==13408==    by 0x407490: cache_process (cache.c:322)
    ==13408==    by 0x406C18: main (cgit.c:864)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoprint_tag_downloads(): Free ref variable
Lukas Fleischer [Mon, 4 Mar 2013 12:25:34 +0000 (13:25 +0100)]
print_tag_downloads(): Free ref variable

Make sure the ref variable is freed if we build a
"$basename-$version"-style ref.

This fixes following memory leak seen with "PATH_INFO=/cgit/refs/":

    ==8784== 323 bytes in 29 blocks are definitely lost in loss record 41 of 53
    ==8784==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==8784==    by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so)
    ==8784==    by 0x46CA28: xstrdup (wrapper.c:35)
    ==8784==    by 0x410DA6: print_tag_downloads (ui-refs.c:115)
    ==8784==    by 0x410F02: print_tag (ui-refs.c:141)
    ==8784==    by 0x41128B: cgit_print_tags (ui-refs.c:230)
    ==8784==    by 0x41134D: cgit_print_refs (ui-refs.c:250)
    ==8784==    by 0x407C85: refs_fn (cmd.c:105)
    ==8784==    by 0x405DDF: process_request (cgit.c:566)
    ==8784==    by 0x407490: cache_process (cache.c:322)
    ==8784==    by 0x406C18: main (cgit.c:864)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoFree reflists after usage
Lukas Fleischer [Mon, 4 Mar 2013 12:25:33 +0000 (13:25 +0100)]
Free reflists after usage

Free reflists in cgit_print_branches() and in cgit_print_tags() before
returning reflist structures to the stack.

This fixes following memory leaks seen with "PATH_INFO=/cgit/refs/":

    ==5710== 1,312 (32 direct, 1,280 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 71
    ==5710==    at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x4C2C2FF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x46CA9B: xrealloc (wrapper.c:100)
    ==5710==    by 0x40AAA6: cgit_add_ref (shared.c:156)
    ==5710==    by 0x40ABC4: cgit_refs_cb (shared.c:186)
    ==5710==    by 0x44BCBA: do_one_ref (refs.c:527)
    ==5710==    by 0x44D240: do_for_each_ref_in_dir (refs.c:553)
    ==5710==    by 0x44D6BA: do_for_each_ref (refs.c:1298)
    ==5710==    by 0x410FE2: cgit_print_branches (ui-refs.c:191)
    ==5710==    by 0x4111E9: cgit_print_refs (ui-refs.c:244)
    ==5710==    by 0x407C85: refs_fn (cmd.c:105)
    ==5710==    by 0x405DDF: process_request (cgit.c:566)
    ==5710==
    ==5710== 6,846 (256 direct, 6,590 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 71
    ==5710==    at 0x4C2C25E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5710==    by 0x46CA9B: xrealloc (wrapper.c:100)
    ==5710==    by 0x40AAA6: cgit_add_ref (shared.c:156)
    ==5710==    by 0x40ABC4: cgit_refs_cb (shared.c:186)
    ==5710==    by 0x44BCBA: do_one_ref (refs.c:527)
    ==5710==    by 0x44D240: do_for_each_ref_in_dir (refs.c:553)
    ==5710==    by 0x44D6EC: do_for_each_ref (refs.c:1288)
    ==5710==    by 0x4110D5: cgit_print_tags (ui-refs.c:218)
    ==5710==    by 0x4111FD: cgit_print_refs (ui-refs.c:246)
    ==5710==    by 0x407C85: refs_fn (cmd.c:105)
    ==5710==    by 0x405DDF: process_request (cgit.c:566)
    ==5710==    by 0x407490: cache_process (cache.c:322)

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-shared.c: Remove unused function print_archive_ref()
Lukas Fleischer [Mon, 4 Mar 2013 07:52:35 +0000 (08:52 +0100)]
ui-shared.c: Remove unused function print_archive_ref()

This is no longer used as of commit f135569b.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-shared.c: Remove unused function cgit_currurl()
Lukas Fleischer [Mon, 4 Mar 2013 07:52:34 +0000 (08:52 +0100)]
ui-shared.c: Remove unused function cgit_currurl()

This is no longer used as of commit 0c8e184e.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoMark several functions/variables static
Lukas Fleischer [Mon, 4 Mar 2013 07:52:33 +0000 (08:52 +0100)]
Mark several functions/variables static

Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agot0107-snapshot: add tests for ZIP archives
John Keeping [Mon, 4 Mar 2013 21:58:51 +0000 (21:58 +0000)]
t0107-snapshot: add tests for ZIP archives

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agotests: make whitespace consistent
John Keeping [Mon, 4 Mar 2013 21:58:50 +0000 (21:58 +0000)]
tests: make whitespace consistent

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agotests: "grep -e" is not portable to all platforms
John Keeping [Mon, 4 Mar 2013 21:58:49 +0000 (21:58 +0000)]
tests: "grep -e" is not portable to all platforms

The "-e" option to grep is not needed unless specifying more than one
pattern, which we don't do.  Remove it to avoid restricting the tests on
platforms that do not have a grep that recognises "-e".

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoMakefile: Disable gettext in the Git submodule
Lukas Fleischer [Mon, 4 Mar 2013 08:18:38 +0000 (09:18 +0100)]
Makefile: Disable gettext in the Git submodule

Newer libgit versions depend on the libintl library. However, we
currently do not link against libintl which breaks compilation under
OpenBSD:

    git/libgit.a(commit.o)(.text+0x1d1b): In function `lookup_commit_or_die':
    git/gettext.h:47: undefined reference to `libintl_gettext'
    [...]

Since we do not support i18n in cgit, just disable gettext in the Git
submodule to fix this.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoMakefile: improve dependency generation
Jamie Couture [Sat, 17 Nov 2012 18:02:17 +0000 (13:02 -0500)]
Makefile: improve dependency generation

Makefile target generation would always be included for any makefile
target that was not clean.  Only care to include the '.deps' directory
when building cgit, rather than generating and including dependencies
when calling other makefile targets.

Heavily borrowed from git's Makefile, but without definitions to test
for the compiler's header dependency feature.  Previous Makefile
implementation never checked for this compiler feature anyway.

  - Removed makecmdgoal 'clean' check
  - Grouped like .PHONY target definitions
  - Place build dependency targets under .SUFFIXES
  - Re-arranged location of library inclusion definitions
  - Use google code mirror instead of github

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agocgit.c: Remove parameter from guess_defbranch()
Lukas Fleischer [Sun, 3 Mar 2013 21:42:35 +0000 (22:42 +0100)]
cgit.c: Remove parameter from guess_defbranch()

We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-tree.c: Use a context structure in walk_tree()
Lukas Fleischer [Sun, 3 Mar 2013 16:22:30 +0000 (17:22 +0100)]
ui-tree.c: Use a context structure in walk_tree()

Use the context pointer to pass context information instead of misusing
global variables, as we already did in "ui-blob.c" and in "ui-plain.c".

In addition to the fixes to walk_tree(), pass the same structure to
ls_tree() and ls_item() which is read_tree_recursive()-based as well.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-tree.c: Drop the header variable
Lukas Fleischer [Sun, 3 Mar 2013 15:55:21 +0000 (16:55 +0100)]
ui-tree.c: Drop the header variable

Instead, use the value of the state variable to determine whether the
footer needs to be drawn.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-tree.c: Declare the state variable globally
Lukas Fleischer [Sun, 3 Mar 2013 15:49:47 +0000 (16:49 +0100)]
ui-tree.c: Declare the state variable globally

This allows for removing the header variable in a following patch. We
can use the state variable to check whether the tail needs to be printed
instead.

Note that the state variable will be moved into a context structure
later.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-tree.c: Pass current revision to print_object()
Lukas Fleischer [Sun, 3 Mar 2013 15:45:14 +0000 (16:45 +0100)]
ui-tree.c: Pass current revision to print_object()

No longer access the global curr_rev variable in print_object().

This will make it easier to squash the curr_rev variable into a context
structure without having to pass the context to the print_object()
function.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-plain.c: Use a context structure in walk_tree()
Lukas Fleischer [Sun, 3 Mar 2013 16:27:54 +0000 (17:27 +0100)]
ui-plain.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-plain.c: Do not access match variable in print_*()
Lukas Fleischer [Sun, 3 Mar 2013 16:10:19 +0000 (17:10 +0100)]
ui-plain.c: Do not access match variable in print_*()

Move all code setting the match variable to walk_tree().

This allows for easily moving this variable into a context structure
without having to pass the context to print_*().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-blob.c: Use a context structure in walk_tree()
Lukas Fleischer [Sun, 3 Mar 2013 16:27:46 +0000 (17:27 +0100)]
ui-blob.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

This also prevents from potential misuse of the global pointers
match_path and matched_sha1 after the referenced values have been
overwritten on the stack.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoui-snapshot.c: Fill argv[0] with dummy.
Jason A. Donenfeld [Mon, 4 Mar 2013 04:41:53 +0000 (23:41 -0500)]
ui-snapshot.c: Fill argv[0] with dummy.

parse_archive_args does not pass PARSE_OPT_KEEP_ARGV0 to parse_args,
which means the first argument will be discarded, as though it were a
function being called from the command-line. Thus, we fill argv[0] with
a dummy argument to prevent this from happening.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoWhite space around control verbs.
Jason A. Donenfeld [Mon, 4 Mar 2013 04:21:33 +0000 (23:21 -0500)]
White space around control verbs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years agoFix several whitespace errors
Lukas Fleischer [Sun, 3 Mar 2013 15:04:29 +0000 (16:04 +0100)]
Fix several whitespace errors

* Remove whitespace at the end of lines.
* Replace space indentation by tabs.
* Add whitespace before/after several operators ("+", "-", "*", ...)
* Add whitespace to assignments ("foo = bar;").
* Fix whitespace in parameter lists ("foobar(foo, bar, 42)").

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years agoUpdate git to v1.7.12.4
John Keeping [Sat, 2 Mar 2013 12:32:15 +0000 (12:32 +0000)]
Update git to v1.7.12.4

No changes needed.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoUpdate git to v1.7.9.7
John Keeping [Sat, 2 Mar 2013 12:32:14 +0000 (12:32 +0000)]
Update git to v1.7.9.7

resolve_ref() is renamed to resolve_ref_unsafe().  CGit's usage is safe.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoUpdate git to v1.7.8.6
John Keeping [Sat, 2 Mar 2013 12:32:13 +0000 (12:32 +0000)]
Update git to v1.7.8.6

No changes required.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoUpdate git to v1.7.7.7
John Keeping [Sat, 2 Mar 2013 12:32:12 +0000 (12:32 +0000)]
Update git to v1.7.7.7

This release changes the archive interface so that we now need to pass
argv into write_archive().

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoUpdate git to v1.7.6.5
John Keeping [Sat, 2 Mar 2013 12:32:11 +0000 (12:32 +0000)]
Update git to v1.7.6.5

struct pathspec is now used in more places.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoUpdate git to v1.7.5.4
John Keeping [Sat, 2 Mar 2013 12:32:10 +0000 (12:32 +0000)]
Update git to v1.7.5.4

Some changes to diff options:

- no_merges has become the more general max_parents
- path restriction now uses struct pathspec

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years agoPrint submodule revision next to submodule link
stfn [Wed, 27 Feb 2013 18:47:17 +0000 (19:47 +0100)]
Print submodule revision next to submodule link

11 years agoSupport unannotated tags in git-clone.
Jason A. Donenfeld [Fri, 1 Feb 2013 20:08:51 +0000 (21:08 +0100)]
Support unannotated tags in git-clone.

Matthew McClintock reported that older unannotated tags were not
correctly being cloned and did not appear in info/refs. Further
investigation revealed some dubious prefix comparison code for
determining whether or not to write refs in info/refs. After comparing
it with git's own http-backend.c, it appears upstream does not use this
prefix logic.

OTOH, I don't know what the reasoning was when the prefix logic was
introduced. It appears to me to just be buggy, though it's possible
there are other reasons, and we'll have to revisit this commit.

But for now, Works For Me.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Matthew McClintock <msm@freescale.com>
Reported-by: Matthew McClintock <msm@freescale.com>