* [PATCH 1/1] git: update to v2.12.0
@ 2017-03-01 10:57 list
2017-03-04 12:22 ` john
0 siblings, 1 reply; 3+ messages in thread
From: list @ 2017-03-01 10:57 UTC (permalink / raw)
From: Christian Hesse <mail at eworm.de>
Update to git version v2.12.0: With commit 8aee769f (pathspec: copy and free
owned memory) member 'match' of 'struct pathspec_item' is no longer
'const char*' but just 'char*'.
Signed-off-by: Christian Hesse <mail at eworm.de>
---
Makefile | 2 +-
cgit.h | 4 ++--
git | 2 +-
shared.c | 4 ++--
ui-blob.c | 2 +-
ui-blob.h | 2 +-
ui-commit.c | 2 +-
ui-commit.h | 2 +-
ui-diff.c | 4 ++--
ui-diff.h | 2 +-
10 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index fe6cc98..a0b422e 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
pdfdir = $(docdir)
mandir = $(prefix)/share/man
SHA1_HEADER = <openssl/sha.h>
-GIT_VER = 2.11.0
+GIT_VER = 2.12.0
GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
INSTALL = install
COPYTREE = cp -r
diff --git a/cgit.h b/cgit.h
index fbc6c6a..3eb04de 100644
--- a/cgit.h
+++ b/cgit.h
@@ -355,10 +355,10 @@ extern int cgit_diff_files(const struct object_id *old_oid,
extern void cgit_diff_tree(const struct object_id *old_oid,
const struct object_id *new_oid,
- filepair_fn fn, const char *prefix, int ignorews);
+ filepair_fn fn, char *prefix, int ignorews);
extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
- const char *prefix);
+ char *prefix);
__attribute__((format (printf,1,2)))
extern char *fmt(const char *format,...);
diff --git a/git b/git
index 454cb6b..e7e07d5 160000
--- a/git
+++ b/git
@@ -1 +1 @@
-Subproject commit 454cb6bd52a4de614a3633e4f547af03d5c3b640
+Subproject commit e7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7
diff --git a/shared.c b/shared.c
index c63f1e3..4602123 100644
--- a/shared.c
+++ b/shared.c
@@ -336,7 +336,7 @@ int cgit_diff_files(const struct object_id *old_oid,
void cgit_diff_tree(const struct object_id *old_oid,
const struct object_id *new_oid,
- filepair_fn fn, const char *prefix, int ignorews)
+ filepair_fn fn, char *prefix, int ignorews)
{
struct diff_options opt;
struct pathspec_item item;
@@ -367,7 +367,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
diff_flush(&opt);
}
-void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
+void cgit_diff_commit(struct commit *commit, filepair_fn fn, char *prefix)
{
const struct object_id *old_oid = NULL;
diff --git a/ui-blob.c b/ui-blob.c
index 5f30de7..c759520 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -33,7 +33,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base,
return 0;
}
-int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
+int cgit_ref_path_exists(char *path, const char *ref, int file_only)
{
struct object_id oid;
unsigned long size;
diff --git a/ui-blob.h b/ui-blob.h
index 16847b2..d4be56a 100644
--- a/ui-blob.h
+++ b/ui-blob.h
@@ -1,7 +1,7 @@
#ifndef UI_BLOB_H
#define UI_BLOB_H
-extern int cgit_ref_path_exists(const char *path, const char *ref, int file_only);
+extern int cgit_ref_path_exists(char *path, const char *ref, int file_only);
extern int cgit_print_file(char *path, const char *head, int file_only);
extern void cgit_print_blob(const char *hex, char *path, const char *head, int file_only);
diff --git a/ui-commit.c b/ui-commit.c
index db69d54..47b9025 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -13,7 +13,7 @@
#include "ui-diff.h"
#include "ui-log.h"
-void cgit_print_commit(char *hex, const char *prefix)
+void cgit_print_commit(char *hex, char *prefix)
{
struct commit *commit, *parent;
struct commitinfo *info, *parent_info;
diff --git a/ui-commit.h b/ui-commit.h
index 8198b4b..3d19eeb 100644
--- a/ui-commit.h
+++ b/ui-commit.h
@@ -1,6 +1,6 @@
#ifndef UI_COMMIT_H
#define UI_COMMIT_H
-extern void cgit_print_commit(char *hex, const char *prefix);
+extern void cgit_print_commit(char *hex, char *prefix);
#endif /* UI_COMMIT_H */
diff --git a/ui-diff.c b/ui-diff.c
index 173d351..e8e9897 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -189,7 +189,7 @@ static void inspect_filepair(struct diff_filepair *pair)
static void cgit_print_diffstat(const struct object_id *old_oid,
const struct object_id *new_oid,
- const char *prefix)
+ char *prefix)
{
int i;
@@ -382,7 +382,7 @@ void cgit_print_diff_ctrls(void)
}
void cgit_print_diff(const char *new_rev, const char *old_rev,
- const char *prefix, int show_ctrls, int raw)
+ char *prefix, int show_ctrls, int raw)
{
struct commit *commit, *commit2;
const unsigned char *old_tree_sha1, *new_tree_sha1;
diff --git a/ui-diff.h b/ui-diff.h
index 39264a1..4d5a83c 100644
--- a/ui-diff.h
+++ b/ui-diff.h
@@ -4,7 +4,7 @@
extern void cgit_print_diff_ctrls(void);
extern void cgit_print_diff(const char *new_hex, const char *old_hex,
- const char *prefix, int show_ctrls, int raw);
+ char *prefix, int show_ctrls, int raw);
extern struct diff_filespec *cgit_get_current_old_file(void);
extern struct diff_filespec *cgit_get_current_new_file(void);
--
2.12.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] git: update to v2.12.0
2017-03-01 10:57 [PATCH 1/1] git: update to v2.12.0 list
@ 2017-03-04 12:22 ` john
2017-06-06 14:12 ` list
0 siblings, 1 reply; 3+ messages in thread
From: john @ 2017-03-04 12:22 UTC (permalink / raw)
On Wed, Mar 01, 2017 at 11:57:55AM +0100, Christian Hesse wrote:
> From: Christian Hesse <mail at eworm.de>
>
> Update to git version v2.12.0: With commit 8aee769f (pathspec: copy and free
> owned memory) member 'match' of 'struct pathspec_item' is no longer
> 'const char*' but just 'char*'.
>
> Signed-off-by: Christian Hesse <mail at eworm.de>
> ---
> Makefile | 2 +-
> cgit.h | 4 ++--
> git | 2 +-
> shared.c | 4 ++--
> ui-blob.c | 2 +-
> ui-blob.h | 2 +-
> ui-commit.c | 2 +-
> ui-commit.h | 2 +-
> ui-diff.c | 4 ++--
> ui-diff.h | 2 +-
> 10 files changed, 13 insertions(+), 13 deletions(-)
This feels a bit invasive for a change that just affects pathspec_item.
Can't we keep most of CGit's API the same (and keep prefixes "const")
and just adjust at the lowest level?
Maybe something like this instead?
-- >8 --
The definition of struct pathspec_item has changed with the expectation
that pathspecs will be managed dynamically. We work around this a bit
by setting up a static structure, but let's allocate the match string to
avoid needing to cast away const.
Signed-off-by: John Keeping <john at keeping.me.uk>
---
shared.c | 4 +++-
ui-blob.c | 9 ++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
--- a/shared.c
+++ b/shared.c
@@ -352,7 +352,7 @@ void cgit_diff_tree(const struct object_id *old_oid,
opt.format_callback = cgit_diff_tree_cb;
opt.format_callback_data = fn;
if (prefix) {
- item.match = prefix;
+ item.match = xstrdup(prefix);
item.len = strlen(prefix);
opt.pathspec.nr = 1;
opt.pathspec.items = &item;
@@ -365,6 +365,8 @@ void cgit_diff_tree(const struct object_id *old_oid,
diff_root_tree_sha1(new_oid->hash, "", &opt);
diffcore_std(&opt);
diff_flush(&opt);
+
+ free(item.match);
}
void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
diff --git a/ui-blob.c b/ui-blob.c
index 5f30de7..793817f 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -38,7 +38,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
struct object_id oid;
unsigned long size;
struct pathspec_item path_items = {
- .match = path,
+ .match = xstrdup(path),
.len = strlen(path)
};
struct pathspec paths = {
@@ -53,10 +53,13 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
};
if (get_oid(ref, &oid))
- return 0;
+ goto done;
if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
- return 0;
+ goto done;
read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
+
+done:
+ free(path_items.match);
return walk_tree_ctx.found_path;
}
--
2.12.0.rc2.230.ga28edc07cd
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] git: update to v2.12.0
2017-03-04 12:22 ` john
@ 2017-06-06 14:12 ` list
0 siblings, 0 replies; 3+ messages in thread
From: list @ 2017-06-06 14:12 UTC (permalink / raw)
John Keeping <john at keeping.me.uk> on Sat, 2017/03/04 12:22:
> On Wed, Mar 01, 2017 at 11:57:55AM +0100, Christian Hesse wrote:
> > From: Christian Hesse <mail at eworm.de>
> >
> > Update to git version v2.12.0: With commit 8aee769f (pathspec: copy and
> > free owned memory) member 'match' of 'struct pathspec_item' is no longer
> > 'const char*' but just 'char*'.
>
> This feels a bit invasive for a change that just affects pathspec_item.
> Can't we keep most of CGit's API the same (and keep prefixes "const")
> and just adjust at the lowest level?
>
> Maybe something like this instead?
Sorry for the late answer...
Probably makes sense. I have an alternative branch that looks similar to
your patch. ;)
As you sent this first... Want to rebase for git v2.13.1?
--
main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];)
putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20170606/1b0eb03d/attachment.asc>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-06 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 10:57 [PATCH 1/1] git: update to v2.12.0 list
2017-03-04 12:22 ` john
2017-06-06 14:12 ` list
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).