RESPOND URGENTLY!!
Greetings from George Daniels I am George Daniels, a Banker and credit system programmer (HSBC bank). I saw your email address while browsing through the bank D.T.C Screen in my office yesterday so I decided to use this very chance to know you. I believe we should use every opportunity to know each other better. However, I am contacting you for obvious reason which you will understand. I am sending this mail just to know if this email address is OK, reply me back so that I will send more details to you. I have a very important thing to discuss with you, I look forward to receiving your response at georgedaniels...@yahoo.com.hk. Have a pleasant day. George Daniels -- 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] Fix compilation on OS X.
On OS X libc headers don't define `environ', and since ec535cc2 removed the redundant declaration this code no longer builds on OS X. --- compat/unsetenv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..addf3dc 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -1,5 +1,10 @@ #include ../git-compat-util.h +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + void gitunsetenv (const char *name) { int src, dst; -- 1.8.2.1.539.g4196a96 -- 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] Fix compilation on OS X.
Benoit Sigoure wrote: diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..addf3dc 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -1,5 +1,10 @@ #include ../git-compat-util.h +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + Shouldn't this go into git-compat-util.h, since there may be other files depending on this variable? -- 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] Fix compilation on OS X.
On Sat, Jul 20, 2013 at 12:55 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Benoit Sigoure wrote: diff --git a/compat/unsetenv.c b/compat/unsetenv.c index 4ea1856..addf3dc 100644 --- a/compat/unsetenv.c +++ b/compat/unsetenv.c @@ -1,5 +1,10 @@ #include ../git-compat-util.h +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + Shouldn't this go into git-compat-util.h, since there may be other files depending on this variable? I thought about that but there are no other files that use `environ' so I opted for putting it here instead. -- Benoit tsuna Sigoure -- 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/16] First class shallow clone
v2 includes: - fix Junio comments, especially the one that may lead to incomplete commit islands. - fix send-pack setting up temporary shallow file, but never passes it to index-pack/unpack-objects (also fix the tests to catch this) - support smart http - add core.noshallow for repos that wish to be always complete - fix locally cloning a shallow repository - make upload-pack pass --shallow-file to pack-objects in order to remove duplicate object counting code just for shallow case. Nguyễn Thái Ngọc Duy (16): send-pack: forbid pushing from a shallow repository {receive,upload}-pack: advertise shallow graft information connect.c: teach get_remote_heads to parse shallow lines Move setup_alternate_shallow and write_shallow_commits to shallow.c fetch-pack: support fetching from a shallow repository {send,receive}-pack: support pushing from a shallow clone send-pack: support pushing to a shallow clone upload-pack: let pack-objects do the object counting in shallow case pack-protocol.txt: a bit about smart http Add document for command arguments for supporting smart http {fetch,upload}-pack: support fetching from a shallow clone via smart http receive-pack: support pushing to a shallow clone via http send-pack: support pushing from a shallow clone via http git-clone.txt: remove shallow clone limitations config: add core.noshallow to prevent turning a repo into a shallow one clone: use git protocol for cloning shallow repo locally Documentation/config.txt | 5 + Documentation/git-clone.txt | 7 +- Documentation/git-fetch-pack.txt | 11 +- Documentation/git-receive-pack.txt| 16 ++- Documentation/git-send-pack.txt | 9 +- Documentation/git-upload-pack.txt | 13 ++- Documentation/technical/pack-protocol.txt | 76 - builtin/clone.c | 14 ++- builtin/fetch-pack.c | 6 +- builtin/receive-pack.c| 76 +++-- builtin/send-pack.c | 7 +- cache.h | 4 +- commit.h | 27 + config.c | 5 + connect.c | 12 +- environment.c | 1 + fetch-pack.c | 90 ++- fetch-pack.h | 1 + remote-curl.c | 4 +- send-pack.c | 57 +- send-pack.h | 4 +- shallow.c | 147 + t/t5530-upload-pack-error.sh | 3 - t/t5536-fetch-shallow.sh (new +x) | 141 t/t5537-push-shallow.sh (new +x) | 176 ++ t/t5601-clone.sh | 7 ++ transport.c | 14 ++- upload-pack.c | 132 ++ 28 files changed, 858 insertions(+), 207 deletions(-) create mode 100755 t/t5536-fetch-shallow.sh create mode 100755 t/t5537-push-shallow.sh -- 1.8.2.83.gc99314b -- 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/16] connect.c: teach get_remote_heads to parse shallow lines
No callers pass a non-empty pointer as shallow_points at this stage. As a result, all clients still refuse to talk to shallow repository on the other end. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/fetch-pack.c | 2 +- builtin/send-pack.c | 2 +- cache.h | 3 ++- connect.c| 12 +++- remote-curl.c| 2 +- transport.c | 7 --- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index aba4465..080e599 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -144,7 +144,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) args.verbose ? CONNECT_VERBOSE : 0); } - get_remote_heads(fd[0], NULL, 0, ref, 0, NULL); + get_remote_heads(fd[0], NULL, 0, ref, 0, NULL, NULL); ref = fetch_pack(args, fd, conn, ref, dest, sought, nr_sought, pack_lockfile_ptr); diff --git a/builtin/send-pack.c b/builtin/send-pack.c index d4cbf64..4be5931 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -210,7 +210,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) memset(extra_have, 0, sizeof(extra_have)); - get_remote_heads(fd[0], NULL, 0, remote_refs, REF_NORMAL, extra_have); + get_remote_heads(fd[0], NULL, 0, remote_refs, REF_NORMAL, extra_have, NULL); transport_verify_remote_names(nr_refspecs, refspecs); diff --git a/cache.h b/cache.h index dd0fb33..7f17228 100644 --- a/cache.h +++ b/cache.h @@ -1091,7 +1091,8 @@ struct extra_have_objects { }; extern struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, struct ref **list, unsigned int flags, -struct extra_have_objects *); +struct extra_have_objects *have, +struct extra_have_objects *shallow); extern int server_supports(const char *feature); extern int parse_feature_request(const char *features, const char *feature); extern const char *server_feature_value(const char *feature, int *len_ret); diff --git a/connect.c b/connect.c index a0783d4..1cba424 100644 --- a/connect.c +++ b/connect.c @@ -64,7 +64,8 @@ static void die_initial_contact(int got_at_least_one_head) */ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, struct ref **list, unsigned int flags, - struct extra_have_objects *extra_have) + struct extra_have_objects *extra_have, + struct extra_have_objects *shallow_points) { int got_at_least_one_head = 0; @@ -89,6 +90,15 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, if (len 4 !prefixcmp(buffer, ERR )) die(remote error: %s, buffer + 4); + if (len == 48 !prefixcmp(buffer, shallow )) { + if (get_sha1_hex(buffer + 8, old_sha1)) + die(protocol error: expected shallow sha, got '%s', buffer + 8); + if (!shallow_points) + die(repository on the other end cannot be shallow); + add_extra_have(shallow_points, old_sha1); + continue; + } + if (len 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ') die(protocol error: expected sha/ref, got '%s', buffer); name = buffer + 41; diff --git a/remote-curl.c b/remote-curl.c index 5b3ce9e..c329bd3 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -86,7 +86,7 @@ static struct ref *parse_git_refs(struct discovery *heads, int for_push) { struct ref *list = NULL; get_remote_heads(-1, heads-buf, heads-len, list, -for_push ? REF_NORMAL : 0, NULL); +for_push ? REF_NORMAL : 0, NULL, NULL); return list; } diff --git a/transport.c b/transport.c index e15db98..10a8cb8 100644 --- a/transport.c +++ b/transport.c @@ -509,7 +509,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus connect_setup(transport, for_push, 0); get_remote_heads(data-fd[0], NULL, 0, refs, -for_push ? REF_NORMAL : 0, data-extra_have); +for_push ? REF_NORMAL : 0, data-extra_have, NULL); data-got_remote_heads = 1; return refs; @@ -539,7 +539,8 @@ static int fetch_refs_via_pack(struct transport *transport, if (!data-got_remote_heads) { connect_setup(transport, 0, 0); - get_remote_heads(data-fd[0], NULL, 0, refs_tmp, 0, NULL); + get_remote_heads(data-fd[0], NULL, 0, refs_tmp, 0, +NULL,
[PATCH v2 01/16] send-pack: forbid pushing from a shallow repository
send-pack can send a pack with loose ends to the server. receive-pack before 6d4bb38 (fetch: verify we have everything we need before updating our ref - 2011-09-01) does not detect this and keeps the pack anyway, which corrupts the repository, at least from fsck point of view. send-pack will learn to safely push from a shallow repository later. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/send-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 152c4ea..d4cbf64 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -184,6 +184,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) (send_all args.send_mirror)) usage(send_pack_usage); + if (is_repository_shallow()) + die(attempt to push from a shallow repository); + if (remote_name) { remote = remote_get(remote_name); if (!remote_has_url(remote, dest)) { -- 1.8.2.83.gc99314b -- 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 07/16] send-pack: support pushing to a shallow clone
When send-pack receives shallow lines from receive-pack, it knows the other end does not have a complete commit chains. It restrict itself to the commits that are not cut out by either end to make sure the result pack is usuable by receive-pack. The same technique here, using setup_alternate_shallow() and --shallow-file, might simplify similar code in upload-pack. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/send-pack.c | 7 +-- send-pack.c | 37 - send-pack.h | 4 +++- t/t5537-push-shallow.sh | 36 transport.c | 7 +++ 5 files changed, 79 insertions(+), 12 deletions(-) diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 7dd254f..14a73ba 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -94,6 +94,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) int fd[2]; struct child_process *conn; struct extra_have_objects extra_have; + struct extra_have_objects shallow; struct ref *remote_refs, *local_refs; int ret; int helper_status = 0; @@ -209,8 +210,10 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) } memset(extra_have, 0, sizeof(extra_have)); + memset(shallow, 0, sizeof(shallow)); - get_remote_heads(fd[0], NULL, 0, remote_refs, REF_NORMAL, extra_have, NULL); + get_remote_heads(fd[0], NULL, 0, remote_refs, REF_NORMAL, +extra_have, shallow); transport_verify_remote_names(nr_refspecs, refspecs); @@ -230,7 +233,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) set_ref_status_for_push(remote_refs, args.send_mirror, args.force_update); - ret = send_pack(args, fd, conn, remote_refs, extra_have); + ret = send_pack(args, fd, conn, remote_refs, extra_have, shallow); if (helper_status) print_helper_status(remote_refs); diff --git a/send-pack.c b/send-pack.c index dcd3345..1b828b0 100644 --- a/send-pack.c +++ b/send-pack.c @@ -27,14 +27,19 @@ static int feed_object(const unsigned char *sha1, int fd, int negative) /* * Make a pack stream and spit it out into file descriptor fd */ -static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *extra, struct send_pack_args *args) +static int pack_objects(int fd, struct ref *refs, + struct extra_have_objects *extra, + struct extra_have_objects *extra_shallow, + struct send_pack_args *args) { /* * The child becomes pack-objects --revs; we feed * the revision parameters to it via its stdin and * let its stdout go back to the other end. */ - const char *argv[] = { + const char *av[] = { + --shallow-file, + NULL, pack-objects, --all-progress-implied, --revs, @@ -45,10 +50,26 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext NULL, NULL, }; + const char **argv; struct child_process po; + static struct lock_file shallow_lock; + const char *alternate_shallow_file = NULL; int i; - i = 4; + if (extra_shallow-nr) { + memset(shallow_lock, 0, sizeof(shallow_lock)); + /* just to load up .git/shallow if exists */ + is_repository_shallow(); + setup_alternate_shallow(shallow_lock, + alternate_shallow_file, + extra_shallow, 0); + av[1] = alternate_shallow_file; + argv = av; + i = 6; + } else { + argv = av[2]; + i = 4; + } if (args-use_thin_pack) argv[i++] = --thin; if (args-use_ofs_delta) @@ -100,6 +121,10 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext if (finish_command(po)) return -1; + + if (extra_shallow-nr) + rollback_lock_file(shallow_lock); + return 0; } @@ -176,7 +201,8 @@ static int sideband_demux(int in, int out, void *data) int send_pack(struct send_pack_args *args, int fd[], struct child_process *conn, struct ref *remote_refs, - struct extra_have_objects *extra_have) + struct extra_have_objects *extra_have, + struct extra_have_objects *extra_shallow) { int in = fd[0]; int out = fd[1]; @@ -294,7 +320,8 @@ int send_pack(struct send_pack_args *args, } if (new_refs cmds_sent) { - if (pack_objects(out, remote_refs, extra_have, args) 0) { + if (pack_objects(out,
[PATCH v2 04/16] Move setup_alternate_shallow and write_shallow_commits to shallow.c
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- commit.h | 3 +++ fetch-pack.c | 53 + shallow.c| 53 + 3 files changed, 57 insertions(+), 52 deletions(-) diff --git a/commit.h b/commit.h index e0688c3..678fa20 100644 --- a/commit.h +++ b/commit.h @@ -188,6 +188,9 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads, extern void check_shallow_file_for_update(void); extern void set_alternate_shallow_file(const char *path); extern void advertise_shallow_grafts(int); +extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol); +extern void setup_alternate_shallow(struct lock_file *shallow_lock, + const char **alternate_shallow_file); int is_descendant_of(struct commit *, struct commit_list *); int in_merge_bases(struct commit *, struct commit *); diff --git a/fetch-pack.c b/fetch-pack.c index abe5ffb..dc71a2b 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -185,36 +185,6 @@ static void consume_shallow_list(struct fetch_pack_args *args, int fd) } } -struct write_shallow_data { - struct strbuf *out; - int use_pack_protocol; - int count; -}; - -static int write_one_shallow(const struct commit_graft *graft, void *cb_data) -{ - struct write_shallow_data *data = cb_data; - const char *hex = sha1_to_hex(graft-sha1); - data-count++; - if (data-use_pack_protocol) - packet_buf_write(data-out, shallow %s, hex); - else { - strbuf_addstr(data-out, hex); - strbuf_addch(data-out, '\n'); - } - return 0; -} - -static int write_shallow_commits(struct strbuf *out, int use_pack_protocol) -{ - struct write_shallow_data data; - data.out = out; - data.use_pack_protocol = use_pack_protocol; - data.count = 0; - for_each_commit_graft(write_one_shallow, data); - return data.count; -} - static enum ack_type get_ack(int fd, unsigned char *result_sha1) { int len; @@ -795,27 +765,6 @@ static int cmp_ref_by_name(const void *a_, const void *b_) return strcmp(a-name, b-name); } -static void setup_alternate_shallow(void) -{ - struct strbuf sb = STRBUF_INIT; - int fd; - - check_shallow_file_for_update(); - fd = hold_lock_file_for_update(shallow_lock, git_path(shallow), - LOCK_DIE_ON_ERROR); - if (write_shallow_commits(sb, 0)) { - if (write_in_full(fd, sb.buf, sb.len) != sb.len) - die_errno(failed to write to %s, shallow_lock.filename); - alternate_shallow_file = shallow_lock.filename; - } else - /* -* is_repository_shallow() sees empty string as no -* shallow file. -*/ - alternate_shallow_file = ; - strbuf_release(sb); -} - static struct ref *do_fetch_pack(struct fetch_pack_args *args, int fd[2], const struct ref *orig_ref, @@ -896,7 +845,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, if (args-stateless_rpc) packet_flush(fd[1]); if (args-depth 0) - setup_alternate_shallow(); + setup_alternate_shallow(shallow_lock, alternate_shallow_file); if (get_pack(args, fd, pack_lockfile)) die(git fetch-pack: fetch failed.); diff --git a/shallow.c b/shallow.c index ccdfefc..ee9edd4 100644 --- a/shallow.c +++ b/shallow.c @@ -162,3 +162,56 @@ void advertise_shallow_grafts(int fd) return; for_each_commit_graft(advertise_shallow_grafts_cb, fd); } + +struct write_shallow_data { + struct strbuf *out; + int use_pack_protocol; + int count; +}; + +static int write_one_shallow(const struct commit_graft *graft, void *cb_data) +{ + struct write_shallow_data *data = cb_data; + const char *hex = sha1_to_hex(graft-sha1); + data-count++; + if (data-use_pack_protocol) + packet_buf_write(data-out, shallow %s, hex); + else { + strbuf_addstr(data-out, hex); + strbuf_addch(data-out, '\n'); + } + return 0; +} + +int write_shallow_commits(struct strbuf *out, int use_pack_protocol) +{ + struct write_shallow_data data; + data.out = out; + data.use_pack_protocol = use_pack_protocol; + data.count = 0; + for_each_commit_graft(write_one_shallow, data); + return data.count; +} + +void setup_alternate_shallow(struct lock_file *shallow_lock, +const char **alternate_shallow_file) +{ + struct strbuf sb = STRBUF_INIT; + int fd; + + check_shallow_file_for_update(); + fd = hold_lock_file_for_update(shallow_lock, git_path(shallow), +
[PATCH v2 05/16] fetch-pack: support fetching from a shallow repository
upload-pack already advertises all shallow grafts if server repository is shallow. This information can be used to add more grafts to the client if the server sends commit chains down to its graft points. If the server is shallow, before we receive the pack, we setup a temporary shallow file that contains both local graft points and the server's. This stops index-pack from going beyond server's graft points. Only server graft points that do not have corresponding SHA-1s in local repo are added to the temp shallow file because we don't want to accidentally cut the client history because the server's is shorter. The client cutting can only happen when --depth is requested. After index-pack finishes successfully, we write the temporary shallow down with one exception: unused graft points provided by the server are removed. We don't want those lying around and suddenly become active. Note that in the shallow - shallow case, the server might not have enough information to find common roots to create an optimum pack. It might send complete commit chains down to the graft points as a result. I don't think we can improve this, unless upload-pack somehow has access to a full repository. shallow - shallow case only makes sense when the upstream provides a stable shallow repo (e.g. make a cut every year or so and ask devs to all move to the new base). If the cloned repos are all based on a stable (shallow) upstream, the above problem is unlikely to happen. A side effect of this change is we can now clone from a shallow repository. And a full repository may automatically become shallow if you fetch from a shallow repository. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/fetch-pack.c | 7 ++- commit.h | 27 +- fetch-pack.c | 30 +-- fetch-pack.h | 1 + shallow.c | 90 +--- t/t5536-fetch-shallow.sh (new +x) | 105 ++ transport.c | 10 ++-- 7 files changed, 252 insertions(+), 18 deletions(-) create mode 100755 t/t5536-fetch-shallow.sh diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 080e599..f6a6d76 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -37,6 +37,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) char **pack_lockfile_ptr = NULL; struct child_process *conn; struct fetch_pack_args args; + struct extra_have_objects shallow; packet_trace_identity(fetch-pack); @@ -144,10 +145,12 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) args.verbose ? CONNECT_VERBOSE : 0); } - get_remote_heads(fd[0], NULL, 0, ref, 0, NULL, NULL); + memset(shallow, 0, sizeof(shallow)); + get_remote_heads(fd[0], NULL, 0, ref, 0, NULL, +args.stateless_rpc ? NULL : shallow); ref = fetch_pack(args, fd, conn, ref, dest, -sought, nr_sought, pack_lockfile_ptr); +sought, nr_sought, shallow, pack_lockfile_ptr); if (pack_lockfile) { printf(lock %s\n, pack_lockfile); fflush(stdout); diff --git a/commit.h b/commit.h index 678fa20..97fd54e 100644 --- a/commit.h +++ b/commit.h @@ -188,9 +188,32 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads, extern void check_shallow_file_for_update(void); extern void set_alternate_shallow_file(const char *path); extern void advertise_shallow_grafts(int); -extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol); + +/* + * Ignore graft points that cut out existing good parts of our + * history. Graft points pointing to incomplete commit islands are + * _not_ ignore. + */ +#define WRITE_SHALLOW_NO_CUT 1 +/* + * Remove graft points that are not attached to any SHA-1 in current + * history. + */ +#define WRITE_SHALLOW_NO_UNUSED 2 +/* + * Not really write_shallow_commits() flag, this lets + * setup_alternate_shallow know this is the final setup before + * committing to .git/shallow + */ +#define WRITE_SHALLOW_REWRITE4 + +extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol, +struct extra_have_objects *extra, +unsigned int flags); extern void setup_alternate_shallow(struct lock_file *shallow_lock, - const char **alternate_shallow_file); + const char **alternate_shallow_file, + struct extra_have_objects *extra, + unsigned int flags); int is_descendant_of(struct commit *, struct commit_list *); int in_merge_bases(struct commit *, struct commit *); diff --git a/fetch-pack.c b/fetch-pack.c index
[PATCH v2 02/16] {receive,upload}-pack: advertise shallow graft information
If either receive-pack or upload-pack is called on a shallow repository, shallow graft points will be sent after the ref advertisement (but before the packet flush), so that the client has the full shape of the server's commit graph. This breaks the protocol for all clients trying to push to a shallow repo, or fetch from one. Which is basically the same end result as today's is_repository_shallow() die() in receive-pack and upload-pack. New clients will be made aware of shallow upstream and can make use of this information. Smart HTTP is not affected by this patch. Shallow support on smart-http comes later separately. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/technical/pack-protocol.txt | 3 +++ builtin/receive-pack.c| 4 +++- commit.h | 1 + shallow.c | 16 upload-pack.c | 6 -- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Documentation/technical/pack-protocol.txt b/Documentation/technical/pack-protocol.txt index b898e97..eb8edd1 100644 --- a/Documentation/technical/pack-protocol.txt +++ b/Documentation/technical/pack-protocol.txt @@ -161,6 +161,7 @@ MUST peel the ref if it's an annotated tag. advertised-refs = (no-refs / list-of-refs) + *shallow flush-pkt no-refs = PKT-LINE(zero-id SP capabilities^{} @@ -174,6 +175,8 @@ MUST peel the ref if it's an annotated tag. other-tip= obj-id SP refname LF other-peeled = obj-id SP refname ^{} LF + shallow = PKT-LINE(shallow SP obj-id) + capability-list = capability *(SP capability) capability = 1*(LC_ALPHA / DIGIT / - / _) LC_ALPHA = %x61-7A diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index e3eb5fc..6ffe526 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -176,6 +176,8 @@ static void write_head_info(void) if (!sent_capabilities) show_ref(capabilities^{}, null_sha1); + advertise_shallow_grafts(1); + /* EOF */ packet_flush(1); } @@ -990,7 +992,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) if (!enter_repo(dir, 0)) die('%s' does not appear to be a git repository, dir); - if (is_repository_shallow()) + if (is_repository_shallow() stateless_rpc) die(attempt to push into a shallow repository); git_config(receive_pack_config, NULL); diff --git a/commit.h b/commit.h index 4d452dc..e0688c3 100644 --- a/commit.h +++ b/commit.h @@ -187,6 +187,7 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag); extern void check_shallow_file_for_update(void); extern void set_alternate_shallow_file(const char *path); +extern void advertise_shallow_grafts(int); int is_descendant_of(struct commit *, struct commit_list *); int in_merge_bases(struct commit *, struct commit *); diff --git a/shallow.c b/shallow.c index cbe2526..ccdfefc 100644 --- a/shallow.c +++ b/shallow.c @@ -1,6 +1,7 @@ #include cache.h #include commit.h #include tag.h +#include pkt-line.h static int is_shallow = -1; static struct stat shallow_stat; @@ -146,3 +147,18 @@ void check_shallow_file_for_update(void) ) die(shallow file was changed during fetch); } + +static int advertise_shallow_grafts_cb(const struct commit_graft *graft, void *cb) +{ + int fd = *(int*)cb; + if (graft-nr_parent == -1) + packet_write(fd, shallow %s\n, sha1_to_hex(graft-sha1)); + return 0; +} + +void advertise_shallow_grafts(int fd) +{ + if (!is_repository_shallow()) + return; + for_each_commit_graft(advertise_shallow_grafts_cb, fd); +} diff --git a/upload-pack.c b/upload-pack.c index 127e59a..c377a3e 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -766,6 +766,7 @@ static void upload_pack(void) reset_timeout(); head_ref_namespaced(send_ref, NULL); for_each_namespaced_ref(send_ref, NULL); + advertise_shallow_grafts(1); packet_flush(1); } else { head_ref_namespaced(mark_our_ref, NULL); @@ -837,8 +838,9 @@ int main(int argc, char **argv) if (!enter_repo(dir, strict)) die('%s' does not appear to be a git repository, dir); - if (is_repository_shallow()) - die(attempt to fetch/clone from a shallow repository); + if (is_repository_shallow() stateless_rpc) + die(attempt to push into a shallow repository); + git_config(upload_pack_config, NULL); upload_pack(); return 0; -- 1.8.2.83.gc99314b -- To unsubscribe from this list: send the line unsubscribe git in the body of a message
[PATCH v2 06/16] {send,receive}-pack: support pushing from a shallow clone
Pushing from a shallow clone using today's send-pack and receive-pack may work, if the transferred pack does not ends up at any graft points. If it does, recent receive-pack that does connectivity check will reject the push. If receive-pack is old, the upstream repo becomes corrupt. The pack protocol is updated and send-pack now sends all shallow grafts before it sends the commands, if the repo is shallow. This protocol extension will break current receive-pack, which is intended, mostly to stop corrupting the upstream repo. The receiver end, the newreceive-pack, does something similar to fetch-pack: it creates a temporary shallow file with grafts from send-pack, then receives the pack, and finally writes the refined shallow file down. shadow file is not cleaned up after deleting (or force updating) a ref if that ref is the only way to reach the graft points. The reason is once we delete graft points, we can't recover. That may make reflog entries on server useless. Leave that for the administrators to decide when to clean up shadow file (maybe at repack/gc time). Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/technical/pack-protocol.txt | 4 +- builtin/receive-pack.c| 66 ++- builtin/send-pack.c | 2 +- send-pack.c | 3 ++ t/t5537-push-shallow.sh (new +x) | 74 +++ 5 files changed, 137 insertions(+), 12 deletions(-) create mode 100755 t/t5537-push-shallow.sh diff --git a/Documentation/technical/pack-protocol.txt b/Documentation/technical/pack-protocol.txt index eb8edd1..c73b62f 100644 --- a/Documentation/technical/pack-protocol.txt +++ b/Documentation/technical/pack-protocol.txt @@ -464,7 +464,9 @@ contain all the objects that the server will need to complete the new references. - update-request= command-list [pack-file] + update-request= *shallow command-list [pack-file] + + shallow = PKT-LINE(shallow SP obj-id) command-list = PKT-LINE(command NUL capability-list LF) *PKT-LINE(command LF) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 6ffe526..cbb2025 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -41,6 +41,10 @@ static int auto_gc = 1; static const char *head_name; static void *head_name_to_free; static int sent_capabilities; +static int shallow_changed; +static const char* alternate_shallow_file; +static struct lock_file shallow_lock; +static struct extra_have_objects shallow; static enum deny_action parse_deny_action(const char *var, const char *value) { @@ -751,6 +755,13 @@ static void execute_commands(struct command *commands, const char *unpacker_erro } } +static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1) +{ + ALLOC_GROW(extra-array, extra-nr + 1, extra-alloc); + hashcpy((extra-array[extra-nr][0]), sha1); + extra-nr++; +} + static struct command *read_head_info(void) { struct command *commands = NULL; @@ -765,6 +776,17 @@ static struct command *read_head_info(void) line = packet_read_line(0, len); if (!line) break; + + if (len == 48 !prefixcmp(line, shallow )) { + if (get_sha1_hex(line + 8, old_sha1)) + die(protocol error: expected shallow sha, got '%s', line + 8); + if (!has_sha1_file(old_sha1)) { + add_extra_have(shallow, old_sha1); + shallow_changed = 1; + } + continue; + } + if (len 83 || line[40] != ' ' || line[81] != ' ' || @@ -827,6 +849,13 @@ static const char *unpack(int err_fd) ? transfer_fsck_objects : 0); + if (shallow_changed) + setup_alternate_shallow(shallow_lock, + alternate_shallow_file, + shallow, + WRITE_SHALLOW_NO_CUT); + + hdr_err = parse_pack_header(hdr); if (hdr_err) { if (err_fd 0) @@ -840,7 +869,12 @@ static const char *unpack(int err_fd) if (ntohl(hdr.hdr_entries) unpack_limit) { int code, i = 0; struct child_process child; - const char *unpacker[5]; + const char *unpacker[7]; + if (alternate_shallow_file + *alternate_shallow_file) { + unpacker[i++] = --shallow-file; + unpacker[i++] = alternate_shallow_file; + } unpacker[i++] = unpack-objects; if (quiet) unpacker[i++] = -q;
[PATCH v2 14/16] git-clone.txt: remove shallow clone limitations
Now that git supports push/pull from/to a shallow clone, these limitations are not true anymore. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-clone.txt | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index 450f158..4987857 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -181,12 +181,7 @@ objects from the source repository into a pack in the cloned repository. --depth depth:: Create a 'shallow' clone with a history truncated to the - specified number of revisions. A shallow repository has a - number of limitations (you cannot clone or fetch from - it, nor push from nor into it), but is adequate if you - are only interested in the recent history of a large project - with a long history, and would want to send in fixes - as patches. + specified number of revisions. --[no-]single-branch:: Clone only the history leading to the tip of a single branch, -- 1.8.2.83.gc99314b -- 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/16] Add document for command arguments for supporting smart http
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-fetch-pack.txt | 11 +++ Documentation/git-receive-pack.txt | 16 +++- Documentation/git-send-pack.txt| 9 - Documentation/git-upload-pack.txt | 13 - 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt index 1e71754..85a9437 100644 --- a/Documentation/git-fetch-pack.txt +++ b/Documentation/git-fetch-pack.txt @@ -9,10 +9,7 @@ git-fetch-pack - Receive missing objects from another repository SYNOPSIS [verse] -'git fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] - [--upload-pack=git-upload-pack] - [--depth=n] [--no-progress] - [-v] [host:]directory [refs...] +'git fetch-pack' [options] [host:]directory [refs...] DESCRIPTION --- @@ -90,6 +87,12 @@ be in a separate packet, and the list must end with a flush packet. --no-progress:: Do not show the progress. +--stateless-rpc:: + Smart HTTP mode. + +--lock-pack:: + Issue lock command to the remote helper via stdout. + -v:: Run verbosely. diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt index b1f7dc6..b56d2eb 100644 --- a/Documentation/git-receive-pack.txt +++ b/Documentation/git-receive-pack.txt @@ -9,7 +9,7 @@ git-receive-pack - Receive what is pushed into the repository SYNOPSIS [verse] -'git-receive-pack' directory +'git-receive-pack' [options] directory DESCRIPTION --- @@ -35,6 +35,20 @@ are not fast-forwards. OPTIONS --- +--stateless-rpc:: + git-receive-pack performs only a single read-write cycle with + stdin and stdout to fit with the HTTP POST request processing + model where a program may read the request, write a response, + and must exit. + +--advertise-refs:: + Only the initial ref advertisement is output then exits + immediately to fit with the HTTP GET request model, where no + request content is received but a response must be produced. + +--quiet:: + Make unpack-objects at the receive-pack end quiet. + directory:: The repository to sync into. diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt index dc3a568..a88e7e0 100644 --- a/Documentation/git-send-pack.txt +++ b/Documentation/git-send-pack.txt @@ -9,7 +9,7 @@ git-send-pack - Push objects over Git protocol to another repository SYNOPSIS [verse] -'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=git-receive-pack] [--verbose] [--thin] [host:]directory [ref...] +'git send-pack' [options] [host:]directory [ref...] DESCRIPTION --- @@ -52,6 +52,13 @@ OPTIONS Send a thin pack, which records objects in deltified form based on objects not included in the pack to reduce network traffic. +--stateless-rpc:: + Smart HTTP mode. + +--helper-status: + Issue status commands (e.g. ok or error) to the remote + help via stdout. + host:: A remote host to house the repository. When this part is specified, 'git-receive-pack' is invoked via diff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt index 0abc806..98d73cc 100644 --- a/Documentation/git-upload-pack.txt +++ b/Documentation/git-upload-pack.txt @@ -9,7 +9,7 @@ git-upload-pack - Send objects packed back to git-fetch-pack SYNOPSIS [verse] -'git-upload-pack' [--strict] [--timeout=n] directory +'git-upload-pack' [options] directory DESCRIPTION --- @@ -31,6 +31,17 @@ OPTIONS --timeout=n:: Interrupt transfer after n seconds of inactivity. +--stateless-rpc:: + git-upload-pack performs only a single read-write cycle with + stdin and stdout to fit with the HTTP POST request processing + model where a program may read the request, write a response, + and must exit. + +--advertise-refs:: + Only the initial ref advertisement is output then exits + immediately to fit with the HTTP GET request model, where no + request content is received but a response must be produced. + directory:: The repository to sync from. -- 1.8.2.83.gc99314b -- 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/16] pack-protocol.txt: a bit about smart http
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/technical/pack-protocol.txt | 66 +++ 1 file changed, 66 insertions(+) diff --git a/Documentation/technical/pack-protocol.txt b/Documentation/technical/pack-protocol.txt index c73b62f..a1672bc 100644 --- a/Documentation/technical/pack-protocol.txt +++ b/Documentation/technical/pack-protocol.txt @@ -551,3 +551,69 @@ An example client/server communication might look like this: S: 0018ok refs/heads/debug\n S: 002ang refs/heads/master non-fast-forward\n + +Smart HTTP Transport + + +Smart HTTP protocol is basically git protocol on top of http. The +base protocol is modified slightly to fit HTTP processing model: no +bidirectional full-duplex connections, the program may read the +request, write a response and must exit. + +Reference Discovery +--- + +The server end always sends the list of references in both push and +fetch cases. This ref list is retrieved by the client's sending HTTP +GET request to a smart http url ending with +/info/refs?service=service where service could be either +git-upload-pack or git-receive-pack for fetching or pushing +respectively. The output is in pkt-line format. + + + advertised-refs = service + flush-pkt + (no-refs / list-of-refs) + flush-pkt + + service = PKT-LINE(# service= service-name) + service-name = (git-upload-pack / git-receive-pack) + + no-refs = PKT-LINE(zero-id SP capabilities^{} + NUL capability-list LF) + + list-of-refs = first-ref *other-ref + first-ref= PKT-LINE(obj-id SP refname + NUL capability-list LF) + + other-ref= PKT-LINE(other-tip / other-peeled) + other-tip= obj-id SP refname LF + other-peeled = obj-id SP refname ^{} LF + + capability-list = capability *(SP capability) + capability = 1*(LC_ALPHA / DIGIT / - / _) + LC_ALPHA = %x61-7A + + +Packfile Negotiation + + +For fetching, packet negotiation is via a series of HTTP POST requests +to an url ending with /git-upload-pack with the content in pkt-line +format. git-upload-pack's response consists of a service line like +in Reference Discovery followed by normal git-upload-pack packet +lines. Capability multi_ack_detailed is required by Smart HTTP. + +Common objects that are discovered are appended onto the request as +have lines and are sent again on the next request. This allows the +remote side to reinitialize its in-memory list of common objects +during the next request and the remote does not need to maintain the +negotiation state. + +Reference Update Request + + +For pushing, a HTTP POST request is sent to an url ending with +/git-receive-pack with the content in pkt-line format. +git-receive-pack's response consists of a service line like in +Reference Discovery followed by normal git-receive-pack packet lines. -- 1.8.2.83.gc99314b -- 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/16] config: add core.noshallow to prevent turning a repo into a shallow one
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/config.txt | 5 + builtin/receive-pack.c | 9 - cache.h | 1 + config.c | 5 + environment.c| 1 + fetch-pack.c | 9 - t/t5536-fetch-shallow.sh | 9 + t/t5537-push-shallow.sh | 6 ++ 8 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 81856dd..e811180 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -655,6 +655,11 @@ core.abbrev:: for abbreviated object names to stay unique for sufficiently long time. +core.noshallow:: + If true, reject any pushes or fetches that may turn the + repository into a shallow one. This setting is ignored if the + repository is already shallow. + add.ignore-errors:: add.ignoreErrors:: Tells 'git add' to continue adding files when some files cannot be diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 54bf6b2..95ea481 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -936,7 +936,14 @@ static const char *unpack(int err_fd) shallow, WRITE_SHALLOW_NO_CUT | WRITE_SHALLOW_REWRITE); - commit_lock_file(shallow_lock); + if (*alternate_shallow_file == '\0') { + unlink_or_warn(git_path(shallow)); + rollback_lock_file(shallow_lock); + } else { + if (!is_repository_shallow() cannot_be_shallow) + die(not allowed to turn this repository into a shallow one); + commit_lock_file(shallow_lock); + } } return NULL; } diff --git a/cache.h b/cache.h index 7f17228..3a52b08 100644 --- a/cache.h +++ b/cache.h @@ -592,6 +592,7 @@ extern int fsync_object_files; extern int core_preload_index; extern int core_apply_sparse_checkout; extern int precomposed_unicode; +extern int cannot_be_shallow; /* * The character that begins a commented line in user-editable file diff --git a/config.c b/config.c index d04e815..31f5a57 100644 --- a/config.c +++ b/config.c @@ -784,6 +784,11 @@ static int git_default_core_config(const char *var, const char *value) return 0; } + if (!strcmp(var, core.noshallow)) { + cannot_be_shallow = git_config_bool(var, value); + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; } diff --git a/environment.c b/environment.c index 0cb67b2..14c8005 100644 --- a/environment.c +++ b/environment.c @@ -61,6 +61,7 @@ int merge_log_config = -1; int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */ struct startup_info *startup_info; unsigned long pack_size_limit_cfg; +int cannot_be_shallow; /* * The character that begins a commented line in user-editable file diff --git a/fetch-pack.c b/fetch-pack.c index f337526..40e7aa2 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -960,7 +960,14 @@ struct ref *fetch_pack(struct fetch_pack_args *args, WRITE_SHALLOW_NO_CUT | WRITE_SHALLOW_REWRITE); } - commit_lock_file(shallow_lock); + if (*alternate_shallow_file == '\0') { + unlink_or_warn(git_path(shallow)); + rollback_lock_file(shallow_lock); + } else { + if (!is_repository_shallow() cannot_be_shallow) + die(not allowed to turn this repository into a shallow one); + commit_lock_file(shallow_lock); + } } } diff --git a/t/t5536-fetch-shallow.sh b/t/t5536-fetch-shallow.sh index 6ea6347..b7f89b1 100755 --- a/t/t5536-fetch-shallow.sh +++ b/t/t5536-fetch-shallow.sh @@ -102,6 +102,15 @@ EOF ' +test_expect_success 'core.noshallow' ' + git init clean + ( + cd clean + git config core.noshallow true + test_must_fail git fetch ../shallow/.git + ) +' + if test -n $NO_CURL -o -z $GIT_TEST_HTTPD; then say 'skipping remaining tests, git built without http support' test_done diff --git a/t/t5537-push-shallow.sh b/t/t5537-push-shallow.sh index 8bea496..0edd51f 100755 --- a/t/t5537-push-shallow.sh +++ b/t/t5537-push-shallow.sh @@ -108,6 +108,12 @@ EOF ) ' +test_expect_success 'core.noshallow' ' + git init clean + git --git-dir=clean/.git config core.noshallow true + test_must_fail git --git-dir=shallow/.git push clean
[PATCH v2 08/16] upload-pack: let pack-objects do the object counting in shallow case
Remove the duplicate object counting code in upload-pack, dump out all register_shallow()'d SHA-1 into a temporary shallow file and feed it to pack-objects. The end result is the same, except with less code, and fewer bytes sending over pipe to pack-objects. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- t/t5530-upload-pack-error.sh | 3 - upload-pack.c| 128 ++- 2 files changed, 30 insertions(+), 101 deletions(-) diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh index c983d36..3932e79 100755 --- a/t/t5530-upload-pack-error.sh +++ b/t/t5530-upload-pack-error.sh @@ -54,9 +54,6 @@ test_expect_success 'upload-pack fails due to error in rev-list' ' printf 0032want %s\n0034shallow %s0009done\n \ $(git rev-parse HEAD) $(git rev-parse HEAD^) input test_must_fail git upload-pack . input /dev/null 2output.err - # pack-objects survived - grep Total.*, reused output.err - # but there was an error, which must have been in rev-list grep bad tree object output.err ' diff --git a/upload-pack.c b/upload-pack.c index c377a3e..c3e68ae 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -35,7 +35,6 @@ static int no_done; static int use_thin_pack, use_ofs_delta, use_include_tag; static int no_progress, daemon_mode; static int allow_tip_sha1_in_want; -static int shallow_nr; static struct object_array have_obj; static struct object_array want_obj; static struct object_array extra_edge_obj; @@ -68,87 +67,32 @@ static ssize_t send_client_data(int fd, const char *data, ssize_t sz) return sz; } -static FILE *pack_pipe = NULL; -static void show_commit(struct commit *commit, void *data) -{ - if (commit-object.flags BOUNDARY) - fputc('-', pack_pipe); - if (fputs(sha1_to_hex(commit-object.sha1), pack_pipe) 0) - die(broken output pipe); - fputc('\n', pack_pipe); - fflush(pack_pipe); - free(commit-buffer); - commit-buffer = NULL; -} - -static void show_object(struct object *obj, - const struct name_path *path, const char *component, - void *cb_data) -{ - show_object_with_name(pack_pipe, obj, path, component); -} - -static void show_edge(struct commit *commit) -{ - fprintf(pack_pipe, -%s\n, sha1_to_hex(commit-object.sha1)); -} - -static int do_rev_list(int in, int out, void *user_data) -{ - int i; - struct rev_info revs; - - pack_pipe = xfdopen(out, w); - init_revisions(revs, NULL); - revs.tag_objects = 1; - revs.tree_objects = 1; - revs.blob_objects = 1; - if (use_thin_pack) - revs.edge_hint = 1; - - for (i = 0; i want_obj.nr; i++) { - struct object *o = want_obj.objects[i].item; - /* why??? */ - o-flags = ~UNINTERESTING; - add_pending_object(revs, o, NULL); - } - for (i = 0; i have_obj.nr; i++) { - struct object *o = have_obj.objects[i].item; - o-flags |= UNINTERESTING; - add_pending_object(revs, o, NULL); - } - setup_revisions(0, NULL, revs, NULL); - if (prepare_revision_walk(revs)) - die(revision walk setup failed); - mark_edges_uninteresting(revs.commits, revs, show_edge); - if (use_thin_pack) - for (i = 0; i extra_edge_obj.nr; i++) - fprintf(pack_pipe, -%s\n, sha1_to_hex( - extra_edge_obj.objects[i].item-sha1)); - traverse_commit_list(revs, show_commit, show_object, NULL); - fflush(pack_pipe); - fclose(pack_pipe); - return 0; -} - static void create_pack_file(void) { - struct async rev_list; struct child_process pack_objects; char data[8193], progress[128]; char abort_msg[] = aborting due to possible repository corruption on the remote side.; int buffered = -1; ssize_t sz; - const char *argv[10]; - int arg = 0; + const char *argv[12]; + int i, arg = 0; + FILE *pipe_fd; + static struct lock_file shallow_lock; + const char *alternate_shallow_file = NULL; + + setup_alternate_shallow(shallow_lock, + alternate_shallow_file, + NULL, 0); + if (*alternate_shallow_file) { + argv[arg++] = --shallow-file; + argv[arg++] = alternate_shallow_file; + } argv[arg++] = pack-objects; - if (!shallow_nr) { - argv[arg++] = --revs; - if (use_thin_pack) - argv[arg++] = --thin; - } + argv[arg++] = --revs; + if (use_thin_pack) + argv[arg++] = --thin; argv[arg++] = --stdout; if (!no_progress) @@ -169,28 +113,18 @@
[PATCH v2 11/16] {fetch,upload}-pack: support fetching from a shallow clone via smart http
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/technical/pack-protocol.txt | 3 +++ builtin/fetch-pack.c | 3 +-- remote-curl.c | 4 +++- t/t5536-fetch-shallow.sh | 27 +++ upload-pack.c | 2 -- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Documentation/technical/pack-protocol.txt b/Documentation/technical/pack-protocol.txt index a1672bc..5013652 100644 --- a/Documentation/technical/pack-protocol.txt +++ b/Documentation/technical/pack-protocol.txt @@ -574,6 +574,7 @@ respectively. The output is in pkt-line format. advertised-refs = service flush-pkt (no-refs / list-of-refs) + *shallow flush-pkt service = PKT-LINE(# service= service-name) @@ -590,6 +591,8 @@ respectively. The output is in pkt-line format. other-tip= obj-id SP refname LF other-peeled = obj-id SP refname ^{} LF + shallow = PKT-LINE(shallow SP obj-id) + capability-list = capability *(SP capability) capability = 1*(LC_ALPHA / DIGIT / - / _) LC_ALPHA = %x61-7A diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index f6a6d76..b89d753 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -146,8 +146,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) } memset(shallow, 0, sizeof(shallow)); - get_remote_heads(fd[0], NULL, 0, ref, 0, NULL, -args.stateless_rpc ? NULL : shallow); + get_remote_heads(fd[0], NULL, 0, ref, 0, NULL, shallow); ref = fetch_pack(args, fd, conn, ref, dest, sought, nr_sought, shallow, pack_lockfile_ptr); diff --git a/remote-curl.c b/remote-curl.c index c329bd3..de2cc8a 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -78,6 +78,7 @@ struct discovery { char *buf; size_t len; struct ref *refs; + struct extra_have_objects shallow; unsigned proto_git : 1; }; static struct discovery *last_discovery; @@ -86,7 +87,7 @@ static struct ref *parse_git_refs(struct discovery *heads, int for_push) { struct ref *list = NULL; get_remote_heads(-1, heads-buf, heads-len, list, -for_push ? REF_NORMAL : 0, NULL, NULL); +for_push ? REF_NORMAL : 0, NULL, heads-shallow); return list; } @@ -146,6 +147,7 @@ static void free_discovery(struct discovery *d) if (d) { if (d == last_discovery) last_discovery = NULL; + free(d-shallow.array); free(d-buf_alloc); free_refs(d-refs); free(d); diff --git a/t/t5536-fetch-shallow.sh b/t/t5536-fetch-shallow.sh index 15a8208..6ea6347 100755 --- a/t/t5536-fetch-shallow.sh +++ b/t/t5536-fetch-shallow.sh @@ -102,4 +102,31 @@ EOF ' +if test -n $NO_CURL -o -z $GIT_TEST_HTTPD; then + say 'skipping remaining tests, git built without http support' + test_done +fi + +LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5536'} +. $TEST_DIRECTORY/lib-httpd.sh +start_httpd + +test_expect_success 'clone http repository' ' + git clone --bare --no-local shallow $HTTPD_DOCUMENT_ROOT_PATH/repo.git + git clone --quiet $HTTPD_URL/smart/repo.git clone + ( + cd clone + git fsck + git log --format=%s origin/master actual + cat EOF expect +6 +5 +4 +3 +EOF + test_cmp expect actual + ) +' + +stop_httpd test_done diff --git a/upload-pack.c b/upload-pack.c index c3e68ae..263ae08 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -770,8 +770,6 @@ int main(int argc, char **argv) if (!enter_repo(dir, strict)) die('%s' does not appear to be a git repository, dir); - if (is_repository_shallow() stateless_rpc) - die(attempt to push into a shallow repository); git_config(upload_pack_config, NULL); upload_pack(); -- 1.8.2.83.gc99314b -- 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 12/16] receive-pack: support pushing to a shallow clone via http
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/receive-pack.c | 3 --- t/t5537-push-shallow.sh | 35 +++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index cbb2025..54bf6b2 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1038,9 +1038,6 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) if (!enter_repo(dir, 0)) die('%s' does not appear to be a git repository, dir); - if (is_repository_shallow() stateless_rpc) - die(attempt to push into a shallow repository); - git_config(receive_pack_config, NULL); if (0 = transfer_unpack_limit) diff --git a/t/t5537-push-shallow.sh b/t/t5537-push-shallow.sh index beb85ce..02d9198 100755 --- a/t/t5537-push-shallow.sh +++ b/t/t5537-push-shallow.sh @@ -16,6 +16,7 @@ test_expect_success 'setup' ' commit 2 commit 3 commit 4 + git clone . full ( git init full-abc cd full-abc @@ -107,4 +108,38 @@ EOF ) ' +if test -n $NO_CURL -o -z $GIT_TEST_HTTPD; then + say 'skipping remaining tests, git built without http support' + test_done +fi + +LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'} +. $TEST_DIRECTORY/lib-httpd.sh +start_httpd + +test_expect_success 'push to shallow repo via http' ' + git clone --bare --no-local shallow $HTTPD_DOCUMENT_ROOT_PATH/repo.git + ( + cd $HTTPD_DOCUMENT_ROOT_PATH/repo.git + git config http.receivepack true + ) + ( + cd full + commit 9 + git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master + ) + ( + cd $HTTPD_DOCUMENT_ROOT_PATH/repo.git + git fsck + git log --format=%s top/master actual + cat EOF expect +9 +4 +3 +EOF + test_cmp expect actual + ) +' + +stop_httpd test_done -- 1.8.2.83.gc99314b -- 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/16] send-pack: support pushing from a shallow clone via http
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/send-pack.c | 3 --- send-pack.c | 19 +-- t/t5537-push-shallow.sh | 25 + 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 14a73ba..b177120 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -185,9 +185,6 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) (send_all args.send_mirror)) usage(send_pack_usage); - if (is_repository_shallow() args.stateless_rpc) - die(attempt to push from a shallow repository); - if (remote_name) { remote = remote_get(remote_name); if (!remote_has_url(remote, dest)) { diff --git a/send-pack.c b/send-pack.c index 1b828b0..520c838 100644 --- a/send-pack.c +++ b/send-pack.c @@ -198,6 +198,21 @@ static int sideband_demux(int in, int out, void *data) return ret; } +static int advertise_shallow_grafts_cb(const struct commit_graft *graft, void *cb) +{ + struct strbuf *sb = cb; + if (graft-nr_parent == -1) + packet_buf_write(sb, shallow %s\n, sha1_to_hex(graft-sha1)); + return 0; +} + +void advertise_shallow_grafts_buf(struct strbuf *sb) +{ + if (!is_repository_shallow()) + return; + for_each_commit_graft(advertise_shallow_grafts_cb, sb); +} + int send_pack(struct send_pack_args *args, int fd[], struct child_process *conn, struct ref *remote_refs, @@ -239,7 +254,7 @@ int send_pack(struct send_pack_args *args, } if (!args-dry_run) - advertise_shallow_grafts(out); + advertise_shallow_grafts_buf(req_buf); /* * Finally, tell the other end! @@ -299,7 +314,7 @@ int send_pack(struct send_pack_args *args, } if (args-stateless_rpc) { - if (!args-dry_run cmds_sent) { + if (!args-dry_run (cmds_sent || is_repository_shallow())) { packet_buf_flush(req_buf); send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX); } diff --git a/t/t5537-push-shallow.sh b/t/t5537-push-shallow.sh index 02d9198..8bea496 100755 --- a/t/t5537-push-shallow.sh +++ b/t/t5537-push-shallow.sh @@ -141,5 +141,30 @@ EOF ) ' +test_expect_success 'push from shallow repo via http' ' + mv $HTTPD_DOCUMENT_ROOT_PATH/repo.git shallow-upstream.git + git clone --bare --no-local full $HTTPD_DOCUMENT_ROOT_PATH/repo.git + ( + cd $HTTPD_DOCUMENT_ROOT_PATH/repo.git + git config http.receivepack true + ) + commit 10 + git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master + ( + cd $HTTPD_DOCUMENT_ROOT_PATH/repo.git + git fsck + git log --format=%s top/master actual + cat EOF expect +10 +1 +4 +3 +2 +1 +EOF + test_cmp expect actual + ) +' + stop_httpd test_done -- 1.8.2.83.gc99314b -- 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 16/16] clone: use git protocol for cloning shallow repo locally
clone_local() does not handle $SRC/shallow. It could be made so, but it's simpler to use fetch-pack/upload-pack instead. This used by be caught by the check in upload-pack, which is triggered by transport_get_remote_refs(), even in local clone case. The check is now gone and check_everything_connected() should catch the result incomplete repo. But check_everything_connected() will soon be skipped in local clone case, opening a door to corrupt repo. This patch should close that door. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/clone.c | 14 -- t/t5601-clone.sh | 7 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/builtin/clone.c b/builtin/clone.c index 17f57cd..09e383e 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -789,8 +789,18 @@ int cmd_clone(int argc, const char **argv, const char *prefix) else repo = repo_name; is_local = option_local != 0 path !is_bundle; - if (is_local option_depth) - warning(_(--depth is ignored in local clones; use file:// instead.)); + if (is_local) { + struct strbuf sb = STRBUF_INIT; + if (option_depth) + warning(_(--depth is ignored in local clones; use file:// instead.)); + strbuf_addf(sb, %s/shallow, path); + if (!access(sb.buf, F_OK)) { + if (option_local 0) + warning(_(source repository is shallow, ignoring --local)); + is_local = 0; + } + strbuf_release(sb); + } if (option_local 0 !is_local) warning(_(--local is ignored)); diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 0629149..35a2a3d 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -285,4 +285,11 @@ test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' ' git clone ./foo:bar foobar ' +test_expect_success 'shallow clone locally' ' + git clone --depth=1 --no-local src ssrrcc + git clone ssrrcc ddsstt + test_cmp ssrrcc/.git/shallow ddsstt/.git/shallow + ( cd ddsstt git fsck ) +' + test_done -- 1.8.2.83.gc99314b -- 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] Fix compilation on OS X.
On 2013-07-20 09.49, Benoit Sigoure wrote: +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + A more generic approach could be: In the file config.mak.uname: Define a variable in the Darwin section like this NO_EXT_ENVIRON = UnfortunatelyYes In Makefile, pick it up, and convert it into a compiler option: ifdef NO_EXT_ENVIRON BASIC_CFLAGS += -DNO_EXT_ENVIRON endif And in git-compat-util.h, add these lines at a good place: #ifdef NO_EXT_ENVIRON extern char **environ; #endif This will allow other OS to use the NO_EXT_ENVIRON when needed,. Thanks for working on this. /Torsten -- 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-P4 Bug With Filename Case Change
aaron.dw...@imgtec.com wrote on Wed, 17 Jul 2013 22:11 +: We recently have moved our project from Git to Perforce and those of us who prefer Git still are using Git p4 to stay in Git land. One of the files in our repository was renamed while still in Git, but the rename only consisted of a case change of a character in the name. Now, on an OS X box with a case insensitive file system (not sure if that matters), one of our guys cloned from perforce with Git p4 and used @all to get all history. When this operation is finished, the file name is in its original state, not the newer renamed state. So original file Foo, new file foo, to make it concrete. The git p4 clone command generates an internal .git/ history of the entire p4 repository, before checking out any files in the workspace. It does this without touching the filesystem, so I would expect it never to mangle case, even on OSX. You should be able to verify this with: mkdir test1 cd test1 git init git p4 clone --bare --destination . //depot/proj@all git ls-tree HEAD and see that foo is there, not Foo. Then check that the rename really did happen: git log --stat --summary --follow -- foo should show a rename Foo = foo in there somewhere. Does this all work? I'd like to clear up this confusing part first. Perforce doesn't respect that file as being in the repository. We noticed this after making a local Git commit and upon issuing a Git p4 submit, things go haywire with file(s) not opened on this client and nothing getting submitted. Yep, it's all bad from there-on, I'm sure. I'm a bit out of my depth on case-insensitive file systems. Do check if the cloner in question has core.ignorecase config option set: git config --get core.ignorecase -- Pete -- 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] git p4 test: Check ignore files with client spec
vitor@gmail.com wrote on Fri, 19 Jul 2013 00:04 +0100: This test confirms that a file can be ignored during git p4 sync if if is excluded in P4 client specification. This is a good check to have, and I'm glad it happens to work. :) I'd forgotten during your conversation with Matthieu that we did indeed have tests for detect-branches with use-client-spec. This test sure seems like it should cover that situation though. Acked-by: Pete Wyckoff p...@padd.com --- t/t9801-git-p4-branch.sh | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh index 9730821..2bf142d 100755 --- a/t/t9801-git-p4-branch.sh +++ b/t/t9801-git-p4-branch.sh @@ -469,9 +469,11 @@ test_expect_success 'use-client-spec detect-branches skips branches setup' ' View: //depot/usecs/b1/... //depot/usecs/b3/... EOF - echo b3/b3-file3 b3/b3-file3 - p4 add b3/b3-file3 - p4 submit -d b3/b3-file3 + echo b3/b3-file3_1 b3/b3-file3_1 + echo b3/b3-file3_2 b3/b3-file3_2 + p4 add b3/b3-file3_1 + p4 add b3/b3-file3_2 + p4 submit -d b3/b3-file3_1 b3/b3-file3_2 ) ' @@ -487,6 +489,21 @@ test_expect_success 'use-client-spec detect-branches skips branches' ' ) ' +test_expect_success 'use-client-spec detect-branches skips files in branches' ' + client_view //depot/usecs/... //client/... \ + -//depot/usecs/b3/b3-file3_1 //client/b3/b3-file3_1 + test_when_finished cleanup_git + test_create_repo $git + ( + cd $git + git p4 sync --detect-branches --use-client-spec //depot/usecs@all + git checkout -b master p4/usecs/b3 + test_path_is_file b1-file1 + test_path_is_file b3-file3_2 + test_path_is_missing b3-file3_1 + ) +' + test_expect_success 'kill p4d' ' kill_p4d ' -- 1.8.3.2 -- 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 -- 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] git p4 test: Check ignore files with client spec
On Sat, Jul 20, 2013 at 2:48 PM, Pete Wyckoff p...@padd.com wrote: I'd forgotten during your conversation with Matthieu that we did indeed have tests for detect-branches with use-client-spec. This test sure seems like it should cover that situation though. It was good that you had some tests implemented, otherwise it would have taken me much more time to implement this ;) -- 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] hg-to-git: --allow-empty-message in git commit
Do not fail to import mercurial commits with empty commit messages. Signed-off-by: Maurício C Antunes mauricio.antu...@gmail.com --- contrib/hg-to-git/hg-to-git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py index 232625a..60dec86 100755 --- a/contrib/hg-to-git/hg-to-git.py +++ b/contrib/hg-to-git/hg-to-git.py @@ -225,7 +225,7 @@ for cset in range(int(tip) + 1): os.system('git ls-files -x .hg --deleted | git update-index --remove --stdin') # commit -os.system(getgitenv(user, date) + 'git commit --allow-empty -a -F %s' % filecomment) +os.system(getgitenv(user, date) + 'git commit --allow-empty --allow-empty-message -a -F %s' % filecomment) os.unlink(filecomment) # tag -- 1.8.3.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] Fix compilation on OS X.
On OS X libc headers don't define `environ', and since ec535cc2 removed the redundant declaration this code no longer builds on OS X. --- Makefile | 5 + config.mak.uname | 1 + git-compat-util.h | 4 3 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 0600eb4..774db18 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,8 @@ all:: # # Define NO_UNSETENV if you don't have unsetenv in the C library. # +# Define NO_EXT_ENVIRON if your C library doesn't define `environ'. +# # Define NO_MKDTEMP if you don't have mkdtemp in the C library. # # Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash. @@ -1307,6 +1309,9 @@ ifdef NO_UNSETENV COMPAT_CFLAGS += -DNO_UNSETENV COMPAT_OBJS += compat/unsetenv.o endif +ifdef NO_EXT_ENVIRON + COMPAT_CFLAGS += -DNO_EXT_ENVIRON +endif ifdef NO_SYS_SELECT_H BASIC_CFLAGS += -DNO_SYS_SELECT_H endif diff --git a/config.mak.uname b/config.mak.uname index 7ac541e..ebcfbfd 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -93,6 +93,7 @@ ifeq ($(uname_S),Darwin) NO_STRLCPY = YesPlease endif NO_MEMMEM = YesPlease +NO_EXT_ENVIRON = UnfortunatelyYes USE_ST_TIMESPEC = YesPlease HAVE_DEV_TTY = YesPlease NEEDS_CLIPPED_WRITE = YesPlease diff --git a/git-compat-util.h b/git-compat-util.h index ff193f4..3bac4e9 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -408,6 +408,10 @@ extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); */ extern ssize_t read_in_full(int fd, void *buf, size_t count); +#ifdef NO_EXT_ENVIRON +extern char **environ; +#endif + #ifdef NO_SETENV #define setenv gitsetenv extern int gitsetenv(const char *, const char *, int); -- 1.8.2.1.539.g4196a96 -- 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] Fix generic typos in comments
Hi, I wrote a tool that effectively fixes typos in comments and only in comments. It can be downloaded here: https://github.com/neleai/stylepp For typos you need identify them, write replacement dictionary and run STYLEPP/script/stylepp_skeleton stylepp_fix_comment Here generic dictionary is used that was taken from wikipedia. https://github.com/neleai/stylepp/blob/master/maintained/dictionary_wiki --- bisect.c |2 +- builtin/apply.c |6 +++--- builtin/clean.c |2 +- builtin/update-index.c|4 ++-- compat/regex/regcomp.c| 10 +- compat/regex/regex_internal.c |2 +- compat/regex/regexec.c|4 ++-- connect.c |2 +- daemon.c |2 +- diff.c|2 +- dir.c |2 +- entry.c |2 +- fast-import.c |2 +- parse-options.c |2 +- read-cache.c |2 +- refs.c|2 +- remote.c | 14 +++--- revision.c|2 +- sha1-lookup.c |2 +- sha1_file.c |2 +- sha1_name.c |2 +- transport.c |2 +- 22 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bisect.c b/bisect.c index 71c1958..9c225bd 100644 --- a/bisect.c +++ b/bisect.c @@ -845,7 +845,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout) if (!stat(filename, st) S_ISREG(st.st_mode)) goto done; - /* Bisecting with no good rev is ok. */ + /* Bisecting with no good rev is OK. */ if (good_revs.nr == 0) goto done; diff --git a/builtin/apply.c b/builtin/apply.c index ff01ebf..4f4dd56 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3659,12 +3659,12 @@ static void build_fake_ancestor(struct patch *list, const char *filename) if (S_ISGITLINK(patch-old_mode)) { if (!preimage_sha1_in_gitlink_patch(patch, sha1)) - ; /* ok, the textual part looks sane */ + ; /* OK, the textual part looks sane */ else die(sha1 information is lacking or useless for submoule %s, name); } else if (!get_sha1_blob(patch-old_sha1_prefix, sha1)) { - ; /* ok */ + ; /* OK */ } else if (!patch-lines_added !patch-lines_deleted) { /* mode-only change: update the current */ if (get_current_sha1(patch-old_name, sha1)) @@ -3755,7 +3755,7 @@ static void show_rename_copy(struct patch *p) old = slash_old + 1; new = slash_new + 1; } - /* p-old_name thru old is the common prefix, and old and new + /* p-old_name through old is the common prefix, and old and new * through the end of names are renames */ if (old != p-old_name) diff --git a/builtin/clean.c b/builtin/clean.c index 04e396b..badbad3 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -89,7 +89,7 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag, strbuf_setlen(path, len); strbuf_addstr(path, e-d_name); if (lstat(path-buf, st)) - ; /* fall thru */ + ; /* fall through */ else if (S_ISDIR(st.st_mode)) { if (remove_dirs(path, prefix, force_flag, dry_run, quiet, gone)) ret = 1; diff --git a/builtin/update-index.c b/builtin/update-index.c index 5c7762e..b558e09 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -71,10 +71,10 @@ static int remove_one_path(const char *path) /* * Handle a path that couldn't be lstat'ed. It's either: - * - missing file (ENOENT or ENOTDIR). That's ok if we're + * - missing file (ENOENT or ENOTDIR). That's OK if we're *supposed to be removing it and the removal actually *succeeds. - * - permission error. That's never ok. + * - permission error. That's never OK. */ static int process_lstat_error(const char *path, int err) { diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c index d0025bd..8afd4ff 100644 --- a/compat/regex/regcomp.c +++ b/compat/regex/regcomp.c @@ -2617,7 +2617,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. RANGE_ALLOC is the allocated size of mbcset-range_starts, and - mbcset-range_ends, is a pointer argument sinse we may + mbcset-range_ends, is a
Re: [PATCH 2/2] Fix typos in comments
Hi, I wrote a tool that effectively fixes typos in comments and only in comments. It can be downloaded here: https://github.com/neleai/stylepp Now I fix specific typos. First I need to generate list of likely typos. This is done by running following commands in desired directory STYLEPP/script/stylepp_spellcheck # then STYLEPP/script/stylepp_dictionary This creates an dictionary so we can use STYLEPP/script/stylepp_skeleton stylepp_fix_comment A dictionary that I generated is following, patch is below. accreting accrediting alloted allocated apporiate appropriate becaue because behaviour behavior coalesed coalesced colourful colorful commentz comments commmit commit converison conversion correspoding corresponding descendent descendant descendents descendants ententries entries environement environment erroring erring explicitely explicitly happear appear identifer identifier initialied initialized initialised initialized intialize initialize matcing matching programing programming sastisfies satisfies satisify satisfy sequemces sequences timming trimming traling trailing transiton transition writeable writable --- builtin/apply.c |2 +- builtin/checkout.c |2 +- builtin/fast-export.c |2 +- builtin/log.c |2 +- builtin/mktree.c|2 +- builtin/push.c |2 +- builtin/tar-tree.c |2 +- builtin/update-index.c |2 +- cache.h |2 +- combine-diff.c |2 +- commit-slab.h |2 +- compat/nedmalloc/malloc.c.h |8 compat/obstack.h|2 +- compat/poll/poll.h |2 +- compat/precompose_utf8.c|2 +- compat/regex/regcomp.c |8 compat/regex/regexec.c |4 ++-- convert.c |2 +- convert.h |2 +- diff-no-index.c |2 +- diff.c |4 ++-- kwset.c | 10 +- notes.h |8 read-cache.c|2 +- refs.h |2 +- revision.c |2 +- sha1_name.c |2 +- transport-helper.c |4 ++-- write_or_die.c |2 +- xdiff/xprepare.c|2 +- 30 files changed, 46 insertions(+), 46 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 4f4dd56..541dc6b 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -132,7 +132,7 @@ static void set_default_whitespace_mode(const char *whitespace_option) } /* - * For diff-stat like behaviour, we keep track of the biggest change + * For diff-stat like behavior, we keep track of the biggest change * we've seen, and the longest filename. That allows us to do simple * scaling. */ diff --git a/builtin/checkout.c b/builtin/checkout.c index 7fe0bff..9f29bb2 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1137,7 +1137,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) * 3) git checkout something [paths] * * including last branch syntax and DWIM-ery for names of -* remote branches, erroring out for invalid or ambiguous cases. +* remote branches, erring out for invalid or ambiguous cases. */ if (argc) { unsigned char rev[20]; diff --git a/builtin/fast-export.c b/builtin/fast-export.c index d1d68e9..8e19058 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -379,7 +379,7 @@ static void handle_tag(const char *name, struct tag *tag) int tagged_mark; struct commit *p; - /* Trees have no identifer in fast-export output, thus we have no way + /* Trees have no identifier in fast-export output, thus we have no way * to output tags of trees, tags of tags of trees, etc. Simply omit * such tags. */ diff --git a/builtin/log.c b/builtin/log.c index 2625f98..b97f56e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1348,7 +1348,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (rev.max_count 0 !rev.show_root_diff) { /* -* This is traditional behaviour of git format-patch +* This is traditional behavior of git format-patch * origin that prepares what the origin side still * does not have. */ diff --git a/builtin/mktree.c b/builtin/mktree.c index f92ba40..c415a67 100644 --- a/builtin/mktree.c +++
Dead link
Hi, I ran simple script to check for dead links. It found three false positives and following link that now looks defunct. What we do about it? http://marc.theaimsgroup.com/?l=gitm=112927316408690w=2 -- 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: Dead link
Ondřej Bílka wrote: http://marc.theaimsgroup.com/?l=gitm=112927316408690w=2 Just run a sed 's|http://marc.theaimsgroup.com|http://marc.info|', and submit the resulting patch. -- 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: Dead link
On Sun, Jul 21, 2013 at 01:00:11AM +0530, Ramkumar Ramachandra wrote: Ondřej Bílka wrote: http://marc.theaimsgroup.com/?l=gitm=112927316408690w=2 Just run a sed 's|http://marc.theaimsgroup.com|http://marc.info|', and submit the resulting patch. Thanks, here is patch. diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index e364007..fe723e4 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -4675,5 +4675,5 @@ Write a chapter on using plumbing and writing scripts. Alternates, clone -reference, etc. More on recovery from repository corruption. See: - http://marc.theaimsgroup.com/?l=gitm=117263864820799w=2 - http://marc.theaimsgroup.com/?l=gitm=117147855503798w=2 + http://marc.info/?l=gitm=117263864820799w=2 + http://marc.info/?l=gitm=117147855503798w=2 diff --git a/builtin/apply.c b/builtin/apply.c index 541dc6b..82049c7 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -473,7 +473,7 @@ static char *find_name_gnu(const char *line, const char *def, int p_value) /* * Proposed new-style GNU patch/diff format; see -* http://marc.theaimsgroup.com/?l=gitm=112927316408690w=2 +* http://marc.info/?l=gitm=112927316408690w=2 */ if (unquote_c_style(name, line, NULL)) { strbuf_release(name); diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh index 331b9b0..d15b313 100755 --- a/t/t6021-merge-criss-cross.sh +++ b/t/t6021-merge-criss-cross.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Fredrik Kuivinen # -# See http://marc.theaimsgroup.com/?l=gitm=111463358500362w=2 for a +# See http://marc.info/?l=gitm=111463358500362w=2 for a # nice description of what this is about. -- 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 2/2] Fix typos in comments
On Sat, Jul 20, 2013 at 09:13:12PM +0200, Ondřej Bílka wrote: A dictionary that I generated is following, patch is below. alloted allocated allotted is a valid word, and I think it would work fine in the code. It's probably what was intended, anyway. behaviour behavior colourful colorful initialised initialized I'm not sure whether git has a standard for which dialect of English is to be used, but the three words on the left are considered correct in most non-American dialects. Characterizing them as typos isn't strictly correct. Perhaps Convert comments to American English is more accurate? -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH] test-lib.sh - define and use GREP_STRIPS_CR
Mark Levedahl wrote: Define a common macro for grep needing -U to allow tests to not need to inquire of specific platforms needing this option. Change t3032 and t5560 to use this rather than testing explicitly for mingw. This fixes these two tests on Cygwin. Signed-off-by: Mark Levedahl mleved...@gmail.com --- This replaces my earlier patch against t3032 (8896b287 on pu) Yep, this looks good and (as expected) it works on cygwin 1.5 too. :-D Thanks. ATB, Ramsay Jones -- 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] Cygwin has trustable filemode
Mark Levedahl wrote: On 07/19/2013 12:40 PM, Junio C Hamano wrote: Thanks, will replace. What do we want to do with the compat/regex build-time switch? IIRC, this was only needed for 1.7 and not 1.5, and I also would expect (without anything to back-up, so this is more a faith than expectation) over time the new library would have a working regex library. The situation is that Cygwin uses newlib rather than glibc, and does so for licesnsing reasons (redhat sells licenses to developers allowing closed source applications built using Cygwin). So, there must be a compelling need to fix the library - git has a simple work around, so isn't the case. Also, Cygwin has a perl regex library for those demanding more complete / correct regex solution. So, I make no prediction on when the newlib regex functions are fixed. Related: Should we have separate settings for 1.5 and 1.7 for several variables? We already do. Conflicts I see not reflected in config.mak.uname on pu: trustable filemode (1.7 has, 1.5 does not) I see no need for any difference here. puzzled. MMAP/Pread (1.7 pread is thread safe, 1.5 I dont think was, MMAP utility is convolved in this) pread() is now thread-safe? great! (It must have been a fairly recent change; last time I looked it was still not thread-safe on 1.7.) regex - 1.7 is broken, per Ramsay 1.5 works I don't see any reason not to use the compat/regex routines on both cygwin 1.5 and 1.7. However, I wouldn't object to restricting the use of the compat routines to cygwin 1.7 either! If you think its worth it, I'll create a patch series with the above and justifications for the different settings that I know. As far as I can see, only the pread() and maybe MMAP and regex setting need to change from the current setup. ATB, Ramsay Jones -- 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 2/2] Fix typos in comments
On Sun, Jul 21, 2013 at 01:21:10AM +0530, Ramkumar Ramachandra wrote: Ondřej Bílka wrote: diff --git a/builtin/checkout.c b/builtin/checkout.c index 7fe0bff..9f29bb2 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1137,7 +1137,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) * 3) git checkout something [paths] * * including last branch syntax and DWIM-ery for names of -* remote branches, erroring out for invalid or ambiguous cases. +* remote branches, erring out for invalid or ambiguous cases. Didn't look through the entire patch, but this caught me eye: what's wrong with erroring out? Well aspell did not know it so I thought that erring is more appropriate. Now it looks more murky, see http://english.stackexchange.com/questions/3059/is-errored-correct-usage I am ok with removing this correction. -- 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 -- 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
American or British English?
On Sat, Jul 20, 2013 at 07:39:06PM +, brian m. carlson wrote: On Sat, Jul 20, 2013 at 09:13:12PM +0200, Ondřej Bílka wrote: A dictionary that I generated is following, patch is below. alloted allocated allotted is a valid word, and I think it would work fine in the code. It's probably what was intended, anyway. OK, I am not native speaker so I sometimes choose simpler variant. behaviour behavior colourful colorful initialised initialized I'm not sure whether git has a standard for which dialect of English is to be used, but the three words on the left are considered correct in most non-American dialects. Characterizing them as typos isn't strictly correct. Perhaps Convert comments to American English is more accurate? Yeah, on most projects I seen preference for consistently using American versions. How you decide is matter of preference. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 -- 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
Upload your papers until July 31. Indexed in ISI, ELSEVIER, SCOPUS, ACM, PubMed, Zentralblatt MATH, British Library, EBSCO, SWETS, EMBASE, CAS, DoPP, DBLP
Dear Colleagues, After finished our conferences in Rhodes Island, Greece, a great number of participants of thes conferences expressed the desire to participate again in our upcoming conferences ( http://www.europment.org ) in Venice (Venezia), Italy of September 28-30, 2013 So, you can upload now your paper for our upcoming Conferences in Venice, Italy (Sept.28-30, 2013) , until July 31 (2013). Contact i...@europment.org for more details. All the Accepted Papers, http://www.europment.org , will be published in our: (a) ISI/SCOPUS Book (Hard-Copy) (Indexed in ISI, ELSEVIER, SCOPUS, ACM, PubMed, Zentralblatt MATH, British Library, EBSCO, SWETS, EMBASE, CAS, DoPP, DBLP) (b) ISI/SCOPUS CD-ROM Proceedings (Indexed in ISI, ELSEVIER, SCOPUS, ACM, PubMed, Zentralblatt MATH, British Library, EBSCO, SWETS, EMBASE, CAS, DoPP, DBLP) (c) Extended Versions (after the conferences) in several Journals (ISI, SCOPUS, AMS, Elsevier, Zentrablat, ACM, DBLP etc... indexed) (d) E-Library with free access (more than 10 visits per month) If you do not select our Journals, then you can send your Extended Versions in Journals of NOVA Publishers or as Chapters in Books of Springer Verlag, World Scientific, Imperial College Press, IOS Press, IGI Global and others These Books (hard copies) of Springer Verlag, World Scientific, Imperial College Press, IOS Press, IGI Global, etc will be sent to all authors after the conference. These publishers will take care of Indexing of these Books in all major indexes (including ISI). The Proceedings of the Conference (all the accepted and registered papers; not only the selected ones to be sent to the previous publishers) with all the accepted and registered papers of the conferences will be sent for indexing to: ISI (Thomson Reuters), ELSEVIER, SCOPUS, ACM - Association for Computing Machinery, Zentralblatt MATH, British Library, EBSCO, SWETS, EMBASE, CAS - American Chemical Society, EI Compendex, Engineering Village, DBLP, DoPP, GEOBASE, Biobase, TIB|UB - German National Library of Science and Technology, American Mathematical Society (AMS), Inspec - The IET, Ulrich's International Periodicals Directory. The conference will feature tutorials, technical paper presentations, workshops and distinguished keynote speeches List of our conferences Venice, Italy, September 28-30, 2013, http://www.europment.org/ A) * The 2013 International Conference on Systems, Control, and Informatics * The 2013 International Conference on Electronics, Signal Processing and Communication Systems * The 2013 International Conference on Applied Mathematics and Computational Methods B) * The 2013 International Conference on Mechanics, Fluids, Heat, Elasticity and Electromagnetic Fields * The 2013 International Conference on Education and Modern Educational Technologies C) * The 2013 International Conference on Environment, Energy, Ecosystems and Development * The 2013 International Conference on Business Administration, Marketing and Economics * The 2013 International Conference on Biology, Medical Physics, Medical Chemistry, Biochemistry and Biomedical Engineering The Proceedings of the conferences with all the accepted and registered papers of the conferences will be sent for indexing to: ISI (Thomson Reuters), ELSEVIER, SCOPUS, Zentralblatt MATH, British Library, EBSCO, SWETS, EMBASE, CAS - American Chemical Society, EI Compendex, Engineering Village, DoPP, DBLP, GEOBASE, Biobase, TIB|UB - German National Library of Science and Technology, American Mathematical Society (AMS), Inspec - The IET, Ulrich's International Periodicals Directory. The conferences feature tutorials, technical paper presentations, workshops and distinguished keynote speeches. Organizing Committee General Chairs - Professor Charles A. Long Professor Emeritus University of Wisconsin Stevens Point, Wisconsin, USA Professor Valeri Mladenov Technical University of Sofia 1000 Sofia, Bulgaria Senior Program Chair Professor Philippe Dondon ENSEIRB Rue A Schweitzer 33400 Talence France Professor Zoran Bojkovic, Univ. of Belgrade, Belgrade Serbia Program Chairs - Professor Filippo Neri Dipartimento di Informatica e Sistemistica University of Naples Federico II Naples, Italy Professor Hamid Reza Karimi Department of Engineering Faculty of Engineering and Science University of Agder, N-4898 Grimstad Norway Professor Sandra Sendra Instituto de Inv. para la Gestisn Integrada de Zonas Costeras (IGIC) Universidad Polit?cnica de Valencia, Spain Tutorials Chair -- Professor Pradip Majumdar Department of Mechanical Engineering Northern Illinois University Dekalb, Illinois, USA Special Session Chair Professor Pavel Varacha Tomas Bata University in Zlin Faculty of Applied Informatics Department of Informatics and Artificial Intelligence Zlin, Czech Republic Workshops Chair -- Professor Ryszard S.
Re: [PATCH] Fix compilation on OS X.
Torsten Bögershausen tbo...@web.de writes: On 2013-07-20 09.49, Benoit Sigoure wrote: +#ifdef __APPLE__ +// On OS X libc headers don't define this symbol. +extern char **environ; +#endif + A more generic approach could be: In the file config.mak.uname: Define a variable in the Darwin section like this NO_EXT_ENVIRON = UnfortunatelyYes Actually, it is _wrong_ for us to rely on system header files to define this symbol for us. Declaring extern char **environ is responsibility of the user programs (like us). When _GNU_SOURCE is defined glibc header (I think it is unistd.h) seem to define it for us. Perhaps the correct fix is to revert ec535cc2 for everybody, and if MinGW needs such a workaround, do it inside #ifndef MINGW? -- 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