[PATCH v2 02/17] Rename static function fetch_pack() to http_fetch_pack()
From: Michael Haggerty mhag...@alum.mit.edu Avoid confusion with the non-static function of the same name from fetch-pack.h. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- http-walker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http-walker.c b/http-walker.c index 51a906e..1516c5e 100644 --- a/http-walker.c +++ b/http-walker.c @@ -396,7 +396,7 @@ static int fetch_indices(struct walker *walker, struct alt_base *repo) return ret; } -static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned char *sha1) +static int http_fetch_pack(struct walker *walker, struct alt_base *repo, unsigned char *sha1) { struct packed_git *target; int ret; @@ -524,7 +524,7 @@ static int fetch(struct walker *walker, unsigned char *sha1) if (!fetch_object(walker, altbase, sha1)) return 0; while (altbase) { - if (!fetch_pack(walker, altbase, sha1)) + if (!http_fetch_pack(walker, altbase, sha1)) return 0; fetch_alternates(walker, data-alt-base); altbase = altbase-next; -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 04/17] Name local variables more consistently
From: Michael Haggerty mhag...@alum.mit.edu Use the names (nr_heads, heads) consistently across functions, instead of sometimes naming the same values (nr_match, match). Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 35 +-- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index cc21047..76288a2 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -521,27 +521,27 @@ static void mark_recent_complete_commits(unsigned long cutoff) } } -static void filter_refs(struct ref **refs, int nr_match, char **match) +static void filter_refs(struct ref **refs, int nr_heads, char **heads) { struct ref **return_refs; struct ref *newlist = NULL; struct ref **newtail = newlist; struct ref *ref, *next; struct ref *fastarray[32]; - int match_pos; + int head_pos; - if (nr_match !args.fetch_all) { - if (ARRAY_SIZE(fastarray) nr_match) - return_refs = xcalloc(nr_match, sizeof(struct ref *)); + if (nr_heads !args.fetch_all) { + if (ARRAY_SIZE(fastarray) nr_heads) + return_refs = xcalloc(nr_heads, sizeof(struct ref *)); else { return_refs = fastarray; - memset(return_refs, 0, sizeof(struct ref *) * nr_match); + memset(return_refs, 0, sizeof(struct ref *) * nr_heads); } } else return_refs = NULL; - match_pos = 0; + head_pos = 0; for (ref = *refs; ref; ref = next) { next = ref-next; if (!memcmp(ref-name, refs/, 5) @@ -556,17 +556,17 @@ static void filter_refs(struct ref **refs, int nr_match, char **match) } else { int cmp = -1; - while (match_pos nr_match) { - cmp = strcmp(ref-name, match[match_pos]); + while (head_pos nr_heads) { + cmp = strcmp(ref-name, heads[head_pos]); if (cmp 0) /* definitely do not have it */ break; else if (cmp == 0) { /* definitely have it */ - match[match_pos][0] = '\0'; - return_refs[match_pos] = ref; + heads[head_pos][0] = '\0'; + return_refs[head_pos] = ref; break; } else /* might have it; keep looking */ - match_pos++; + head_pos++; } if (!cmp) continue; /* we will link it later */ @@ -576,7 +576,7 @@ static void filter_refs(struct ref **refs, int nr_match, char **match) if (!args.fetch_all) { int i; - for (i = 0; i nr_match; i++) { + for (i = 0; i nr_heads; i++) { ref = return_refs[i]; if (ref) { *newtail = ref; @@ -595,7 +595,7 @@ static void mark_alternate_complete(const struct ref *ref, void *unused) mark_complete(NULL, ref-old_sha1, 0, NULL); } -static int everything_local(struct ref **refs, int nr_match, char **match) +static int everything_local(struct ref **refs, int nr_heads, char **heads) { struct ref *ref; int retval; @@ -646,7 +646,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match) } } - filter_refs(refs, nr_match, match); + filter_refs(refs, nr_heads, heads); for (retval = 1, ref = *refs; ref ; ref = ref-next) { const unsigned char *remote = ref-old_sha1; @@ -777,8 +777,7 @@ static int get_pack(int xd[2], char **pack_lockfile) static struct ref *do_fetch_pack(int fd[2], const struct ref *orig_ref, - int nr_match, - char **match, + int nr_heads, char **heads, char **pack_lockfile) { struct ref *ref = copy_ref_list(orig_ref); @@ -819,7 +818,7 @@ static struct ref *do_fetch_pack(int fd[2], fprintf(stderr, Server supports ofs-delta\n); } else prefer_ofs_delta = 0; - if (everything_local(ref, nr_match, match)) { + if (everything_local(ref, nr_heads, heads)) { packet_flush(fd[1]); goto all_done; } -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to
[PATCH v2 07/17] Pass nr_heads to do_pack_ref() by reference
From: Michael Haggerty mhag...@alum.mit.edu This is the first of a few baby steps towards changing filter_refs() to compress matched refs out of the list rather than overwriting the first character of such references with '\0'. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index cf65998..fae4f7c 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -777,7 +777,7 @@ static int get_pack(int xd[2], char **pack_lockfile) static struct ref *do_fetch_pack(int fd[2], const struct ref *orig_ref, - int nr_heads, char **heads, + int *nr_heads, char **heads, char **pack_lockfile) { struct ref *ref = copy_ref_list(orig_ref); @@ -818,7 +818,7 @@ static struct ref *do_fetch_pack(int fd[2], fprintf(stderr, Server supports ofs-delta\n); } else prefer_ofs_delta = 0; - if (everything_local(ref, nr_heads, heads)) { + if (everything_local(ref, *nr_heads, heads)) { packet_flush(fd[1]); goto all_done; } @@ -1086,7 +1086,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, packet_flush(fd[1]); die(no matching remote head); } - ref_cpy = do_fetch_pack(fd, ref, *nr_heads, heads, pack_lockfile); + ref_cpy = do_fetch_pack(fd, ref, nr_heads, heads, pack_lockfile); if (args.depth 0) { struct cache_time mtime; -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 10/17] Remove ineffective optimization
From: Michael Haggerty mhag...@alum.mit.edu I cannot find a scenario in which this function is called any significant number of times, so simplify the code by always allocating an array for return_refs rather than trying to use a stack-allocated array for small lists. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index c47090d..ca1ddd9 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -527,17 +527,10 @@ static void filter_refs(struct ref **refs, int *nr_heads, char **heads) struct ref *newlist = NULL; struct ref **newtail = newlist; struct ref *ref, *next; - struct ref *fastarray[32]; int head_pos; - if (*nr_heads !args.fetch_all) { - if (ARRAY_SIZE(fastarray) *nr_heads) - return_refs = xcalloc(*nr_heads, sizeof(struct ref *)); - else { - return_refs = fastarray; - memset(return_refs, 0, sizeof(struct ref *) * *nr_heads); - } - } + if (*nr_heads !args.fetch_all) + return_refs = xcalloc(*nr_heads, sizeof(struct ref *)); else return_refs = NULL; @@ -584,8 +577,7 @@ static void filter_refs(struct ref **refs, int *nr_heads, char **heads) newtail = ref-next; } } - if (return_refs != fastarray) - free(return_refs); + free(return_refs); } *refs = newlist; } -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 13/17] cmd_fetch_pack: return early if finish_connect() returns an error
From: Michael Haggerty mhag...@alum.mit.edu This simplifies the logic without changing the behavior. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 5ba1cef..f04fd59 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1025,10 +1025,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) close(fd[0]); close(fd[1]); if (finish_connect(conn)) - ref = NULL; - ret = !ref; + return 1; - if (!ret nr_heads) { + ret = !ref; + if (ref nr_heads) { /* If the heads to pull were given, we should have * consumed all of them by matching the remote. * Otherwise, 'git fetch remote no-such-ref' would -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 14/17] Report missing refs even if no existing refs were received
From: Michael Haggerty mhag...@alum.mit.edu This fixes a test in t5500. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 2 +- t/t5500-fetch-pack.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index f04fd59..00ac3b1 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1028,7 +1028,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) return 1; ret = !ref; - if (ref nr_heads) { + if (nr_heads) { /* If the heads to pull were given, we should have * consumed all of them by matching the remote. * Otherwise, 'git fetch remote no-such-ref' would diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 0d4edcb..f78a118 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -403,7 +403,7 @@ test_expect_success 'set up tests of missing reference' ' EOF ' -test_expect_failure 'test lonely missing ref' ' +test_expect_success 'test lonely missing ref' ' ( cd client test_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 15/17] cmd_fetch_pack(): simplify computation of return value
From: Michael Haggerty mhag...@alum.mit.edu Set the final value at initialization rather than initializing it then sometimes changing it. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 00ac3b1..c49dadf 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1027,17 +1027,16 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) if (finish_connect(conn)) return 1; - ret = !ref; - if (nr_heads) { - /* If the heads to pull were given, we should have -* consumed all of them by matching the remote. -* Otherwise, 'git fetch remote no-such-ref' would -* silently succeed without issuing an error. -*/ - for (i = 0; i nr_heads; i++) - error(no such remote ref %s, heads[i]); - ret = 1; - } + ret = !ref || nr_heads; + + /* +* If the heads to pull were given, we should have consumed +* all of them by matching the remote. Otherwise, 'git fetch +* remote no-such-ref' would silently succeed without issuing +* an error. +*/ + for (i = 0; i nr_heads; i++) + error(no such remote ref %s, heads[i]); while (ref) { printf(%s %s\n, sha1_to_hex(ref-old_sha1), ref-name); -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 17/17] filter_refs(): simplify logic
From: Michael Haggerty mhag...@alum.mit.edu * Build linked list of return values as we go rather than recording them in a temporary array and linking them up later. * Handle ref in a single if...else statement in the main loop, to make it clear that each ref has exactly two possible destinies. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 56 ++-- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 1bc4599..db77ee6 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -523,66 +523,48 @@ static void mark_recent_complete_commits(unsigned long cutoff) static void filter_refs(struct ref **refs, int *nr_heads, char **heads) { - struct ref **return_refs; struct ref *newlist = NULL; struct ref **newtail = newlist; struct ref *ref, *next; - int head_pos = 0, matched = 0, unmatched = 0; - - if (*nr_heads !args.fetch_all) - return_refs = xcalloc(*nr_heads, sizeof(struct ref *)); - else - return_refs = NULL; + int head_pos = 0, unmatched = 0; for (ref = *refs; ref; ref = next) { + int keep_ref = 0; next = ref-next; if (!memcmp(ref-name, refs/, 5) check_refname_format(ref-name, 0)) ; /* trash */ else if (args.fetch_all -(!args.depth || prefixcmp(ref-name, refs/tags/) )) { - *newtail = ref; - ref-next = NULL; - newtail = ref-next; - continue; - } - else { - int cmp = -1; + (!args.depth || prefixcmp(ref-name, refs/tags/))) + keep_ref = 1; + else while (head_pos *nr_heads) { - cmp = strcmp(ref-name, heads[head_pos]); - if (cmp 0) /* definitely do not have it */ + int cmp = strcmp(ref-name, heads[head_pos]); + if (cmp 0) { /* definitely do not have it */ break; - else if (cmp == 0) { /* definitely have it */ - return_refs[matched++] = ref; + } else if (cmp == 0) { /* definitely have it */ free(heads[head_pos++]); + keep_ref = 1; break; - } - else { /* might have it; keep looking */ + } else { /* might have it; keep looking */ heads[unmatched++] = heads[head_pos++]; } } - if (!cmp) - continue; /* we will link it later */ - } - free(ref); - } - - if (!args.fetch_all) { - int i; - /* copy remaining unmatched heads: */ - while (head_pos *nr_heads) - heads[unmatched++] = heads[head_pos++]; - *nr_heads = unmatched; - - for (i = 0; i matched; i++) { - ref = return_refs[i]; + if (keep_ref) { *newtail = ref; ref-next = NULL; newtail = ref-next; + } else { + free(ref); } - free(return_refs); } + + /* copy any remaining unmatched heads: */ + while (head_pos *nr_heads) + heads[unmatched++] = heads[head_pos++]; + *nr_heads = unmatched; + *refs = newlist; } -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 00/17] Clean up how fetch_pack() handles the heads list
From: Michael Haggerty mhag...@alum.mit.edu Re-roll, incorporating Jeff's suggestions. Some commit messages have also been improved, but the only interdiff is that match_pos is renamed to head_pos in filter_refs(). This patch series applies to the merge between master and jc/maint-push-refs-all, though the dependency on the latter is only textual. Michael Haggerty (17): t5500: add tests of error output for missing refs Rename static function fetch_pack() to http_fetch_pack() Fix formatting. Name local variables more consistently Do not check the same head_pos twice Let fetch_pack() inform caller about number of unique heads Pass nr_heads to do_pack_ref() by reference Pass nr_heads to everything_local() by reference Pass nr_heads to filter_refs() by reference Remove ineffective optimization filter_refs(): do not leave gaps in return_refs filter_refs(): compress unmatched refs in heads array cmd_fetch_pack: return early if finish_connect() returns an error Report missing refs even if no existing refs were received cmd_fetch_pack(): simplify computation of return value fetch_pack(): free matching heads filter_refs(): simplify logic builtin/fetch-pack.c | 128 -- fetch-pack.h | 19 +--- http-walker.c | 4 +- t/t5500-fetch-pack.sh | 32 - transport.c | 8 ++-- 5 files changed, 101 insertions(+), 90 deletions(-) -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 03/17] Fix formatting.
From: Michael Haggerty mhag...@alum.mit.edu Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 8 fetch-pack.h | 12 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 7912d2b..cc21047 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1062,10 +1062,10 @@ static int compare_heads(const void *a, const void *b) struct ref *fetch_pack(struct fetch_pack_args *my_args, int fd[], struct child_process *conn, const struct ref *ref, - const char *dest, - int nr_heads, - char **heads, - char **pack_lockfile) + const char *dest, + int nr_heads, + char **heads, + char **pack_lockfile) { struct stat st; struct ref *ref_cpy; diff --git a/fetch-pack.h b/fetch-pack.h index 7c2069c..1dbe90f 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -18,11 +18,11 @@ struct fetch_pack_args { }; struct ref *fetch_pack(struct fetch_pack_args *args, - int fd[], struct child_process *conn, - const struct ref *ref, - const char *dest, - int nr_heads, - char **heads, - char **pack_lockfile); + int fd[], struct child_process *conn, + const struct ref *ref, + const char *dest, + int nr_heads, + char **heads, + char **pack_lockfile); #endif -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 05/17] Do not check the same head_pos twice
From: Michael Haggerty mhag...@alum.mit.edu Once a match has been found at head_pos, the entry is zeroed and no future attempts will match that entry. So increment head_pos to avoid checking against the zeroed-out entry during the next iteration. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 76288a2..bda3c0c 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -561,8 +561,8 @@ static void filter_refs(struct ref **refs, int nr_heads, char **heads) if (cmp 0) /* definitely do not have it */ break; else if (cmp == 0) { /* definitely have it */ - heads[head_pos][0] = '\0'; return_refs[head_pos] = ref; + heads[head_pos++][0] = '\0'; break; } else /* might have it; keep looking */ -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 09/17] Pass nr_heads to filter_refs() by reference
From: Michael Haggerty mhag...@alum.mit.edu Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index a4bb0ff..c47090d 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -521,7 +521,7 @@ static void mark_recent_complete_commits(unsigned long cutoff) } } -static void filter_refs(struct ref **refs, int nr_heads, char **heads) +static void filter_refs(struct ref **refs, int *nr_heads, char **heads) { struct ref **return_refs; struct ref *newlist = NULL; @@ -530,12 +530,12 @@ static void filter_refs(struct ref **refs, int nr_heads, char **heads) struct ref *fastarray[32]; int head_pos; - if (nr_heads !args.fetch_all) { - if (ARRAY_SIZE(fastarray) nr_heads) - return_refs = xcalloc(nr_heads, sizeof(struct ref *)); + if (*nr_heads !args.fetch_all) { + if (ARRAY_SIZE(fastarray) *nr_heads) + return_refs = xcalloc(*nr_heads, sizeof(struct ref *)); else { return_refs = fastarray; - memset(return_refs, 0, sizeof(struct ref *) * nr_heads); + memset(return_refs, 0, sizeof(struct ref *) * *nr_heads); } } else @@ -556,7 +556,7 @@ static void filter_refs(struct ref **refs, int nr_heads, char **heads) } else { int cmp = -1; - while (head_pos nr_heads) { + while (head_pos *nr_heads) { cmp = strcmp(ref-name, heads[head_pos]); if (cmp 0) /* definitely do not have it */ break; @@ -576,7 +576,7 @@ static void filter_refs(struct ref **refs, int nr_heads, char **heads) if (!args.fetch_all) { int i; - for (i = 0; i nr_heads; i++) { + for (i = 0; i *nr_heads; i++) { ref = return_refs[i]; if (ref) { *newtail = ref; @@ -646,7 +646,7 @@ static int everything_local(struct ref **refs, int *nr_heads, char **heads) } } - filter_refs(refs, *nr_heads, heads); + filter_refs(refs, nr_heads, heads); for (retval = 1, ref = *refs; ref ; ref = ref-next) { const unsigned char *remote = ref-old_sha1; -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/17] Let fetch_pack() inform caller about number of unique heads
From: Michael Haggerty mhag...@alum.mit.edu fetch_pack() removes duplicates from the list (nr_heads, heads), thereby shrinking the list. But previously, the caller was not informed about the shrinkage. This would cause a spurious error message to be emitted by cmd_fetch_pack() if git fetch-pack is called with duplicate refnames. So change the signature of fetch_pack() to accept nr_heads by reference, and if any duplicates were removed then modify it to reflect the number of remaining references. The last test of t5500 inexplicably *required* git fetch-pack to fail when fetching a list of references that contains duplicates; i.e., it insisted on the buggy behavior. So change the test to expect the correct behavior. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 12 ++-- fetch-pack.h | 2 +- t/t5500-fetch-pack.sh | 2 +- transport.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index bda3c0c..cf65998 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1021,7 +1021,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) get_remote_heads(fd[0], ref, 0, NULL); ref = fetch_pack(args, fd, conn, ref, dest, - nr_heads, heads, pack_lockfile_ptr); + nr_heads, heads, pack_lockfile_ptr); if (pack_lockfile) { printf(lock %s\n, pack_lockfile); fflush(stdout); @@ -1062,7 +1062,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, int fd[], struct child_process *conn, const struct ref *ref, const char *dest, - int nr_heads, + int *nr_heads, char **heads, char **pack_lockfile) { @@ -1077,16 +1077,16 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, st.st_mtime = 0; } - if (heads nr_heads) { - qsort(heads, nr_heads, sizeof(*heads), compare_heads); - nr_heads = remove_duplicates(nr_heads, heads); + if (heads *nr_heads) { + qsort(heads, *nr_heads, sizeof(*heads), compare_heads); + *nr_heads = remove_duplicates(*nr_heads, heads); } if (!ref) { packet_flush(fd[1]); die(no matching remote head); } - ref_cpy = do_fetch_pack(fd, ref, nr_heads, heads, pack_lockfile); + ref_cpy = do_fetch_pack(fd, ref, *nr_heads, heads, pack_lockfile); if (args.depth 0) { struct cache_time mtime; diff --git a/fetch-pack.h b/fetch-pack.h index 1dbe90f..a9d505b 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -21,7 +21,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args, int fd[], struct child_process *conn, const struct ref *ref, const char *dest, - int nr_heads, + int *nr_heads, char **heads, char **pack_lockfile); diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 3cc3346..0d4edcb 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -391,7 +391,7 @@ test_expect_success 'fetch mixed refs from cmdline and stdin' ' test_expect_success 'test duplicate refs from stdin' ' ( cd client - test_must_fail git fetch-pack --stdin --no-progress .. ../input.dup + git fetch-pack --stdin --no-progress .. ../input.dup ) output cut -d -f 2 output | sort actual test_cmp expect actual diff --git a/transport.c b/transport.c index 1811b50..f7bbf58 100644 --- a/transport.c +++ b/transport.c @@ -548,7 +548,7 @@ static int fetch_refs_via_pack(struct transport *transport, refs = fetch_pack(args, data-fd, data-conn, refs_tmp ? refs_tmp : transport-remote_refs, - dest, nr_heads, heads, transport-pack_lockfile); + dest, nr_heads, heads, transport-pack_lockfile); close(data-fd[0]); close(data-fd[1]); if (finish_connect(data-conn)) -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 11/17] filter_refs(): do not leave gaps in return_refs
From: Michael Haggerty mhag...@alum.mit.edu It used to be that this function processed refnames in some arbitrary order but wanted to return them in the order that they were requested, not the order that they were processed. Now, the refnames are processed in sorted order, so there is no reason to go to the extra effort. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/fetch-pack.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index ca1ddd9..a995357 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -527,14 +527,13 @@ static void filter_refs(struct ref **refs, int *nr_heads, char **heads) struct ref *newlist = NULL; struct ref **newtail = newlist; struct ref *ref, *next; - int head_pos; + int head_pos = 0, matched = 0; if (*nr_heads !args.fetch_all) return_refs = xcalloc(*nr_heads, sizeof(struct ref *)); else return_refs = NULL; - head_pos = 0; for (ref = *refs; ref; ref = next) { next = ref-next; if (!memcmp(ref-name, refs/, 5) @@ -554,7 +553,7 @@ static void filter_refs(struct ref **refs, int *nr_heads, char **heads) if (cmp 0) /* definitely do not have it */ break; else if (cmp == 0) { /* definitely have it */ - return_refs[head_pos] = ref; + return_refs[matched++] = ref; heads[head_pos++][0] = '\0'; break; } @@ -569,13 +568,11 @@ static void filter_refs(struct ref **refs, int *nr_heads, char **heads) if (!args.fetch_all) { int i; - for (i = 0; i *nr_heads; i++) { + for (i = 0; i matched; i++) { ref = return_refs[i]; - if (ref) { - *newtail = ref; - ref-next = NULL; - newtail = ref-next; - } + *newtail = ref; + ref-next = NULL; + newtail = ref-next; } free(return_refs); } -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/17] Clean up how fetch_pack() handles the heads list
On 08/23/2012 10:31 PM, Jeff King wrote: I think part of the confusion of this code is that inside the loop over the refs it is sometimes checking aspects of the ref, and sometimes checking invariants of the loop (like args.fetch_all). Splitting it into separate loops makes it easier to see what is going on, like the patch below (on top of Michael's series). I'm not sure if it ends up being more readable, since the generic cut down this linked list function has to operate through callbacks with a void pointer. On the other hand, that function could also be used elsewhere. [...] Despite requiring a bit more boilerplate, I think that your change makes the logic clearer. *If* we want to switch to using callbacks, then we can get even more bang for the buck, as in the attached patch (which applies on top of my patch v2). Beyond your suggestion, this patch: * Inlines your filter_refs() into everything_local(), because (a) it's short and (b) the policy work implemented there logically belongs higher-up in the call chain. * Renames your filter_refs_callback() to filter_refs(). * Moves the initialization of the filter_by_name_data structure (including sorting and de-duping) all the way up to fetch_pack(), and passes a filter_by_name_data* (rather than (nr_heads, heads)) down to the callees. If you like this change, let me know and I'll massage it into a digestible patch series. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index db77ee6..d1dabcf 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -521,51 +521,91 @@ static void mark_recent_complete_commits(unsigned long cutoff) } } -static void filter_refs(struct ref **refs, int *nr_heads, char **heads) +static void filter_refs(struct ref **refs, + int (*want)(struct ref *, void *), + void *data) { - struct ref *newlist = NULL; - struct ref **newtail = newlist; + struct ref **tail = refs; struct ref *ref, *next; - int head_pos = 0, unmatched = 0; for (ref = *refs; ref; ref = next) { - int keep_ref = 0; next = ref-next; - if (!memcmp(ref-name, refs/, 5) - check_refname_format(ref-name, 0)) - ; /* trash */ - else if (args.fetch_all - (!args.depth || prefixcmp(ref-name, refs/tags/))) - keep_ref = 1; - else - while (head_pos *nr_heads) { -int cmp = strcmp(ref-name, heads[head_pos]); -if (cmp 0) { /* definitely do not have it */ - break; -} else if (cmp == 0) { /* definitely have it */ - free(heads[head_pos++]); - keep_ref = 1; - break; -} else { /* might have it; keep looking */ - heads[unmatched++] = heads[head_pos++]; -} - } - - if (keep_ref) { - *newtail = ref; - ref-next = NULL; - newtail = ref-next; - } else { + if (want(ref, data)) + tail = ref-next; + else { free(ref); + *tail = next; } } +} - /* copy any remaining unmatched heads: */ - while (head_pos *nr_heads) - heads[unmatched++] = heads[head_pos++]; - *nr_heads = unmatched; +static int ref_name_is_ok(struct ref *ref, void *data) +{ + return memcmp(ref-name, refs/, 5) || + !check_refname_format(ref-name, 0); +} + +static int ref_ok_for_shallow(struct ref *ref, void *data) +{ + return prefixcmp(ref-name, refs/tags/); +} + +static int compare_heads(const void *a, const void *b) +{ + return strcmp(*(const char **)a, *(const char **)b); +} + +static int remove_duplicates(int nr_heads, char **heads) +{ + int src, dst; + for (src = dst = 1; src nr_heads; src++) + if (strcmp(heads[src], heads[dst-1])) + heads[dst++] = heads[src]; + else + free(heads[src]); + return dst; +} - *refs = newlist; +struct filter_by_name_data { + char **heads; + int *nr_heads; + int head_pos; + int unmatched; +}; + +static void filter_by_name_init(struct filter_by_name_data *f, + int *nr_heads, char **heads) +{ + memset(f, 0, sizeof(*f)); + f-heads = heads; + f-nr_heads = nr_heads; + qsort(f-heads, *f-nr_heads, sizeof(*f-heads), compare_heads); + *f-nr_heads = remove_duplicates(*f-nr_heads, f-heads); +} + +static int filter_by_name_want(struct ref *ref, void *data) +{ + struct filter_by_name_data *f = data; + + while (f-head_pos *f-nr_heads) { + int cmp = strcmp(ref-name, f-heads[f-head_pos]); + if (cmp 0) /* definitely do not have it */ + return 0; + else if (cmp == 0) { /* definitely have it */ + free(f-heads[f-head_pos++]); + return 1; + } else /* might have it; keep looking */ + f-heads[f-unmatched++] = f-heads[f-head_pos++]; + } + return 0; +} + +static void filter_by_name_finish(struct filter_by_name_data *f) +{ + /* copy any remaining unmatched heads: */ + while (f-head_pos *f-nr_heads) + f-heads[f-unmatched++] = f-heads[f-head_pos++]; + *f-nr_heads = f-unmatched; } static void mark_alternate_complete(const struct ref *ref, void *unused) @@ -573,7 +613,8 @@ static void mark_alternate_complete(const struct ref *ref, void *unused) mark_complete(NULL,
[PATCH] apply: compute patch-def_name correctly under -p0
Back when git apply was written, we made sure that the user can skip more than the default number of path components (i.e. 1) by giving -pn, but the logic for doing so was built around the notion of we skip N slashes and stop. This obviously does not work well when running under -p0 where we do not want to skip any, but still want to skip SP/HT that separates the pathnames of preimage and postimage and want to reject absolute pathnames. Stop using stop_at_slash(), and instead introduce a new helper skip_tree_prefix() with similar logic but works correctly even for the -p0 case. This is an ancient bug, but has been masked for a long time because most of the patches are text and have other clues to tell us the name of the preimage and the postimage. Noticed by Colin McCabe. Signed-off-by: Junio C Hamano gits...@pobox.com --- * This time, with a test. The patch is designed to apply to a bit older codebase, and won't apply cleanly to 'master', but the result of merging it to newer codebase can be seen near the tip of 'pu' tonight. builtin/apply.c | 68 +++-- t/t4103-apply-binary.sh | 54 --- 2 files changed, 76 insertions(+), 46 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index c24dc54..2ad8c48 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -1022,15 +1022,23 @@ static int gitdiff_unrecognized(const char *line, struct patch *patch) return -1; } -static const char *stop_at_slash(const char *line, int llen) +/* + * Skip p_value leading components from line; as we do not accept + * absolute paths, return NULL in that case. + */ +static const char *skip_tree_prefix(const char *line, int llen) { - int nslash = p_value; + int nslash; int i; + if (!p_value) + return (llen line[0] == '/') ? NULL : line; + + nslash = p_value; for (i = 0; i llen; i++) { int ch = line[i]; if (ch == '/' --nslash = 0) - return line[i]; + return (i == 0) ? NULL : line[i + 1]; } return NULL; } @@ -1060,12 +1068,11 @@ static char *git_header_name(char *line, int llen) if (unquote_c_style(first, line, second)) goto free_and_fail1; - /* advance to the first slash */ - cp = stop_at_slash(first.buf, first.len); - /* we do not accept absolute paths */ - if (!cp || cp == first.buf) + /* strip the a/b prefix including trailing slash */ + cp = skip_tree_prefix(first.buf, first.len); + if (!cp) goto free_and_fail1; - strbuf_remove(first, 0, cp + 1 - first.buf); + strbuf_remove(first, 0, cp - first.buf); /* * second points at one past closing dq of name. @@ -1079,22 +1086,21 @@ static char *git_header_name(char *line, int llen) if (*second == '') { if (unquote_c_style(sp, second, NULL)) goto free_and_fail1; - cp = stop_at_slash(sp.buf, sp.len); - if (!cp || cp == sp.buf) + cp = skip_tree_prefix(sp.buf, sp.len); + if (!cp) goto free_and_fail1; /* They must match, otherwise ignore */ - if (strcmp(cp + 1, first.buf)) + if (strcmp(cp, first.buf)) goto free_and_fail1; strbuf_release(sp); return strbuf_detach(first, NULL); } /* unquoted second */ - cp = stop_at_slash(second, line + llen - second); - if (!cp || cp == second) + cp = skip_tree_prefix(second, line + llen - second); + if (!cp) goto free_and_fail1; - cp++; - if (line + llen - cp != first.len + 1 || + if (line + llen - cp != first.len || memcmp(first.buf, cp, first.len)) goto free_and_fail1; return strbuf_detach(first, NULL); @@ -1106,10 +1112,9 @@ static char *git_header_name(char *line, int llen) } /* unquoted first name */ - name = stop_at_slash(line, llen); - if (!name || name == line) + name = skip_tree_prefix(line, llen); + if (!name) return NULL; - name++; /* * since the first name is unquoted, a dq if exists must be @@ -1123,10 +1128,9 @@ static char *git_header_name(char *line, int llen) if (unquote_c_style(sp, second, NULL)) goto free_and_fail2; - np =
RE: [RFC] Support for HP NonStop
From: Junio C Hamano [mailto:gits...@pobox.com] Sent: Friday, August 24, 2012 11:51 PM To: Joachim Schmitz Cc: git@vger.kernel.org Subject: Re: [RFC] Support for HP NonStop Joachim Schmitz j...@schmitz-digital.de writes: Reminds me of a related issue: in compat/fnmatch/fnmatch.c there is this: #if HAVE_STRING_H || defined _LIBC # include string.h #else # include strings.h #endif There's no place where HAVE_STRING_H get set This looks wrong to me,... This is because it is a borrowed file from glibc, and we try to minimize changes to such a file. If you need HAVE_STRING_H to force inclusion of string.h on your platform, doing this: COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c is perfectly the right thing to do. It should be set by default and those that don't have it, should (have to) disable it. In Makefile: ifndef NO_STRING_H COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c endif Do platforms exist without string.h? Maybe fnmatch.c should look like this instead? We try to minimize changes to such a file we borrow from upstream; Valid point, but... especially we do not do so lightly when we have to ask do platforms exist? Of course, they do---otherwise glibc folks wouldn't have written such a conditional. Hmm, well, why then doesn't git-compat.util.h use the same mechanism? (and no ,it should not!) I guess because as of now nobody ever tried to port git to a platform that doesn't have string.h. string.h is C89 ANSI/ISO standard (and was part of even the earliest KC C), in place since more than 22 years now! It may not be available on embedded platforms, but those won't be able to run git anyway I'd guess. Newer version of gnulib's fnmatch.c don't use this anymore, git's is from 99, according to the Copyright: Copyright (C) 1991, 92, 93, 96, 97, 98, 99 The current gnulib one shows: Copyright (C) 1991-1993, 1996-2007, 2009-2012 Time to upgrade, if you'd ask me... Same may go for poll.c BTW Bye, Jojo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: libgit2 status
On 08/24/2012 04:02 PM, gree...@obbligato.org wrote: What is the status of libgit2 WRT the overall git project? I recall that there was some discussion of basing bits of git on libgit2 once it matures. I ask because I'm starting a project to improve the abysmal speed of git-subtree split. It's unbearably slow at the moment and as far as I can puzzle out it's due almost entirely to repeated subshell invocations to run git commands. I was planning on doing some experiments rewriting bits of git-subtree using libgit2 but I want to make sure that that isn't wasted work. It appears to be exactly what I need to code bits of git-subtree natively. Thoughts? libgit2 is now maintained by Vicent Marti, who was once a gsoc student. He's employed by github and seems to spend most of his time working on libgit2. Politically, I'm not sure how keen the git community is on handing over control to the core stuff of git to a commercial entity, but it doesn't seem to be a dying project, so I'd say go ahead and do it. -- Andreas Ericsson andreas.erics...@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] branch -v: align even when the first column is in UTF-8
2012/8/25 Erik Faye-Lund kusmab...@gmail.com: On Fri, Aug 24, 2012 at 4:17 PM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: 1 tập tin đã bị thay đổi, 5 được thêm vào(+), 3 bị xóa(-) Huh? Oh, that's something we should fix soon, too. I suggested a project language config key some time ago, where commands like format-patch should follow. It's hard because only part of the format-patch will be in this language while error messages for example are still in $LANG. I've been thinking, but I haven't found anything worth mentioning yet. -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 15/16] remote-svn: add marks-file regeneration
Florian Achleitner florian.achleitner.2.6...@gmail.com schrieb im Newsbeitrag news:1345662961-9587-16-git-send-email-florian.achleitner.2.6...@gmail.com... fast-import mark files are stored outside the object database and are therefore not fetched and can be lost somehow else. marks provide a svn revision -- git sha1 mapping, while the notes that are attached to each commit when it is imported provide a git sha1 -- svn revision mapping. If the marks file is not available or not plausible, regenerate it by walking through the notes tree. , i.e. The plausibility check tests if the highest revision in the marks file matches the revision of the top ref. It doesn't ensure that the mark file is completely correct. This could only be done with an effort equal to unconditional regeneration. Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com Signed-off-by: Junio C Hamano gits...@pobox.com --- remote-testsvn.c | 68 ++ 1 file changed, 68 insertions(+) diff --git a/remote-testsvn.c b/remote-testsvn.c index e90d221..09dc304 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c ... +static void check_or_regenerate_marks(int latestrev) { + FILE *marksfile; + char *line = NULL; + size_t linelen = 0; + struct strbuf sb = STRBUF_INIT; + int found = 0; + + if (latestrev 1) + return; + + init_notes(NULL, notes_ref, NULL, 0); + marksfile = fopen(marksfilename, r); + if (!marksfile) { + regenerate_marks(); + marksfile = fopen(marksfilename, r); + if (!marksfile) + die_errno(cannot read marks file %s!, marksfilename); + fclose(marksfile); + } else { + strbuf_addf(sb, :%d , latestrev); + while (getline(line, linelen, marksfile) != -1) { getline() is not available to anybody, e.g. it is not in HP NonStop. Bye, Jojo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v4 02/13] read-cache.c: Re-read index if index file changed
Thomas Gummerer t.gumme...@gmail.com schrieb im Newsbeitrag news:134529-6925-3-git-send-email-t.gumme...@gmail.com... Add the possibility of re-reading the index file, if it changed while reading. The index file might change during the read, causing outdated information to be displayed. We check if the index file changed by using its stat data as heuristic. Signed-off-by: Thomas Gummerer t.gumme...@gmail.com --- read-cache.c | 87 +--- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/read-cache.c b/read-cache.c index 6a8b4b1..cdd8480 100644 --- a/read-cache.c +++ b/read-cache.c ... @@ -1186,38 +1209,48 @@ int read_index_from(struct index_state *istate, const char *path) errno = ENOENT; istate-timestamp.sec = 0; istate-timestamp.nsec = 0; - fd = open(path, O_RDONLY); - if (fd 0) { - if (errno == ENOENT) - return 0; - die_errno(index file open failed); - } + do { + err = 0; + fd = open(path, O_RDONLY); + if (fd 0) { + if (errno == ENOENT) + return 0; + die_errno(index file open failed); + } - if (fstat(fd, st)) - die_errno(cannot stat the open index); + if (fstat(fd, st_old)) + die_errno(cannot stat the open index); - errno = EINVAL; - mmap_size = xsize_t(st.st_size); - mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - close(fd); - if (mmap == MAP_FAILED) - die_errno(unable to map index file); + errno = EINVAL; + mmap_size = xsize_t(st_old.st_size); + mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + close(fd); + if (mmap == MAP_FAILED) + die_errno(unable to map index file); - hdr = mmap; - if (verify_hdr_version(istate, hdr, mmap_size) 0) - goto unmap; + hdr = mmap; + if (verify_hdr_version(istate, hdr, mmap_size) 0) + err = 1; - if (istate-ops-verify_hdr(mmap, mmap_size) 0) - goto unmap; + if (istate-ops-verify_hdr(mmap, mmap_size) 0) + err = 1; - istate-ops-read_index(istate, mmap, mmap_size); - istate-timestamp.sec = st.st_mtime; - istate-timestamp.nsec = ST_MTIME_NSEC(st); + if (istate-ops-read_index(istate, mmap, mmap_size) 0) + err = 1; + istate-timestamp.sec = st_old.st_mtime; + istate-timestamp.nsec = ST_MTIME_NSEC(st_old); + if (lstat(path, st_new)) + die_errno(cannot stat the open index); - munmap(mmap, mmap_size); - return istate-cache_nr; + munmap(mmap, mmap_size); + + if (!index_changed(st_old, st_new) !err) + return istate-cache_nr; + + usleep(10*1000); usleep() is not available to anybody, e.g. it is not in HP NonStop (not in every case at least) Bye, Jojo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function
The getline() function is a GNU extension (you need to define _GNU_SOURCE before including stdio.h) and is, therefore, not portable. In particular, getline() is not available on MinGW. In order to support non-GNU systems, we replace the call to getline() with (almost) equivalent code using strbuf_getline(). Note that, unlike getline(), strbuf_getline() removes the newline terminator from the returned string. This difference in semantics does not matter at this call-site. Also, we note that the original code was leaking the memory allocated to 'line' by getline(). Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk --- Hi Florian, Could you please squash this into commit 0320cef0 (remote-svn: add marks-file regeneration, 22-08-2012). ATB, Ramsay Jones remote-testsvn.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/remote-testsvn.c b/remote-testsvn.c index 09dc304..d0b81d5 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c @@ -121,9 +121,8 @@ static void regenerate_marks(void) static void check_or_regenerate_marks(int latestrev) { FILE *marksfile; - char *line = NULL; - size_t linelen = 0; struct strbuf sb = STRBUF_INIT; + struct strbuf line = STRBUF_INIT; int found = 0; if (latestrev 1) @@ -139,8 +138,8 @@ static void check_or_regenerate_marks(int latestrev) { fclose(marksfile); } else { strbuf_addf(sb, :%d , latestrev); - while (getline(line, linelen, marksfile) != -1) { - if (!prefixcmp(line, sb.buf)) { + while (strbuf_getline(line, marksfile, '\n') != EOF) { + if (!prefixcmp(line.buf, sb.buf)) { found++; break; } @@ -151,6 +150,7 @@ static void check_or_regenerate_marks(int latestrev) { } free_notes(NULL); strbuf_release(sb); + strbuf_release(line); } static int cmd_import(const char *line) -- 1.7.12 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] t9020-*.sh: Fix urls passed to git-remote in test setup
In particular, the urls passed to git-remote have an extra '/' given after the schema prefix, like so: git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9154/svn.dump git remote add svnfile testsvn::file:///$TEST_DIRECTORY/t9154/svn.dump Once the prefix is removed, the remainder of the url looks something like //home/ramsay/git/t/t9154/svn.dump, which is then interpreted as a network path. Since there is No such host or network path called //home, this leads to the svnrdump_sim.py script to fail: Traceback (most recent call last): File .../trash directory.t9020-remote-svn/svnrdump, line 51, in ? if writedump(url, r[0], r[1]): ret = 0 File .../trash directory.t9020-remote-svn/svnrdump, line 23, in writedump f = open(filename, 'r'); IOError: [Errno 13] Permission denied: '//home/ramsay/git/t/t9154/svn.dump' In order to fix the problem, we simply remove the extraneous '/' character from the urls. Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk --- Hi Florian, This test fails on cygwin. Could you please squash this into commit 2d597d73 (Add a test script for remote-svn, 20-08-2012). Thanks! ATB, Ramsay Jones t/t9020-remote-svn.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh index 9ae9997..cd7604e 100755 --- a/t/t9020-remote-svn.sh +++ b/t/t9020-remote-svn.sh @@ -13,8 +13,8 @@ init_git () { git init #git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9020/example.svnrdump # let's reuse an exisiting dump file!? - git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9154/svn.dump - git remote add svnfile testsvn::file:///$TEST_DIRECTORY/t9154/svn.dump + git remote add svnsim testsvn::sim://$TEST_DIRECTORY/t9154/svn.dump + git remote add svnfile testsvn::file://$TEST_DIRECTORY/t9154/svn.dump } if test -e $GIT_BUILD_DIR/git-remote-testsvn -- 1.7.12 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] t9020-*.sh: Skip all tests when python not available
Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk --- Hi Florian, Since python is not installed on MinGW, this test fails with an unable to spawn script type message when attempting to execute svnrdump. So, could you, in addition to the previous patch, squash this into commit 2d597d73 (Add a test script for remote-svn, 20-08-2012). Thanks! ATB, Ramsay Jones t/t9020-remote-svn.sh | 6 ++ 1 file changed, 6 insertions(+) diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh index cd7604e..e6ed4ca 100755 --- a/t/t9020-remote-svn.sh +++ b/t/t9020-remote-svn.sh @@ -4,6 +4,12 @@ test_description='tests remote-svn' . ./test-lib.sh +if ! test_have_prereq PYTHON +then + skip_all='skipping remote-svn tests, python not available' + test_done +fi + # We override svnrdump by placing a symlink to the svnrdump-emulator in . export PATH=$HOME:$PATH ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py $HOME/svnrdump -- 1.7.12 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] branch -v: align even when branch names are in UTF-8
Branch names are usually in ASCII so they are not the problem. The problem most likely comes from (no branch) translation, which is in UTF-8 and makes length calculation just wrong. Update document to mention the fact that we may want ref names in UTF-8. Encodings that produce invalid UTF-8 are safe as utf8_strwidth() falls back to strlen(). The ones that incidentally produce valid UTF-8 sequences will cause misalignment. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- On Sat, Aug 25, 2012 at 12:25 AM, Junio C Hamano gits...@pobox.com wrote: I agree with all of the above, but shouldn't you be computing the maxwidth based on the strwidth in the first place? The use of maxwidth in strbuf_addf() here clearly wants we know N columns is sufficient to show all output items, so pad the string to N columns here. Looking for assignment item.len = xxx in the same file shows these are computed as byte length, so you are offsetting off of an incorrectly computed value. Giving fewer padding bytes when showing a string that will occupy fewer columns than it has bytes is independently necessary, once we have the correct maxwidth that is computed in terms of the strwidth, so this patch is not wrong per-se, but it is incomplete without a correct maxwidth, no? Yes. This fixes that and also mentions about ref names in utf-8. Documentation/revisions.txt | 2 ++ builtin/branch.c| 12 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt index dc0070b..175d397 100644 --- a/Documentation/revisions.txt +++ b/Documentation/revisions.txt @@ -55,6 +55,8 @@ when you run `git cherry-pick`. + Note that any of the 'refs/*' cases above may come either from the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file. +While the ref name encoding is unspecified, UTF-8 is prefered as +some output processing may assume ref names in UTF-8. 'refname@\{date\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes ago\}':: A ref followed by the suffix '@' with a date specification diff --git a/builtin/branch.c b/builtin/branch.c index 0e060f2..73ff7e7 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -17,6 +17,7 @@ #include revision.h #include string-list.h #include column.h +#include utf8.h static const char * const builtin_branch_usage[] = { git branch [options] [-r | -a] [--merged | --no-merged], @@ -354,7 +355,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags, newitem-name = xstrdup(refname); newitem-kind = kind; newitem-commit = commit; - newitem-len = strlen(refname); + newitem-len = utf8_strwidth(refname); newitem-dest = resolve_symref(orig_refname, prefix); /* adjust for remotes/ */ if (newitem-kind == REF_REMOTE_BRANCH @@ -490,11 +491,12 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose, } strbuf_addf(name, %s%s, prefix, item-name); - if (verbose) + if (verbose) { + int utf8_compensation = strlen(name.buf) - utf8_strwidth(name.buf); strbuf_addf(out, %c %s%-*s%s, c, branch_get_color(color), - maxwidth, name.buf, + maxwidth + utf8_compensation, name.buf, branch_get_color(BRANCH_COLOR_RESET)); - else + } else strbuf_addf(out, %c %s%s%s, c, branch_get_color(color), name.buf, branch_get_color(BRANCH_COLOR_RESET)); @@ -533,7 +535,7 @@ static void show_detached(struct ref_list *ref_list) if (head_commit is_descendant_of(head_commit, ref_list-with_commit)) { struct ref_item item; item.name = xstrdup(_((no branch))); - item.len = strlen(item.name); + item.len = utf8_strwidth(item.name); item.kind = REF_LOCAL_BRANCH; item.dest = NULL; item.commit = head_commit; -- 1.7.12.rc2.18.g61b472e -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v6 15/16] remote-svn: add marks-file regeneration
From: Joachim Schmitz [mailto:j...@schmitz-digital.de] Sent: Saturday, August 25, 2012 5:55 PM To: 'florian.achleitner.2.6...@gmail.com' Cc: git@vger.kernel.org Subject: Re: [PATCH v6 15/16] remote-svn: add marks-file regeneration Florian Achleitner florian.achleitner.2.6...@gmail.com schrieb im Newsbeitrag news:1345662961-9587-16-git-send-email- florian.achleitner.2.6...@gmail.com... fast-import mark files are stored outside the object database and are therefore not fetched and can be lost somehow else. marks provide a svn revision -- git sha1 mapping, while the notes that are attached to each commit when it is imported provide a git sha1 -- svn revision mapping. If the marks file is not available or not plausible, regenerate it by walking through the notes tree. , i.e. The plausibility check tests if the highest revision in the marks file matches the revision of the top ref. It doesn't ensure that the mark file is completely correct. This could only be done with an effort equal to unconditional regeneration. Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com Signed-off-by: Junio C Hamano gits...@pobox.com --- remote-testsvn.c | 68 ++ 1 file changed, 68 insertions(+) diff --git a/remote-testsvn.c b/remote-testsvn.c index e90d221..09dc304 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c ... +static void check_or_regenerate_marks(int latestrev) { + FILE *marksfile; + char *line = NULL; + size_t linelen = 0; + struct strbuf sb = STRBUF_INIT; + int found = 0; + + if (latestrev 1) + return; + + init_notes(NULL, notes_ref, NULL, 0); + marksfile = fopen(marksfilename, r); + if (!marksfile) { + regenerate_marks(); + marksfile = fopen(marksfilename, r); + if (!marksfile) + die_errno(cannot read marks file %s!, marksfilename); + fclose(marksfile); + } else { + strbuf_addf(sb, :%d , latestrev); + while (getline(line, linelen, marksfile) != -1) { getline() is not available to anybody, e.g. it is not in HP NonStop. I'd like to confirm that Ramsey's patch works for me too, so I second his request. (Subject: [PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function) Bye, Jojo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function
Ramsay Jones wrote: The getline() function is a GNU extension (you need to define _GNU_SOURCE before including stdio.h) and is, therefore, not portable. In particular, getline() is not available on MinGW. In order to support non-GNU systems, we replace the call to getline() with (almost) equivalent code using strbuf_getline(). Note that, unlike getline(), strbuf_getline() removes the newline terminator from the returned string. This difference in semantics does not matter at this call-site. Also, we note that the original code was leaking the memory allocated to 'line' by getline(). Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk Tested-by: Joachim Schmitz j...@schmitz-digital.de --- Hi Florian, Could you please squash this into commit 0320cef0 (remote-svn: add marks-file regeneration, 22-08-2012). ATB, Ramsay Jones remote-testsvn.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/remote-testsvn.c b/remote-testsvn.c index 09dc304..d0b81d5 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c @@ -121,9 +121,8 @@ static void regenerate_marks(void) static void check_or_regenerate_marks(int latestrev) { FILE *marksfile; - char *line = NULL; - size_t linelen = 0; struct strbuf sb = STRBUF_INIT; + struct strbuf line = STRBUF_INIT; int found = 0; if (latestrev 1) @@ -139,8 +138,8 @@ static void check_or_regenerate_marks(int latestrev) { fclose(marksfile); } else { strbuf_addf(sb, :%d , latestrev); - while (getline(line, linelen, marksfile) != -1) { - if (!prefixcmp(line, sb.buf)) { + while (strbuf_getline(line, marksfile, '\n') != EOF) { + if (!prefixcmp(line.buf, sb.buf)) { found++; break; } @@ -151,6 +150,7 @@ static void check_or_regenerate_marks(int latestrev) { } free_notes(NULL); strbuf_release(sb); + strbuf_release(line); } static int cmd_import(const char *line) I'd like to second this request, having the same problem on HP NonStop and this patch fixes it for me too. Bye, Jojo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function
On Sat, Aug 25, 2012 at 7:13 PM, Ramsay Jones ram...@ramsay1.demon.co.uk wrote: The getline() function is a GNU extension (you need to define _GNU_SOURCE before including stdio.h) and is, therefore, not portable. In particular, getline() is not available on MinGW. Actually, getline is a POSIX-2008 feature, so it's not (simply) a GNU extension: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] format-patch: always print diffstat in English
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/log.c | 1 + diff.c| 4 ++-- diff.h| 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index ecc2793..62f4b7e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1225,6 +1225,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) /* Always generate a patch */ rev.diffopt.output_format |= DIFF_FORMAT_PATCH; + rev.diffopt.no_l10n = 1; if (!DIFF_OPT_TST(rev.diffopt, TEXT) !no_binary_diff) DIFF_OPT_SET(rev.diffopt, BINARY); diff --git a/diff.c b/diff.c index 47d7e50..a20cfcc 100644 --- a/diff.c +++ b/diff.c @@ -1687,7 +1687,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) extra_shown = 1; } fprintf(options-file, %s, line_prefix); - print_stat_summary(options-file, 0, total_files, adds, dels); + print_stat_summary(options-file, options-no_l10n, total_files, adds, dels); } static void show_shortstats(struct diffstat_t *data, struct diff_options *options) @@ -1716,7 +1716,7 @@ static void show_shortstats(struct diffstat_t *data, struct diff_options *option options-output_prefix_data); fprintf(options-file, %s, msg-buf); } - print_stat_summary(options-file, 0, total_files, adds, dels); + print_stat_summary(options-file, options-no_l10n, total_files, adds, dels); } static void show_numstat(struct diffstat_t *data, struct diff_options *options) diff --git a/diff.h b/diff.h index eec79ef..ea4075d 100644 --- a/diff.h +++ b/diff.h @@ -125,6 +125,7 @@ struct diff_options { int dirstat_permille; int setup; int abbrev; + int no_l10n; const char *prefix; int prefix_length; const char *stat_sep; -- 1.7.12.rc1.27.g6d3049b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] Allow to print diffstat in English regardless current locale
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/apply.c | 2 +- diff.c | 19 --- diff.h | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index d453c83..3f2779f 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3627,7 +3627,7 @@ static void stat_patch_list(struct patch *patch) show_stats(patch); } - print_stat_summary(stdout, files, adds, dels); + print_stat_summary(stdout, 0, files, adds, dels); } static void numstat_patch_list(struct patch *patch) diff --git a/diff.c b/diff.c index 95706a5..47d7e50 100644 --- a/diff.c +++ b/diff.c @@ -1390,18 +1390,21 @@ static void fill_print_name(struct diffstat_file *file) file-print_name = pname; } -int print_stat_summary(FILE *fp, int files, int insertions, int deletions) +int print_stat_summary(FILE *fp, int no_l10n, int files, + int insertions, int deletions) { +#define C_(s) (no_l10n ? s : _(s)) +#define CQ_(s1, s2, num) (no_l10n ? (num == 1 ? s1 : s2) : Q_(s1, s2, num)) struct strbuf sb = STRBUF_INIT; int ret; if (!files) { assert(insertions == 0 deletions == 0); - return fprintf(fp, %s\n, _( 0 files changed)); + return fprintf(fp, %s\n, C_( 0 files changed)); } strbuf_addf(sb, - Q_( %d file changed, %d files changed, files), + CQ_( %d file changed, %d files changed, files), files); /* @@ -1418,7 +1421,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions) * do not translate it. */ strbuf_addf(sb, - Q_(, %d insertion(+), , %d insertions(+), + CQ_(, %d insertion(+), , %d insertions(+), insertions), insertions); } @@ -1429,7 +1432,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions) * do not translate it. */ strbuf_addf(sb, - Q_(, %d deletion(-), , %d deletions(-), + CQ_(, %d deletion(-), , %d deletions(-), deletions), deletions); } @@ -1437,6 +1440,8 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions) ret = fputs(sb.buf, fp); strbuf_release(sb); return ret; +#undef C_ +#undef CQ_ } static void show_stats(struct diffstat_t *data, struct diff_options *options) @@ -1682,7 +1687,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) extra_shown = 1; } fprintf(options-file, %s, line_prefix); - print_stat_summary(options-file, total_files, adds, dels); + print_stat_summary(options-file, 0, total_files, adds, dels); } static void show_shortstats(struct diffstat_t *data, struct diff_options *options) @@ -1711,7 +1716,7 @@ static void show_shortstats(struct diffstat_t *data, struct diff_options *option options-output_prefix_data); fprintf(options-file, %s, msg-buf); } - print_stat_summary(options-file, total_files, adds, dels); + print_stat_summary(options-file, 0, total_files, adds, dels); } static void show_numstat(struct diffstat_t *data, struct diff_options *options) diff --git a/diff.h b/diff.h index e027650..eec79ef 100644 --- a/diff.h +++ b/diff.h @@ -329,7 +329,7 @@ extern struct userdiff_driver *get_textconv(struct diff_filespec *one); extern int parse_rename_score(const char **cp_p); -extern int print_stat_summary(FILE *fp, int files, +extern int print_stat_summary(FILE *fp, int no_l10n, int files, int insertions, int deletions); #endif /* DIFF_H */ -- 1.7.12.rc1.27.g6d3049b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RFC 0/2] Mixing English and a local language
The l10n effort leads to a situation where a contributor can submit a patch with some auto-generated information in his language, which may not be the team's language. We need to make sure exchange medium like patch is always in a common language that the team understands. Now this team language may not necessarily be English. However there are technical difficulties involved in switching between two languages. The only way I can think of, on top of gettext, is provide git translations in multiple domains. Say diff machinery uses git-diff domain while the rest is in git. We can drive gettext to use language X for diff machinery, and Y for the rest. For that, we replace gettext() with dgettext(). It's cumbersome. And there has not been any sign that there will be a real user for it. So I assume that the team language will always be English. It's simpler and should cover 90% of the user base. If someday people ask for that, supporting it is simply a matter of rewriting C_() and CQ_() macros in the first patch to use dgettext() instead. Switching between a language and English is easier. We just need an if/else to decide whether to call gettext(). Which is what the first patch does, just for certain parts of diff machinery. Error messages will alway be in native language. The second patch puts format-patch output in English unconditionally. Again I'm partly lazy and not so sure that there will be needs for format-patch to produce in native language. If someone needs it, we can introduce a new config key that flip no_l10n flag back to 0. More commands may follow format-patch. I think that 'apply' should also use English for non-tty output, unless users request it to be in local language. IOW local language is treated pretty much like coloring. Nguyễn Thái Ngọc Duy (2): Allow to print diffstat in English regardless current locale format-patch: always print diffstat in English builtin/apply.c | 2 +- builtin/log.c | 1 + diff.c | 19 --- diff.h | 3 ++- 4 files changed, 16 insertions(+), 9 deletions(-) -- 1.7.12.rc1.27.g6d3049b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git no longer prompting for password
On Sat, Aug 25, 2012 at 03:56:01PM +0100, Iain Paton wrote: It's like the initial http requests do not get a 401, and the push proceeds, and then some later request causes a 401 when we do not expect it. Which is doubly odd, since we should also be able to handle that case (the first 401 we get should cause us to ask for a password). Yes, I deliberately have it set for anonymous pull and authenticated push. So the initial contact with the server doesn't ask for auth. OK, I see what's going on. It looks like it is configured to do so by rejecting the POST request. So this first request works: GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1 User-Agent: git/1.7.8 Host: 10.44.16.74 Accept: */* Pragma: no-cache HTTP/1.1 200 OK which is the first step of the conversation, in which the client gets the set of refs from the remote. Then it tries to POST the pack: POST /git/test.git/git-receive-pack HTTP/1.1 User-Agent: git/1.7.8 Host: 10.44.16.74 Accept-Encoding: deflate, gzip Content-Type: application/x-git-receive-pack-request Accept: application/x-git-receive-pack-result Content-Length: 412 * upload completely sent off: 412 out of 412 bytes HTTP/1.1 401 Unauthorized And we get blocked on that request. I didn't quote it above, but note how the client actually generates and sends the full pack before being told no, you can't do this. So that explains the output you see; we really are generating and sending the pack, and only then getting a 401. And it also explains why git does not prompt and retry; we follow a different code path for POSTs that does not trigger the retry code. This is not optimal, as we send the pack data only to find out that we are not authenticated. There is code to avoid sending the _whole_ pack (it's the probe_rpc code in remote-curl.c), so I think you'd just be wasting 64K, which is not too bad. So we could teach git to retry if the POST fails, and I think it would work OK. But I don't think there is any reason not to block the push request right from the first receive-pack request we see, which catches the issue even earlier, and with less overhead (and of course works with existing git clients :) ). apache config has the following: [...] LocationMatch ^/git/.*/git-receive-pack$ AuthType Basic AuthUserFile /data/git/htpasswd AuthGroupfile /data/git/groups AuthName Git Access Require group committers /LocationMatch nothing untoward there I think and google turns up lots of examples where people are doing essentially the same thing. I think your regex is the culprit. The first request comes in with: GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1 The odd URL is because we are probing to see if the server even supports smart-http. But note that it does not match your regex above, which requires /git-receive-pack. It looks like that is pulled straight from the git-http-backend manpage. I think the change in v1.7.8 broke people using that configuration. I tend to think the right thing is to fix the configuration (both on your system and in the documentation), but we should probably also fix git to handle this situation more gracefully, since it used to work and has been advertised in the documentation for a long time. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: libgit2 status
On Sat, Aug 25, 2012 at 2:56 AM, Andreas Ericsson a...@op5.se wrote: Politically, I'm not sure how keen the git community is on handing over control to the core stuff of git to a commercial entity, The development of libgit2 happens 100% in the open. I don't know what commercial entity are you talking about, but there are several companies and independent contributors working on the Library at the moment. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: libgit2 status
The 25/08/12, Vicent Marti wrote: The development of libgit2 happens 100% in the open. I don't know what commercial entity are you talking about, but there are several companies and independent contributors working on the Library at the moment. Right but as far as I'm aware of Junio had reserves about libgit2 integration into git due to issues making repositories broken. Though, having libgit2 as git core would make libgit2 the the-facto standard which would a *very* big plus. Also, I guess that integration into git would mean more developers contibuting for libgit2. Currently, issues seems to be a blocker for integration. So, libgit2 might appear to be a marginal/risky alternative for a long time which is sad. [ I'm somewhat in the same situation of OP. ] -- Nicolas Sebrecht -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: libgit2 status
Nicolas Sebrecht nicolas.s@gmx.fr writes: The 25/08/12, Vicent Marti wrote: The development of libgit2 happens 100% in the open. I don't know what commercial entity are you talking about, but there are several companies and independent contributors working on the Library at the moment. Right but as far as I'm aware of Junio had reserves about libgit2 integration into git due to issues making repositories broken. Though, The comment I saw about that was that at one point libgit2 had produced broken trees; which is true, the algorithm for the almost-alphanumeric sorting was slightly broken. This was fixed quite some time ago, which he also mentioned in the same message. [ I'm somewhat in the same situation of OP. ] If you wait for it to be perfect, it's never going to happen. If your application would benefit, port it to libgit2 and report the issues you find. That's the only way we can know of the odd edge cases and improvements that we should make. Note that the GitHub apps for Mac and Windows both use the Library to perform parts of their job. Their new backend for the website is also (going to be) based on libgit2. I am also working on a project for a client involving the Library for importing data and the only problem we've had is that we discovered an edge case regarding symlinks and an assumption that one of the bindings made wrt diffs, which is getting fixed. cmn -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC] git svn: handle errors and concurrent commits in dcommit
Robert Luberda rob...@debian.org wrote: Eric Wong wrote: Oops, I'll push the following out since Junio already merged your original: I can see that you haven't pushed the change yet. Maybe it would be a good idea to fix other style mistakes (extra spaces after redirections, lack of spaces after function names, `[' used instead of `test', etc) as well? I can prepare a patch if you think it is a good idea. Oops, I got distracted. Yes please on an updated patch. Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC] git svn: don't introduce new paragraph for git-svn-id
Robert Luberda rob...@debian.org wrote: Junio C Hamano wrote: Eric Wong normalper...@yhbt.net writes: I think having svn in svn.trimsvnlog twice is redundant and not ideal. Perhaps just --trim-log and svn.trimlog? Do we ever want to trim our log when relaying the Git commits back to subversion? Having svn in trimsvnlog makes it clear that the logs from subversion side is getting trimmed. `git commit' already trims the messages (except for removing the leading whitespaces from the first non-whitespace-only line) and git svn doesn't change that. The new option affects the way the messages are imported from svn to git, with one exception when the --add-author-from option of dcommit is used (in which case it may skip adding an extra new line character before the `From: ' line). For that reason --trim-svn-log might be a better name. OK. I now agree --trim-svn-log is a better name : -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC] simple typo fix
From: AichnerAd adrian.aich...@gmail.com Please let me know what you think of this patch. The test mail I sent myself in gmail looked good with Show original. Best regards Adrian --- Documentation/git-daemon.txt |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt index e8f7577..4799e35 100644 --- a/Documentation/git-daemon.txt +++ b/Documentation/git-daemon.txt @@ -220,7 +220,7 @@ git 9418/tcp# Git Version Control System To set up 'git daemon' as an inetd service that handles any repository under the whitelisted set of directories, /pub/foo and /pub/bar, place an entry like the following into - /etc/inetd all on one line: + /etc/inetd.conf all on one line: + git stream tcp nowait nobody /usr/bin/git @@ -233,7 +233,7 @@ git 9418/tcp# Git Version Control System To set up 'git daemon' as an inetd service that handles repositories for different virtual hosts, `www.example.com` and `www.example.org`, place an entry like the following into - `/etc/inetd` all on one line: + `/etc/inetd.conf` all on one line: + git stream tcp nowait nobody /usr/bin/git -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html