* [PATCH 1/2] fix typo in Documentation @ 2009-02-04 21:00 Guanqun Lu 2009-02-04 5:30 ` Sverre Rabbelier ` (3 more replies) 0 siblings, 4 replies; 8+ messages in thread From: Guanqun Lu @ 2009-02-04 21:00 UTC (permalink / raw) To: git; +Cc: Guanqun Lu Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com> --- Documentation/technical/api-strbuf.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index 9a4e3ea..ac56d1c 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -21,7 +21,7 @@ allocated memory or not), use `strbuf_detach()` to unwrap a memory buffer from its strbuf shell in a safe way. That is the sole supported way. This will give you a malloced buffer that you can later `free()`. + -However, it it totally safe to modify anything in the string pointed by +However, it is totally safe to modify anything in the string pointed by the `buf` member, between the indices `0` and `len-1` (inclusive). . The `buf` member is a byte array that has at least `len + 1` bytes -- 1.6.1.2.321.g4a9f7 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fix typo in Documentation 2009-02-04 21:00 [PATCH 1/2] fix typo in Documentation Guanqun Lu @ 2009-02-04 5:30 ` Sverre Rabbelier 2009-02-04 9:26 ` Jakub Narebski ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Sverre Rabbelier @ 2009-02-04 5:30 UTC (permalink / raw) To: Guanqun Lu; +Cc: git Heya, On Wed, Feb 4, 2009 at 22:00, Guanqun Lu <guanqun.lu@gmail.com> wrote: > -However, it it totally safe to modify anything in the string pointed by > +However, it is totally safe to modify anything in the string pointed by To prevent someone else from staring at this for a minute, "it it" was replaced by "it is". -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fix typo in Documentation 2009-02-04 21:00 [PATCH 1/2] fix typo in Documentation Guanqun Lu 2009-02-04 5:30 ` Sverre Rabbelier @ 2009-02-04 9:26 ` Jakub Narebski 2009-02-05 6:27 ` Guanqun Lu 2009-02-04 21:00 ` [PATCH 2/2] add test-dump-cache-tree in Makefile Guanqun Lu 2009-02-06 13:43 ` [PATCH 1/2] fix typo in Documentation Mikael Magnusson 3 siblings, 1 reply; 8+ messages in thread From: Jakub Narebski @ 2009-02-04 9:26 UTC (permalink / raw) To: Guanqun Lu; +Cc: git Guanqun Lu <guanqun.lu@gmail.com> writes: > Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com> > --- > Documentation/technical/api-strbuf.txt | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Minor nit: I would add _where_ did you fix typy, i.e. instead of just fix typo in Documentation I'd use fix typo in strbuf API documentation -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fix typo in Documentation 2009-02-04 9:26 ` Jakub Narebski @ 2009-02-05 6:27 ` Guanqun Lu 0 siblings, 0 replies; 8+ messages in thread From: Guanqun Lu @ 2009-02-05 6:27 UTC (permalink / raw) To: Jakub Narebski; +Cc: git On Wed, Feb 4, 2009 at 5:26 PM, Jakub Narebski <jnareb@gmail.com> wrote: > Guanqun Lu <guanqun.lu@gmail.com> writes: > >> Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com> >> --- >> Documentation/technical/api-strbuf.txt | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) > > Minor nit: I would add _where_ did you fix typy, i.e. instead of just > fix typo in Documentation > I'd use > fix typo in strbuf API documentation OK. I'll keep an eye next time. And thanks for your advice. > > -- > Jakub Narebski > Poland > ShadeHawk on #git > -- Guanqun ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] add test-dump-cache-tree in Makefile 2009-02-04 21:00 [PATCH 1/2] fix typo in Documentation Guanqun Lu 2009-02-04 5:30 ` Sverre Rabbelier 2009-02-04 9:26 ` Jakub Narebski @ 2009-02-04 21:00 ` Guanqun Lu 2009-02-04 7:46 ` Junio C Hamano 2009-02-04 9:31 ` Jakub Narebski 2009-02-06 13:43 ` [PATCH 1/2] fix typo in Documentation Mikael Magnusson 3 siblings, 2 replies; 8+ messages in thread From: Guanqun Lu @ 2009-02-04 21:00 UTC (permalink / raw) To: git; +Cc: Guanqun Lu 5c5ba73b21a6910ee67d97cb87a5d78409112375 tries to use generic rule to build test programs, but it misses the file 'dump-cache-tree.c', since its name is not prefixed by 'test-'. This commit solves this little problem by renaming this file instead of carrying out an explicit rule in Makefile. Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com> --- Makefile | 1 + dump-cache-tree.c | 64 ------------------------------------------------ test-dump-cache-tree.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 64 deletions(-) delete mode 100644 dump-cache-tree.c create mode 100644 test-dump-cache-tree.c diff --git a/Makefile b/Makefile index 9f3a8ab..b90ff39 100644 --- a/Makefile +++ b/Makefile @@ -1388,6 +1388,7 @@ TEST_PROGRAMS += test-parse-options$X TEST_PROGRAMS += test-path-utils$X TEST_PROGRAMS += test-sha1$X TEST_PROGRAMS += test-sigchain$X +TEST_PROGRAMS += test-dump-cache-tree$X all:: $(TEST_PROGRAMS) diff --git a/dump-cache-tree.c b/dump-cache-tree.c deleted file mode 100644 index 1f73f1e..0000000 --- a/dump-cache-tree.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "cache.h" -#include "tree.h" -#include "cache-tree.h" - - -static void dump_one(struct cache_tree *it, const char *pfx, const char *x) -{ - if (it->entry_count < 0) - printf("%-40s %s%s (%d subtrees)\n", - "invalid", x, pfx, it->subtree_nr); - else - printf("%s %s%s (%d entries, %d subtrees)\n", - sha1_to_hex(it->sha1), x, pfx, - it->entry_count, it->subtree_nr); -} - -static int dump_cache_tree(struct cache_tree *it, - struct cache_tree *ref, - const char *pfx) -{ - int i; - int errs = 0; - - if (!it || !ref) - /* missing in either */ - return 0; - - if (it->entry_count < 0) { - dump_one(it, pfx, ""); - dump_one(ref, pfx, "#(ref) "); - if (it->subtree_nr != ref->subtree_nr) - errs = 1; - } - else { - dump_one(it, pfx, ""); - if (hashcmp(it->sha1, ref->sha1) || - ref->entry_count != it->entry_count || - ref->subtree_nr != it->subtree_nr) { - dump_one(ref, pfx, "#(ref) "); - errs = 1; - } - } - - for (i = 0; i < it->subtree_nr; i++) { - char path[PATH_MAX]; - struct cache_tree_sub *down = it->down[i]; - struct cache_tree_sub *rdwn; - - rdwn = cache_tree_sub(ref, down->name); - sprintf(path, "%s%.*s/", pfx, down->namelen, down->name); - if (dump_cache_tree(down->cache_tree, rdwn->cache_tree, path)) - errs = 1; - } - return errs; -} - -int main(int ac, char **av) -{ - struct cache_tree *another = cache_tree(); - if (read_cache() < 0) - die("unable to read index file"); - cache_tree_update(another, active_cache, active_nr, 0, 1); - return dump_cache_tree(active_cache_tree, another, ""); -} diff --git a/test-dump-cache-tree.c b/test-dump-cache-tree.c new file mode 100644 index 0000000..1f73f1e --- /dev/null +++ b/test-dump-cache-tree.c @@ -0,0 +1,64 @@ +#include "cache.h" +#include "tree.h" +#include "cache-tree.h" + + +static void dump_one(struct cache_tree *it, const char *pfx, const char *x) +{ + if (it->entry_count < 0) + printf("%-40s %s%s (%d subtrees)\n", + "invalid", x, pfx, it->subtree_nr); + else + printf("%s %s%s (%d entries, %d subtrees)\n", + sha1_to_hex(it->sha1), x, pfx, + it->entry_count, it->subtree_nr); +} + +static int dump_cache_tree(struct cache_tree *it, + struct cache_tree *ref, + const char *pfx) +{ + int i; + int errs = 0; + + if (!it || !ref) + /* missing in either */ + return 0; + + if (it->entry_count < 0) { + dump_one(it, pfx, ""); + dump_one(ref, pfx, "#(ref) "); + if (it->subtree_nr != ref->subtree_nr) + errs = 1; + } + else { + dump_one(it, pfx, ""); + if (hashcmp(it->sha1, ref->sha1) || + ref->entry_count != it->entry_count || + ref->subtree_nr != it->subtree_nr) { + dump_one(ref, pfx, "#(ref) "); + errs = 1; + } + } + + for (i = 0; i < it->subtree_nr; i++) { + char path[PATH_MAX]; + struct cache_tree_sub *down = it->down[i]; + struct cache_tree_sub *rdwn; + + rdwn = cache_tree_sub(ref, down->name); + sprintf(path, "%s%.*s/", pfx, down->namelen, down->name); + if (dump_cache_tree(down->cache_tree, rdwn->cache_tree, path)) + errs = 1; + } + return errs; +} + +int main(int ac, char **av) +{ + struct cache_tree *another = cache_tree(); + if (read_cache() < 0) + die("unable to read index file"); + cache_tree_update(another, active_cache, active_nr, 0, 1); + return dump_cache_tree(active_cache_tree, another, ""); +} -- 1.6.1.2.321.g4a9f7 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add test-dump-cache-tree in Makefile 2009-02-04 21:00 ` [PATCH 2/2] add test-dump-cache-tree in Makefile Guanqun Lu @ 2009-02-04 7:46 ` Junio C Hamano 2009-02-04 9:31 ` Jakub Narebski 1 sibling, 0 replies; 8+ messages in thread From: Junio C Hamano @ 2009-02-04 7:46 UTC (permalink / raw) To: Guanqun Lu; +Cc: git Thanks; both patches look good. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] add test-dump-cache-tree in Makefile 2009-02-04 21:00 ` [PATCH 2/2] add test-dump-cache-tree in Makefile Guanqun Lu 2009-02-04 7:46 ` Junio C Hamano @ 2009-02-04 9:31 ` Jakub Narebski 1 sibling, 0 replies; 8+ messages in thread From: Jakub Narebski @ 2009-02-04 9:31 UTC (permalink / raw) To: Guanqun Lu; +Cc: git Guanqun Lu <guanqun.lu@gmail.com> writes: > dump-cache-tree.c | 64 ------------------------------------------------ > test-dump-cache-tree.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 64 deletions(-) > delete mode 100644 dump-cache-tree.c > create mode 100644 test-dump-cache-tree.c > diff --git a/dump-cache-tree.c b/dump-cache-tree.c > deleted file mode 100644 > index 1f73f1e..0000000 > diff --git a/test-dump-cache-tree.c b/test-dump-cache-tree.c > new file mode 100644 > index 0000000..1f73f1e Minor nit: it would be better to use git-format-patch with '-M' option (detect renames) here. It would result in shorter and more readable patch: dump-cache-tree.c => test-dump-cache-tree.c | 0 3 files changed, 1 insertions(+), 0 deletions(-) rename dump-cache-tree.c => test-dump-cache-tree.c (100%) diff --git a/dump-cache-tree.c b/test-dump-cache-tree.c similarity index 100% rename from dump-cache-tree.c rename to test-dump-cache-tree.c Or something like that... -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fix typo in Documentation 2009-02-04 21:00 [PATCH 1/2] fix typo in Documentation Guanqun Lu ` (2 preceding siblings ...) 2009-02-04 21:00 ` [PATCH 2/2] add test-dump-cache-tree in Makefile Guanqun Lu @ 2009-02-06 13:43 ` Mikael Magnusson 3 siblings, 0 replies; 8+ messages in thread From: Mikael Magnusson @ 2009-02-06 13:43 UTC (permalink / raw) To: Guanqun Lu; +Cc: git 2009/2/4 Guanqun Lu <guanqun.lu@gmail.com>: > Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com> > --- > Documentation/technical/api-strbuf.txt | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt > index 9a4e3ea..ac56d1c 100644 > --- a/Documentation/technical/api-strbuf.txt > +++ b/Documentation/technical/api-strbuf.txt > @@ -21,7 +21,7 @@ allocated memory or not), use `strbuf_detach()` to unwrap a memory > buffer from its strbuf shell in a safe way. That is the sole supported > way. This will give you a malloced buffer that you can later `free()`. > + > -However, it it totally safe to modify anything in the string pointed by > +However, it is totally safe to modify anything in the string pointed by > the `buf` member, between the indices `0` and `len-1` (inclusive). > > . The `buf` member is a byte array that has at least `len + 1` bytes Shouldn't that be "the string pointed >>at<< by" too? -- Mikael Magnusson ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-02-06 13:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-02-04 21:00 [PATCH 1/2] fix typo in Documentation Guanqun Lu 2009-02-04 5:30 ` Sverre Rabbelier 2009-02-04 9:26 ` Jakub Narebski 2009-02-05 6:27 ` Guanqun Lu 2009-02-04 21:00 ` [PATCH 2/2] add test-dump-cache-tree in Makefile Guanqun Lu 2009-02-04 7:46 ` Junio C Hamano 2009-02-04 9:31 ` Jakub Narebski 2009-02-06 13:43 ` [PATCH 1/2] fix typo in Documentation Mikael Magnusson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).