| Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
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>
|
|
Use the xstrdup() wrapper which already bails out if strdup() returns a
NULL pointer.
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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.
|
|
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.
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|