Re: [PATCH] wording fixes in the user manual and glossary
On 25/05/14 20:37, Jeremiah Mahler wrote: > On Sun, May 25, 2014 at 07:56:41PM +1200, Chris Packham wrote: >> On 25/05/14 15:50, Jeremiah Mahler wrote: >>> Some minor wording fixes in the user manual and glossary. > ... >>> >>> -Eventually the developer cloned from will do additional work in her >>> +Eventually the developer will do additional work in her cloned >>> repository, creating new commits and advancing the branches to point >>> at the new commits. >> >> I agree that the original wording isn't clear but I'm not sure the new >> wording is any clearer. The paragraph is trying to explain how to fetch >> upstream changes when they happen. My initial thought was to say >> "Eventually the developer will do additional work in the upstream >> repository" but perhaps it is to early to start throwing around terms >> like upstream. Perhaps just saying "her repository" would be clearest. >> > > The "developer cloned from will do" didn't sound right to me. > But it sounds like my interpretation is not what you were trying to > convey. I do like the "upstream" term, it helps describe the > local/remote aspect. > > How about this: > > Eventually the upstream developer will do additional work in their > repository. Creating new commits and advancing the branches to point > at the new commits. Sounds good to me. > > Then in the next paragraph it will discuss how to use `git fetch` > to get these remote changes in to the local repository. > -- 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] wording fixes in the user manual and glossary
On 25/05/14 20:37, Jeremiah Mahler wrote: How about this: Eventually the upstream developer will do additional work in their repository. Creating new commits and advancing the branches to point at the new commits. The second sentence needs a verb. Maybe something along the lines of "When they ${do_X}, ${Y} will happen" ? Regards, Ben -- 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] wording fixes in the user manual and glossary
Various minor wording fixes throughout the user manual and glossary. The section on "Updating a repository with git fetch" was substantially re-worded to try and better explain `git fetch`. Signed-off-by: Jeremiah Mahler --- Notes: From the feedback I received by Chris Packham [1] it was clear that my re-wording of the section "Updating a repository with git fetch" still wasn't quite right [1]. [1]: http://marc.info/?l=git&m=140100460903936&w=2 I re-worded it some more to try and emphasize the remote (upstream) and local aspects of `git fetch`. Chris liked those changes better [2]. [2]: http://marc.info/?l=git&m=140109062903038&w=2 I expanded upon this even further. The section on git-pull is similar so I tried to use that as a basis. I also thought the relationship between git fetch and git pull was worthy of a short note along with a link to the section on git-pull. Documentation/glossary-content.txt | 2 +- Documentation/user-manual.txt | 28 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt index be0858c..4e0b971 100644 --- a/Documentation/glossary-content.txt +++ b/Documentation/glossary-content.txt @@ -1,7 +1,7 @@ [[def_alternate_object_database]]alternate object database:: Via the alternates mechanism, a <> can inherit part of its <> - from another object database, which is called "alternate". + from another object database, which is called an "alternate". [[def_bare_repository]]bare repository:: A bare repository is normally an appropriately diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index d33f884..f5fd61b 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -416,14 +416,22 @@ REVISIONS" section of linkgit:gitrevisions[7]. Updating a repository with git fetch -Eventually the developer cloned from will do additional work in her -repository, creating new commits and advancing the branches to point -at the new commits. +After you clone a repository and commit a few changes of your own, you +may wish to check the original repository for updates. +The linkgit:git-fetch[1] command is used to update all the remote-tracking +branches to the latest version found in those repositories. +It will not touch any of your own branches--not even the "master" +branch that was created during clone. +The linkgit:git-merge[1] command can then be used to merge the changes. + +- +$ git fetch +$ git merge origin/master +- -The command `git fetch`, with no arguments, will update all of the -remote-tracking branches to the latest version found in her -repository. It will not touch any of your own branches--not even the -"master" branch that was created for you on clone. +The linkgit:git-pull[1] command, +<>, +performs both of these steps, a fetch followed by a merge. [[fetching-branches]] Fetching branches from other repositories @@ -1811,8 +1819,8 @@ manner. You can then import these into your mail client and send them by hand. However, if you have a lot to send at once, you may prefer to use the linkgit:git-send-email[1] script to automate the process. -Consult the mailing list for your project first to determine how they -prefer such patches be handled. +Consult the mailing list for your project first to determine +their requirements for submitting patches. [[importing-patches]] Importing patches to a project @@ -2255,7 +2263,7 @@ $ git checkout test && git merge speed-up-spinlocks It is unlikely that you would have any conflicts here ... but you might if you spent a while on this step and had also pulled new versions from upstream. -Some time later when enough time has passed and testing done, you can pull the +Sometime later when enough time has passed and testing done, you can pull the same branch into the `release` tree ready to go upstream. This is where you see the value of keeping each patch (or patch series) in its own branch. It means that the patches can be moved into the `release` tree in any order. -- 2.0.0.rc4.480.gad29d77 -- 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 00/15] Rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. The vast majority of the Git codebase passes these arguments in the correct order, but there are some exceptions. This patch series corrects those exceptions. Brian Gesiak (15): builtin/add.c: rearrange xcalloc arguments builtin/ls-remote.c: rearrange xcalloc arguments builtin/remote.c: rearrange xcalloc arguments commit.c: rearrange xcalloc arguments config.c: rearrange xcalloc arguments diff.c: rearrange xcalloc arguments hash.c: rearrange xcalloc arguments hash.h: rearrange xcalloc arguments http-push.c: rearrange xcalloc arguments imap-send.c: rearrange xcalloc arguments notes.c: rearrange xcalloc arguments pack-revindex.c: rearrange xcalloc arguments reflog-walk.c: rearrange xcalloc arguments remote.c: rearrange xcalloc arguments transport-helper.c: rearrange xcalloc arguments builtin/add.c | 2 +- builtin/ls-remote.c | 2 +- builtin/remote.c| 8 commit.c| 2 +- config.c| 4 ++-- diff.c | 2 +- hash.c | 2 +- hash.h | 2 +- http-push.c | 2 +- imap-send.c | 2 +- notes.c | 6 +++--- pack-revindex.c | 2 +- reflog-walk.c | 8 remote.c| 2 +- transport-helper.c | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) -- 2.0.0.rc1.543.gc8042da -- 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 06/15] diff.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. diffstat_add passes the arguments in reverse order, passing the size of a diffstat_file*, followed by the number of diffstat_file* to be allocated. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 635dee2..a71dfde 100644 --- a/diff.c +++ b/diff.c @@ -1360,7 +1360,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat, const char *name_b) { struct diffstat_file *x; - x = xcalloc(sizeof (*x), 1); + x = xcalloc(1, sizeof(*x)); if (diffstat->nr == diffstat->alloc) { diffstat->alloc = alloc_nr(diffstat->alloc); diffstat->files = xrealloc(diffstat->files, -- 2.0.0.rc1.543.gc8042da -- 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 01/15] builtin/add.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. run_add_interactive passes the arguments in reverse order, passing the size of a char*, followed by the number of char* to be allocated. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- builtin/add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/add.c b/builtin/add.c index 672adc0..488acf4 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode, int status, ac, i; const char **args; - args = xcalloc(sizeof(const char *), (pathspec->nr + 6)); + args = xcalloc((pathspec->nr + 6), sizeof(const char *)); ac = 0; args[ac++] = "add--interactive"; if (patch_mode) -- 2.0.0.rc1.543.gc8042da -- 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 08/15] hash.h: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. prellocate_hash passes the arguments in reverse order, passing the size of a hash table entry, followed by the number of entries. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash.h b/hash.h index 1d43ac0..3b5d9e7 100644 --- a/hash.h +++ b/hash.h @@ -44,7 +44,7 @@ static inline void preallocate_hash(struct hash_table *table, unsigned int elts) { assert(table->size == 0 && table->nr == 0 && table->array == NULL); table->size = elts * 2; - table->array = xcalloc(sizeof(struct hash_table_entry), table->size); + table->array = xcalloc(table->size, sizeof(struct hash_table_entry)); } #endif -- 2.0.0.rc1.543.gc8042da -- 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 12/15] pack-revindex.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. init_pack_revindex passes the arguments in reverse order, passing the size of a pack_revindex, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- pack-revindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack-revindex.c b/pack-revindex.c index b4d2b35..f84979b 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -50,7 +50,7 @@ static void init_pack_revindex(void) if (!num) return; pack_revindex_hashsz = num * 11; - pack_revindex = xcalloc(sizeof(*pack_revindex), pack_revindex_hashsz); + pack_revindex = xcalloc(pack_revindex_hashsz, sizeof(*pack_revindex)); for (p = packed_git; p; p = p->next) { num = pack_revindex_ix(p); num = - 1 - num; -- 2.0.0.rc1.543.gc8042da -- 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 03/15] builtin/remote.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. builtin/remote.c includes several calls to xcalloc that pass the arguments in reverse order. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- builtin/remote.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index b3ab4cf..9f62021 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -282,7 +282,7 @@ static int config_read_branches(const char *key, const char *value, void *cb) item = string_list_insert(&branch_list, name); if (!item->util) - item->util = xcalloc(sizeof(struct branch_info), 1); + item->util = xcalloc(1, sizeof(struct branch_info)); info = item->util; if (type == REMOTE) { if (info->remote_name) @@ -398,7 +398,7 @@ static int get_push_ref_states(const struct ref *remote_refs, item = string_list_append(&states->push, abbrev_branch(ref->peer_ref->name)); - item->util = xcalloc(sizeof(struct push_info), 1); + item->util = xcalloc(1, sizeof(struct push_info)); info = item->util; info->forced = ref->force; info->dest = xstrdup(abbrev_branch(ref->name)); @@ -433,7 +433,7 @@ static int get_push_ref_states_noquery(struct ref_states *states) states->push.strdup_strings = 1; if (!remote->push_refspec_nr) { item = string_list_append(&states->push, _("(matching)")); - info = item->util = xcalloc(sizeof(struct push_info), 1); + info = item->util = xcalloc(1, sizeof(struct push_info)); info->status = PUSH_STATUS_NOTQUERIED; info->dest = xstrdup(item->string); } @@ -446,7 +446,7 @@ static int get_push_ref_states_noquery(struct ref_states *states) else item = string_list_append(&states->push, _("(delete)")); - info = item->util = xcalloc(sizeof(struct push_info), 1); + info = item->util = xcalloc(1, sizeof(struct push_info)); info->forced = spec->force; info->status = PUSH_STATUS_NOTQUERIED; info->dest = xstrdup(spec->dst ? spec->dst : item->string); -- 2.0.0.rc1.543.gc8042da -- 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 02/15] builtin/ls-remote.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. cmd_ls_remote passes the arguments in reverse order, passing the size of a char*, followed by the number of char* to be allocated. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- builtin/ls-remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 39e5144..aec1c0c 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) if (argv[i]) { int j; - pattern = xcalloc(sizeof(const char *), argc - i + 1); + pattern = xcalloc(argc - i + 1, sizeof(const char *)); for (j = i; j < argc; j++) { int len = strlen(argv[j]); char *p = xmalloc(len + 3); -- 2.0.0.rc1.543.gc8042da -- 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 13/15] reflog-walk.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. reflog-walk.c includes several calls to xcalloc that pass the arguments in reverse order. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- reflog-walk.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reflog-walk.c b/reflog-walk.c index b2fbdb2..f8d8f13 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -45,7 +45,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1, static struct complete_reflogs *read_complete_reflog(const char *ref) { struct complete_reflogs *reflogs = - xcalloc(sizeof(struct complete_reflogs), 1); + xcalloc(1, sizeof(struct complete_reflogs)); reflogs->ref = xstrdup(ref); for_each_reflog_ent(ref, read_one_reflog, reflogs); if (reflogs->nr == 0) { @@ -143,7 +143,7 @@ struct reflog_walk_info { void init_reflog_walk(struct reflog_walk_info** info) { - *info = xcalloc(sizeof(struct reflog_walk_info), 1); + *info = xcalloc(1, sizeof(struct reflog_walk_info)); } int add_reflog_for_walk(struct reflog_walk_info *info, @@ -207,7 +207,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info, = reflogs; } - commit_reflog = xcalloc(sizeof(struct commit_reflog), 1); + commit_reflog = xcalloc(1, sizeof(struct commit_reflog)); if (recno < 0) { commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp); if (commit_reflog->recno < 0) { @@ -250,7 +250,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit) return; } - commit->parents = xcalloc(sizeof(struct commit_list), 1); + commit->parents = xcalloc(1, sizeof(struct commit_list)); commit->parents->item = commit_info->commit; } -- 2.0.0.rc1.543.gc8042da -- 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 04/15] commit.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. reduce_heads passes the arguments in reverse order, passing the size of a commit*, followed by the number of commit* to be allocated. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit.c b/commit.c index 6bf4fe0..0fe685f 100644 --- a/commit.c +++ b/commit.c @@ -1041,7 +1041,7 @@ struct commit_list *reduce_heads(struct commit_list *heads) p->item->object.flags |= STALE; num_head++; } - array = xcalloc(sizeof(*array), num_head); + array = xcalloc(num_head, sizeof(*array)); for (p = heads, i = 0; p; p = p->next) { if (p->item->object.flags & STALE) { array[i++] = p->item; -- 2.0.0.rc1.543.gc8042da -- 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 07/15] hash.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. grow_hash_table passes the arguments in reverse order, passing the size of a hash table entry, followed by the number of entries. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash.c b/hash.c index 749ecfe..2067be9 100644 --- a/hash.c +++ b/hash.c @@ -53,7 +53,7 @@ static void grow_hash_table(struct hash_table *table) struct hash_table_entry *old_array = table->array, *new_array; new_size = alloc_nr(old_size); - new_array = xcalloc(sizeof(struct hash_table_entry), new_size); + new_array = xcalloc(new_size, sizeof(struct hash_table_entry)); table->size = new_size; table->array = new_array; table->nr = 0; -- 2.0.0.rc1.543.gc8042da -- 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 14/15] remote.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. parse_refspec_internal passes the arguments in reverse order, passing the size of a refspec, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote.c b/remote.c index ebed40d..df3267b 100644 --- a/remote.c +++ b/remote.c @@ -523,7 +523,7 @@ static void free_refspecs(struct refspec *refspec, int nr_refspec) static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify) { int i; - struct refspec *rs = xcalloc(sizeof(*rs), nr_refspec); + struct refspec *rs = xcalloc(nr_refspec, sizeof(*rs)); for (i = 0; i < nr_refspec; i++) { size_t llen; -- 2.0.0.rc1.543.gc8042da -- 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 11/15] notes.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. notes.c includes several calls to xcalloc that pass the arguments in reverse order. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- notes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notes.c b/notes.c index 5f07c0b..5fe691d 100644 --- a/notes.c +++ b/notes.c @@ -303,7 +303,7 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree, free(entry); return 0; } - new_node = (struct int_node *) xcalloc(sizeof(struct int_node), 1); + new_node = (struct int_node *) xcalloc(1, sizeof(struct int_node)); ret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p), combine_notes); if (ret) @@ -443,7 +443,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree, if (len <= 20) { type = PTR_TYPE_NOTE; l = (struct leaf_node *) - xcalloc(sizeof(struct leaf_node), 1); + xcalloc(1, sizeof(struct leaf_node)); hashcpy(l->key_sha1, object_sha1); hashcpy(l->val_sha1, entry.sha1); if (len < 20) { @@ -1003,7 +1003,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref, if (!combine_notes) combine_notes = combine_notes_concatenate; - t->root = (struct int_node *) xcalloc(sizeof(struct int_node), 1); + t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node)); t->first_non_note = NULL; t->prev_non_note = NULL; t->ref = notes_ref ? xstrdup(notes_ref) : NULL; -- 2.0.0.rc1.543.gc8042da -- 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 09/15] http-push.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. http-push passes the arguments in reverse order, passing the size of a repo, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- http-push.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-push.c b/http-push.c index d4b40c9..1c722e5 100644 --- a/http-push.c +++ b/http-push.c @@ -1733,7 +1733,7 @@ int main(int argc, char **argv) git_extract_argv0_path(argv[0]); - repo = xcalloc(sizeof(*repo), 1); + repo = xcalloc(1, sizeof(*repo)); argv++; for (i = 1; i < argc; i++, argv++) { -- 2.0.0.rc1.543.gc8042da -- 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 05/15] config.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. config.c includes several calls to xcalloc that pass the arguments in reverse order: the size of a struct lock_file*, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 314d8ee..c3612cc 100644 --- a/config.c +++ b/config.c @@ -1536,7 +1536,7 @@ int git_config_set_multivar_in_file(const char *config_filename, * The lock serves a purpose in addition to locking: the new * contents of .git/config will be written into it. */ - lock = xcalloc(sizeof(struct lock_file), 1); + lock = xcalloc(1, sizeof(struct lock_file)); fd = hold_lock_file_for_update(lock, config_filename, 0); if (fd < 0) { error("could not lock config file %s: %s", config_filename, strerror(errno)); @@ -1791,7 +1791,7 @@ int git_config_rename_section_in_file(const char *config_filename, if (!config_filename) config_filename = filename_buf = git_pathdup("config"); - lock = xcalloc(sizeof(struct lock_file), 1); + lock = xcalloc(1, sizeof(struct lock_file)); out_fd = hold_lock_file_for_update(lock, config_filename, 0); if (out_fd < 0) { ret = error("could not lock config file %s", config_filename); -- 2.0.0.rc1.543.gc8042da -- 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 10/15] imap-send.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. imap_open_store passes the arguments in reverse order, passing the size of an imap_store*, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- imap-send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imap-send.c b/imap-send.c index 0bc6f7f..45230e1 100644 --- a/imap-send.c +++ b/imap-send.c @@ -951,7 +951,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc) char *arg, *rsp; int s = -1, preauth; - ctx = xcalloc(sizeof(*ctx), 1); + ctx = xcalloc(1, sizeof(*ctx)); ctx->imap = imap = xcalloc(sizeof(*imap), 1); imap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1; -- 2.0.0.rc1.543.gc8042da -- 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 15/15] transport-helper.c: rearrange xcalloc arguments
xcalloc takes two arguments: the number of elements and their size. transport_helper_init passes the arguments in reverse order, passing the size of a helper_data*, followed by the number to allocate. Rearrgange them so they are in the correct order. Signed-off-by: Brian Gesiak --- transport-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport-helper.c b/transport-helper.c index ad72fbd..cf48913 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -1002,7 +1002,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push) int transport_helper_init(struct transport *transport, const char *name) { - struct helper_data *data = xcalloc(sizeof(*data), 1); + struct helper_data *data = xcalloc(1, sizeof(*data)); data->name = name; if (getenv("GIT_TRANSPORT_HELPER_DEBUG")) -- 2.0.0.rc1.543.gc8042da -- 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
[RFC/PATCH 0/2] Git config cache & special querying api utilizing the cache
Hi, This is my first patch series for this year's GSoC. My project is "Git Config API improvements". The link of my proposal is appended below [1]. The aim of this patch series is to generate a cache for querying values from the config files in a non callback manner as the current method reads and parses the config files every time a value is queried for. The cache is generated from hooking the update_cache function to the current parsing and callback mechanism in config.c. It is implemented as an hashmap using the hashmap-api with variables and its corresponding values list as its members. The values in the list are sorted in order of increasing priority. The cache is initialised in git_config_early() as it is the first time a `git_config` function is called during program startup. setup_git_directory_gently() calls git_config_early() which in turn reads every config file (local, user and global config files). get_value() in config.c feeds variable and values into the callback function. Using this function as a hook, we update the cache. Also, we add two new functions to the config-api git_config_get_string() and git_config_get_string_multi() for querying in a non callback manner from the cache. I have run the tests and debug the code and it works, but I have to add a few things, 1. Invalidity check: if a config file is written into, update the cache. I am using git_config_set_multivar_in_file() as an update hook. 2. Metadata about the variables and values. I have added only the file from each variable value pair comes in an upcoming series. What else should I add or implement ;is my approach right? [1] https://drive.google.com/file/d/0B4suZ-aHqDcnSUZJRXVTTnZUN1E/edit?usp=sharing Cheers, Tanay Abhra. Tanay Abhra (2): config: Add cache for config value querying config: Add new query functions to the api Documentation/technical/api-config.txt | 19 ++ cache.h| 2 + config.c | 105 + 3 files changed, 126 insertions(+) -- 1.9.0.GIT -- 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
[RFC/PATCH 1/2] config: Add cache for config value querying
Add an internal cache with the all variable value pairs read from the usual config files(repo specific .git/config, user wide ~/.gitconfig and the global /etc/gitconfig). Also, add two external functions `git_config_get_string` and `git_config_get_string_multi` for querying in an non callback manner from the cache. Signed-off-by: Tanay Abhra --- cache.h | 2 ++ config.c | 105 +++ 2 files changed, 107 insertions(+) diff --git a/cache.h b/cache.h index 107ac61..2038150 100644 --- a/cache.h +++ b/cache.h @@ -1271,6 +1271,8 @@ extern int check_repository_format_version(const char *var, const char *value, v extern int git_env_bool(const char *, int); extern int git_config_system(void); extern int config_error_nonbool(const char *); +extern const char *git_config_get_string(const char *); +extern const struct string_list *git_config_get_string_multi(const char *); #if defined(__GNUC__) && ! defined(__clang__) #define config_error_nonbool(s) (config_error_nonbool(s), -1) #endif diff --git a/config.c b/config.c index a30cb5c..f6515c2 100644 --- a/config.c +++ b/config.c @@ -9,6 +9,8 @@ #include "exec_cmd.h" #include "strbuf.h" #include "quote.h" +#include "hashmap.h" +#include "string-list.h" struct config_source { struct config_source *prev; @@ -37,6 +39,102 @@ static struct config_source *cf; static int zlib_compression_seen; +struct hashmap config_cache; + +struct config_cache_node { + struct hashmap_entry ent; + struct strbuf key; + struct string_list *value_list ; +}; + +static int hashmap_init_v = 0; + +static int config_cache_node_cmp(const struct config_cache_node *e1, + const struct config_cache_node *e2, const char *key) +{ + return strcmp(e1->key.buf, key ? key : e2->key.buf); +} + +static int config_cache_node_cmp_icase(const struct config_cache_node *e1, +const struct config_cache_node *e2, const char* key) +{ + return strcasecmp(e1->key.buf, key ? key : e2->key.buf); +} + +static void config_cache_init(const int icase) +{ + hashmap_init(&config_cache, (hashmap_cmp_fn) (icase ? config_cache_node_cmp_icase + : config_cache_node_cmp), 0); +} + +static void config_cache_free(void) +{ + hashmap_free(&config_cache, 1); +} + +static struct config_cache_node *config_cache_find_entry(const char *key) +{ + struct hashmap_entry k; + hashmap_entry_init(&k, strihash(key)); + return hashmap_get(&config_cache, &k, key); +} + +static struct string_list *config_cache_get_value(const char *key) +{ + struct config_cache_node *e = config_cache_find_entry(key); + if (e == NULL) + return NULL; + else + return (e->value_list); +} + + +static void config_cache_set_value(const char *key, const char *value) +{ + struct config_cache_node *e; + + if (!value) + return; + + e = config_cache_find_entry(key); + if (!e) { + e = malloc(sizeof(*e)); + hashmap_entry_init(e, strihash(key)); + strbuf_init(&(e->key), 1024); + strbuf_addstr(&(e->key),key); + e->value_list = malloc(sizeof(struct string_list)); + e->value_list->strdup_strings = 1; + e->value_list->nr = 0; + e->value_list->alloc = 0; + e->value_list->items = NULL; + e->value_list->cmp = NULL; + string_list_append(e->value_list, value); + hashmap_add(&config_cache, e); + } + else { + if (!unsorted_string_list_has_string((e->value_list), value)) + string_list_append((e->value_list), value); + } +} + +extern const char *git_config_get_string(const char *name) +{ + struct string_list *values; + int num_values; + char *result; + values = config_cache_get_value(name); + if (!values) + return NULL; + num_values = values->nr; + result = values->items[num_values-1].string ; + return result; +} + +extern const struct string_list *git_config_get_string_multi(const char *key) +{ + return config_cache_get_value(key); +} + static int config_file_fgetc(struct config_source *conf) { return fgetc(conf->u.file); @@ -333,6 +431,7 @@ static int get_value(config_fn_t fn, void *data, struct strbuf *name) if (!value) return -1; } + config_cache_set_value(name->buf, value); return fn(name->buf, value, data); } @@ -1135,6 +1234,12 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) char *xdg_config = NULL; char *user_config = NULL; + int icase = 1; + if (!hashmap_init_v) { + config_cache_init(icase); + hashmap_init_v = 1; + } + home
[RFC/PATCH 2/2] config: Add new query functions to the api
Add explanations for `git_config_get_string_multi` and `git_config_get_string` which utilize the config cache for querying in an non callback manner for a specific variable. Signed-off-by: Tanay Abhra --- Documentation/technical/api-config.txt | 19 +++ 1 file changed, 19 insertions(+) diff --git a/Documentation/technical/api-config.txt b/Documentation/technical/api-config.txt index 230b3a0..33b5b90 100644 --- a/Documentation/technical/api-config.txt +++ b/Documentation/technical/api-config.txt @@ -77,6 +77,25 @@ To read a specific file in git-config format, use `git_config_from_file`. This takes the same callback and data parameters as `git_config`. +Querying for specific variables +--- + +For programs wanting to query for specific variables in a non callback +manner, the config API provides two functions `git_config_get_string` +and `git_config_get_string_multi`. They both take a single parameter, + +- a variable as the key string for which the corresponding values will + be retrieved and returned. + +They both read value from an internal cache generated previously from +reading the config files. `git_config_get_string` returns the value with +the highest priority(i.e. value in the repo config will be preferred over +value in user wide config for the same variable). + +`git_config_get_string_multi` returns a `string_list` containing all the +values for that particular variable, sorted in order of increasing +priority. + Value Parsing Helpers - -- 1.9.0.GIT -- 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 v3 1/5] commit test: Use test_config instead of git-config
Some of the tests in t/t7507-commit-verbose.sh were still using git-config to set configuration. Change them to use the test_config helper. Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index 2ddf28c..6d778ed 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -43,7 +43,7 @@ test_expect_success 'verbose diff is stripped out' ' ' test_expect_success 'verbose diff is stripped out (mnemonicprefix)' ' - git config diff.mnemonicprefix true && + test_config diff.mnemonicprefix true && git commit --amend -v && check_message message ' @@ -71,7 +71,7 @@ test_expect_success 'diff in message is retained with -v' ' ' test_expect_success 'submodule log is stripped out too with -v' ' - git config diff.submodule log && + test_config diff.submodule log && git submodule add ./. sub && git commit -m "sub added" && ( -- 1.9.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 v3 4/5] commit test: test_set_editor in each test
t/t7507-commit-verbose.sh was using a global test_set_editor call to build its environment. Rather than building global state with test_set_editor at the beginning of the file, move test_set_editor calls into each test. Besides being inline with current practices, it also allows the tests which required GIT_EDITOR=cat to avoid using a subshell and simplify their logic. Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index e62d921..310b68b 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -6,7 +6,6 @@ test_description='verbose commit template' write_script check-for-diff <<-EOF exec grep '^diff --git' "\$1" EOF -test_set_editor "$(pwd)/check-for-diff" cat >message <<'EOF' subject @@ -21,10 +20,12 @@ test_expect_success 'setup' ' ' test_expect_success 'initial commit shows verbose diff' ' + test_set_editor "$(pwd)/check-for-diff" && git commit --amend -v ' test_expect_success 'second commit' ' + test_set_editor "$(pwd)/check-for-diff" && echo content modified >file && git add file && git commit -F message @@ -36,11 +37,13 @@ check_message() { } test_expect_success 'verbose diff is stripped out' ' + test_set_editor "$(pwd)/check-for-diff" && git commit --amend -v && check_message message ' test_expect_success 'verbose diff is stripped out (mnemonicprefix)' ' + test_set_editor "$(pwd)/check-for-diff" && test_config diff.mnemonicprefix true && git commit --amend -v && check_message message @@ -59,16 +62,19 @@ index 000..f95c11d EOF test_expect_success 'diff in message is retained without -v' ' + test_set_editor "$(pwd)/check-for-diff" && git commit --amend -F diff && check_message diff ' test_expect_success 'diff in message is retained with -v' ' + test_set_editor "$(pwd)/check-for-diff" && git commit --amend -F diff -v && check_message diff ' test_expect_success 'submodule log is stripped out too with -v' ' + test_set_editor "$(pwd)/check-for-diff" && test_config diff.submodule log && git submodule add ./. sub && git commit -m "sub added" && @@ -77,20 +83,14 @@ test_expect_success 'submodule log is stripped out too with -v' ' echo "more" >>file && git commit -a -m "submodule commit" ) && - ( - GIT_EDITOR=cat && - export GIT_EDITOR && - test_must_fail git commit -a -v 2>err - ) && + test_set_editor cat && + test_must_fail git commit -a -v 2>err test_i18ngrep "Aborting commit due to empty commit message." err ' test_expect_success 'verbose diff is stripped out with set core.commentChar' ' - ( - GIT_EDITOR=cat && - export GIT_EDITOR && - test_must_fail git -c core.commentchar=";" commit -a -v 2>err - ) && + test_set_editor cat && + test_must_fail git -c core.commentchar=";" commit -a -v 2>err test_i18ngrep "Aborting commit due to empty commit message." err ' -- 1.9.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 v3 2/5] commit test: Change $PWD to $(pwd)
Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index 6d778ed..3b06d73 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -8,7 +8,7 @@ cat >check-for-diff
[PATCH v3 0/5] commit: support commit.verbose and --no-verbose
This patch allows people to set commit.verbose to implicitly send --verbose to git-commit. It also introduces --no-verbose to override the configuration setting. This version incorporates changes suggested by Eric Sunshine, Duy Nguyen, and Jeremiah Mahler. It introduces several cleanup patches to t/t7505-commit-verbose.sh to bring it closer to the current state of the tests as Eric has explained them to me, then adds the verbose config and --no-verbose flag. Caleb Thompson (5): commit test: Use test_config instead of git-config commit test: Change $PWD to $(pwd) commit test: Use write_script commit test: test_set_editor in each test commit: support commit.verbose and --no-verbose Documentation/config.txt | 5 Documentation/git-commit.txt | 8 +- builtin/commit.c | 6 - contrib/completion/git-completion.bash | 1 + t/t7507-commit-verbose.sh | 68 - 5 files changed, 69 insertions(+), 19 deletions(-) -- 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 v3 3/5] commit test: Use write_script
Use write_script from t/test-lib-functions instead of cat, shebang, and chmod. Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index 3b06d73..e62d921 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -3,11 +3,9 @@ test_description='verbose commit template' . ./test-lib.sh -cat >check-for-diff
[PATCH v3 5/5] commit: support commit.verbose and --no-verbose
Add a new configuration variable commit.verbose to implicitly pass `--verbose` to `git-commit`. Add `--no-verbose` to commit to negate that setting. Signed-off-by: Caleb Thompson --- Documentation/config.txt | 5 + Documentation/git-commit.txt | 8 +++- builtin/commit.c | 6 +- contrib/completion/git-completion.bash | 1 + t/t7507-commit-verbose.sh | 36 ++ 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 1932e9b..a245928 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1009,6 +1009,11 @@ commit.template:: "`~/`" is expanded to the value of `$HOME` and "`~user/`" to the specified user's home directory. +commit.verbose:: + A boolean to enable/disable inclusion of diff information in the + commit message template when using an editor to prepare the commit + message. Defaults to false. + credential.helper:: Specify an external helper to be called when a username or password credential is needed; the helper may consult external diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index 0bbc8f5..8cb3439 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -282,7 +282,13 @@ configuration variable documented in linkgit:git-config[1]. Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its - lines prefixed with '#'. + lines prefixed with '#'. The `commit.verbose` configuration + variable can be set to true to implicitly send this option. + +--no-verbose:: + Do not show the unified diff at the bottom of the commit message + template. This is the default behavior, but can be used to override + the `commit.verbose` configuration variable. -q:: --quiet:: diff --git a/builtin/commit.c b/builtin/commit.c index 9cfef6c..7978d7f 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1417,6 +1417,10 @@ static int git_commit_config(const char *k, const char *v, void *cb) sign_commit = git_config_bool(k, v) ? "" : NULL; return 0; } + if (!strcmp(k, "commit.verbose")) { + verbose = git_config_bool(k, v); + return 0; + } status = git_gpg_config(k, v, NULL); if (status) @@ -1484,7 +1488,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) static struct wt_status s; static struct option builtin_commit_options[] = { OPT__QUIET(&quiet, N_("suppress summary after successful commit")), - OPT__VERBOSE(&verbose, N_("show diff in commit message template")), + OPT_BOOL('v', "verbose", &verbose, N_("show diff in commit message template")), OPT_GROUP(N_("Commit message options")), OPT_FILENAME('F', "file", &logfile, N_("read message from file")), diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2c59a76..b8f4b94 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1976,6 +1976,7 @@ _git_config () color.ui commit.status commit.template + commit.verbose core.abbrev core.askpass core.attributesfile diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index 310b68b..b9eb317 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -7,6 +7,10 @@ write_script check-for-diff <<-EOF exec grep '^diff --git' "\$1" EOF +write_script check-for-no-diff <<-EOF + exec grep -v '^diff --git' "\$1" +EOF + cat >message <<'EOF' subject @@ -49,6 +53,38 @@ test_expect_success 'verbose diff is stripped out (mnemonicprefix)' ' check_message message ' +test_expect_success 'commit shows verbose diff with set commit.verbose=true' ' + echo morecontent >>file && + git add file && + test_config commit.verbose true && + test_set_editor "$(pwd)/check-for-diff" && + git commit --amend +' + +test_expect_success 'commit --verbose overrides verbose=false' ' + echo evenmorecontent >>file && + git add file && + test_config commit.verbose false && + test_set_editor "$(pwd)/check-for-diff" && + git commit --amend --verbose +' + +test_expect_success 'commit does not show verbose diff with commit.verbose=false' ' + echo evenmorecontent >>file && + git add file && + test_config commit.verbose false && + test_set_editor "$(pwd)/check-for-no-diff" && + git commit --amend +' + +test_expect_success 'commit --no-verbose overrides commit.verbose=tru
Can we stage all files using "git add" command, except some specific files ?
Hi, Look below : arup@linux-wzza:~/Rails/app> git status # On branch master # # Initial commit # # Untracked files: # (use "git add ..." to include in what will be committed) # # .gitignore # Gemfile # Gemfile.lock # README.rdoc # Rakefile # app/ # bin/ # config.ru # config/ # db/ # lib/ # log/ # public/ # test/ # vendor/ arup@linux-wzza:~/Rails/app> git add -A arup@linux-wzza:~/Rails/app> git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached ..." to unstage) # # new file: .gitignore # new file: Gemfile # new file: Gemfile.lock # new file: README.rdoc # new file: Rakefile # new file: app/assets/images/.keep # new file: app/assets/javascripts/application.js # new file: app/assets/javascripts/upload.js.coffee # new file: app/assets/stylesheets/application.css # new file: app/assets/stylesheets/upload.css.scss # new file: app/controllers/application_controller.rb # new file: app/controllers/concerns/.keep # new file: app/controllers/upload_controller.rb # new file: app/helpers/application_helper.rb # new file: app/helpers/upload_helper.rb # new file: app/mailers/.keep # new file: app/models/.keep # new file: app/models/concerns/.keep # new file: app/models/picture.rb # new file: app/views/layouts/application.html.erb # new file: app/views/upload/get.html.erb # new file: app/views/upload/show.html.erb # new file: bin/bundle # new file: bin/rails # new file: bin/rake # new file: bin/spring # new file: config.ru # new file: config/application.rb #... #... arup@linux-wzza:~/Rails/app> git rm --cached .gitignore rm '.gitignore' arup@linux-wzza:~/Rails/app> git rm --cached bin/bundle rm 'bin/bundle' Now, you can see, I have staged all the files first using *git add -A*, then _unstaging_ those I don't want to _stage_ right now. Now can this be done, in the *staging* time ? I mean any way to tell `git add` command, that add all the files from the current directory, except some specific files. What I want this is, some times I have at least 30 files, whereas I want to _stage_ say, 20 files, not the rest 10. During _staging_ can I tell *git add* the same. I used *git add -h*, which didn't show me any such hints about my need. -- === Regards, Arup Rakshit -- 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: [RFC/PATCH 1/2] config: Add cache for config value querying
On 2014-05-26 19.33, Tanay Abhra wrote: I like the idea. Please allow some minor comments (and read them as questions rather then answers) > Add an internal cache with the all variable value pairs read from the usual "cache": The word "cache" is in Git often used for "index" "variable value" can be written as "key value" "usual": I don't think we handle "unusual" config files, (so can we drop the word usual ?) I think the (important) first line can be written like this: >Add a hash table with the all key-value pairs read from the or >Add a hash table to cache all key-value pairs read from the > config files(repo specific .git/config, user wide ~/.gitconfig and the global > /etc/gitconfig). Also, add two external functions `git_config_get_string` and Can we drop "Also" ? > @@ -37,6 +39,102 @@ static struct config_source *cf; > > static int zlib_compression_seen; > > +struct hashmap config_cache; > + > +struct config_cache_node { > + struct hashmap_entry ent; > + struct strbuf key; Do we need a whole strbuf for the key? Or could a "char *key" work as well? (and/or could it be "const char *key" ? > + struct string_list *value_list ; > +static struct string_list *config_cache_get_value(const char *key) > +{ > + struct config_cache_node *e = config_cache_find_entry(key); why "e" ? Will "node" be easier to read ? Or entry ? > +static void config_cache_set_value(const char *key, const char *value) > +{ > + struct config_cache_node *e; > + > + if (!value) > + return; Hm, either NULL could mean "unset==remove" the value, (but we don't do that, do we? Or it could mean a programming or runtime error?, Should there be a warning ? > + > + e = config_cache_find_entry(key); > + if (!e) { > + e = malloc(sizeof(*e)); > + hashmap_entry_init(e, strihash(key)); > + strbuf_init(&(e->key), 1024); > + strbuf_addstr(&(e->key),key); > + e->value_list = malloc(sizeof(struct string_list)); > + e->value_list->strdup_strings = 1; > + e->value_list->nr = 0; > + e->value_list->alloc = 0; > + e->value_list->items = NULL; > + e->value_list->cmp = NULL; When malloc() is replaced by xcalloc() the x = NULL and y = 0 can go away, and the code is shorter and easier to read. > +extern const char *git_config_get_string(const char *name) > +{ > + struct string_list *values; > + int num_values; > + char *result; > + values = config_cache_get_value(name); > + if (!values) > + return NULL; > + num_values = values->nr; > + result = values->items[num_values-1].string ; We could get rid of the variable "int num_values" by simply writing result = values->items[values->nr-1].string; -- 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: Can we stage all files using "git add" command, except some specific files ?
On di, 2014-05-27 at 00:33 +0630, Arup Rakshit wrote: > > Now, you can see, I have staged all the files first using *git add > -A*, then _unstaging_ those I don't want to _stage_ right now. Now can > this be done, in the *staging* time ? I mean any way to tell `git add` > command, that add all the files from the current directory, except > some specific files. No, there is no such option to do that, but you could use git add --interactive and use its interface to quickly pick the files you want to add. -- Dennis Kaarsemaker www.kaarsemaker.net -- 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: Can we stage all files using "git add" command, except some specific files ?
On Monday, May 26, 2014 10:23:22 PM you wrote: > On di, 2014-05-27 at 00:33 +0630, Arup Rakshit wrote: > > Now, you can see, I have staged all the files first using *git add > > -A*, then _unstaging_ those I don't want to _stage_ right now. Now can > > this be done, in the *staging* time ? I mean any way to tell `git add` > > command, that add all the files from the current directory, except > > some specific files. > > No, there is no such option to do that, but you could use git add > --interactive and use its interface to quickly pick the files you want > to add. Hi, I tried it also.. But just didn't get it, how to use,, lots of options 1,2,3 etc .. :) -- === Regards, Arup Rakshit -- 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 v3 5/5] commit: support commit.verbose and --no-verbose
j On Mon, May 26, 2014 at 01:56:26PM -0500, Caleb Thompson wrote: > Add a new configuration variable commit.verbose to implicitly pass > ... > +test_expect_success 'commit shows verbose diff with set commit.verbose=true' > ' > + echo morecontent >>file && > + git add file && > + test_config commit.verbose true && > + test_set_editor "$(pwd)/check-for-diff" && > + git commit --amend > +' > + > +test_expect_success 'commit --verbose overrides verbose=false' ' > + echo evenmorecontent >>file && > + git add file && > + test_config commit.verbose false && > + test_set_editor "$(pwd)/check-for-diff" && > + git commit --amend --verbose > +' > + > +test_expect_success 'commit does not show verbose diff with > commit.verbose=false' ' > + echo evenmorecontent >>file && > + git add file && > + test_config commit.verbose false && > + test_set_editor "$(pwd)/check-for-no-diff" && > + git commit --amend > +' > + > +test_expect_success 'commit --no-verbose overrides commit.verbose=true' ' > + echo evenmorecontent >>file && > + git add file && > + test_config commit.verbose true && > + test_set_editor "$(pwd)/check-for-no-diff" && > + git commit --amend --no-verbose > +' > + ... > It appears that these tests still aren't checking to see if the "verbose" output appears in the commit message. -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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 v3 5/5] commit: support commit.verbose and --no-verbose
The editors, `check-for-diff` and `check-for-no-diffs`, are grepping for the output and lack thereof, respectively. On Mon, May 26, 2014 at 01:33:04PM -0700, Jeremiah Mahler wrote: > j > On Mon, May 26, 2014 at 01:56:26PM -0500, Caleb Thompson wrote: > > Add a new configuration variable commit.verbose to implicitly pass > > > ... > > +test_expect_success 'commit shows verbose diff with set > > commit.verbose=true' ' > > + echo morecontent >>file && > > + git add file && > > + test_config commit.verbose true && > > + test_set_editor "$(pwd)/check-for-diff" && > > + git commit --amend > > +' > > + > > +test_expect_success 'commit --verbose overrides verbose=false' ' > > + echo evenmorecontent >>file && > > + git add file && > > + test_config commit.verbose false && > > + test_set_editor "$(pwd)/check-for-diff" && > > + git commit --amend --verbose > > +' > > + > > +test_expect_success 'commit does not show verbose diff with > > commit.verbose=false' ' > > + echo evenmorecontent >>file && > > + git add file && > > + test_config commit.verbose false && > > + test_set_editor "$(pwd)/check-for-no-diff" && > > + git commit --amend > > +' > > + > > +test_expect_success 'commit --no-verbose overrides commit.verbose=true' ' > > + echo evenmorecontent >>file && > > + git add file && > > + test_config commit.verbose true && > > + test_set_editor "$(pwd)/check-for-no-diff" && > > + git commit --amend --no-verbose > > +' > > + > ... > > > > It appears that these tests still aren't checking to see if the > "verbose" output appears in the commit message. > > -- > Jeremiah Mahler > jmmah...@gmail.com > http://github.com/jmahler pgp2_8xIL6D99.pgp Description: PGP signature
Re: [PATCH v3 5/5] commit: support commit.verbose and --no-verbose
On Mon, May 26, 2014 at 03:39:55PM -0500, Caleb Thompson wrote: > The editors, `check-for-diff` and `check-for-no-diffs`, are grepping for > the output and lack thereof, respectively. ... > > > > It appears that these tests still aren't checking to see if the > > "verbose" output appears in the commit message. > > > > OK, got it. The editor, set by test_set_editor, is run as part of the commit. Thanks for explaining that. -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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: Can we stage all files using "git add" command, except some specific files ?
If you don't want an specific file, but you neither the .gitignore, just use .git/info/exclude file for project specific or $HOME/.config/git/ignore for user level. Anyway, this is all in man gitignore [1] Git ignore man page: http://git-scm.com/docs/gitignore Javier Domingo Cansino 2014-05-26 21:27 GMT+02:00 Arup Rakshit : > On Monday, May 26, 2014 10:23:22 PM you wrote: >> On di, 2014-05-27 at 00:33 +0630, Arup Rakshit wrote: >> > Now, you can see, I have staged all the files first using *git add >> > -A*, then _unstaging_ those I don't want to _stage_ right now. Now can >> > this be done, in the *staging* time ? I mean any way to tell `git add` >> > command, that add all the files from the current directory, except >> > some specific files. >> >> No, there is no such option to do that, but you could use git add >> --interactive and use its interface to quickly pick the files you want >> to add. > > Hi, > > I tried it also.. But just didn't get it, how to use,, lots of options 1,2,3 > etc .. :) > > -- > === > Regards, > Arup Rakshit > -- > 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
[RFC 2/3] rebase -i: Reschedule tasks that failed before the index was touched
When `rebase--interactive` processes a task, it removes the item from the todo list and appends it to another list of executed tasks. If a `pick` (this includes `squash` and `fixup`) fails before the index has recorded the changes, take the corresponding item and put it on the todo list again. Otherwise, the changes introduced by the scheduled commit would be lost. That kind of decision is possible since the `cherry-pick` command signals why it failed to apply the changes of the given commit. Either the changes are recorded in the index using a conflict (return value 1) and `rebase` does not continue until they are resolved or the changes are not recorded in the index (return value neither 0 nor 1) and `rebase` has to try again with the same task. Reported-by: Phil Hord Signed-off-by: Fabian Ruch --- git-rebase--interactive.sh | 27 ++- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 9e1dd1e..bba4f3a 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -132,6 +132,16 @@ mark_action_done () { fi } +# Put the last action marked done at the beginning of the todo list +# again. If there has not been an action marked done yet, the list of +# items on the todo list is left unchanged. +reschedule_last_action () { + tail -n 1 "$done" | cat - "$todo" >"$todo".new + sed -e \$d <"$done" >"$done".new + mv -f "$todo".new "$todo" + mv -f "$done".new "$done" +} + append_todo_help () { git stripspace --comment-lines >>"$todo" <<\EOF @@ -470,11 +480,15 @@ do_pick () { --no-post-rewrite -n -q -C $1 && pick_one -n $1 && git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || - die_with_patch $1 "Could not apply $1... $2" + --amend --no-post-rewrite -n -q -C $1 else - pick_one $1 || - die_with_patch $1 "Could not apply $1... $2" + pick_one $1 + fi + ret=$? + if test $ret -ne 0 + then + test $ret -ne 1 && reschedule_last_action + die_with_patch $1 "Could not apply $1... $2" fi } @@ -533,8 +547,11 @@ do_next () { author_script_content=$(get_author_ident_from_commit HEAD) echo "$author_script_content" > "$author_script" eval "$author_script_content" - if ! pick_one -n $sha1 + pick_one -n $sha1 + ret=$? + if test $ret -ne 0 then + test $ret -ne 1 && reschedule_last_action git rev-parse --verify HEAD >"$amend" die_failed_squash $sha1 "$rest" fi -- 1.9.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
[RFC 1/3] sequencer: Signal failed ff as an aborted, not a conflicted merge
`do_pick_commit` handles three situations if it is not fast-forwarding. In order for `do_pick_commit` to identify the situation, it examines the return value of the selected merge command. 1. return value 0 stands for a clean merge 2. 1 is passed in case of a failed merge due to conflict 3. any other return value means that the merge did not even start So far, the sequencer returns 1 in case of a failed fast-forward, which would mean "failed merge due to conflict". However, a fast-forward either starts and succeeds or does not start at all. In particular, it cannot fail in between like a merge with a dirty index due to conflicts. In order to signal the three possible situations (not only success and failure to complete) after a pick through porcelain commands such as `cherry-pick`, exit with a return value that is neither 0 nor 1. -1 was chosen in line with the other situations in which the sequencer encounters an error. Signed-off-by: Fabian Ruch --- sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index 90cac7b..97cecca 100644 --- a/sequencer.c +++ b/sequencer.c @@ -278,7 +278,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from, read_cache(); if (checkout_fast_forward(from, to, 1)) - exit(1); /* the callee should have complained already */ + exit(-1); /* the callee should have complained already */ ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from, 0, NULL); strbuf_addf(&sb, "%s: fast-forward", action_name(opts)); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Can we stage all files using "git add" command, except some specific files ?
On Tue, May 27, 2014 at 1:03 AM, Arup Rakshit wrote: > Now, you can see, I have staged all the files first using *git add -A*, then > _unstaging_ those I don't want to _stage_ right now. Now can this be done, in > the *staging* time ? I mean any way to tell `git add` command, that add all > the files from the current directory, except some specific files. What I want > this is, some times I have at least 30 files, whereas I want to _stage_ say, > 20 > files, not the rest 10. During _staging_ can I tell *git add* the same. I used > *git add -h*, which didn't show me any such hints about my need. Try "git add -A :/ :! :!" which basically says add all files in repo _except_ those that match pattern1, or pattern2... I assume you can classify "the rest 10" because there's no way to express "Adding all except the rest 10". -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 3/3] tests: Add 'rebase -i commits that overwrite untracked files'
If a todo list will cherry-pick a commit that adds some file and the working tree already contains a file with the same name, the rebase sequence for that todo list will be interrupted and the cherry-picked commit will be lost after the rebasing process is resumed. This is fixed. Add as a test case for regression testing to the "rebase-interactive" test suite. Reported-by: Phil Hord Signed-off-by: Fabian Ruch --- t/t3404-rebase-interactive.sh | 44 +++ 1 file changed, 44 insertions(+) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 50e22b1..7f5ac18 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1074,4 +1074,48 @@ test_expect_success 'short SHA-1 collide' ' ) ' +test_expect_success 'rebase -i commits that overwrite untracked files (pick)' ' + git checkout branch2 && + set_fake_editor && + FAKE_LINES="edit 1 2" git rebase -i A && + test_cmp_rev HEAD F && + test_path_is_missing file6 && + touch file6 && + test_must_fail git rebase --continue && + test_cmp_rev HEAD F && + rm file6 && + git rebase --continue && + test_cmp_rev HEAD I +' + +test_expect_success 'rebase -i commits that overwrite untracked files (squash)' ' + git checkout branch2 && + git tag original-branch2 && + set_fake_editor && + FAKE_LINES="edit 1 squash 2" git rebase -i A && + test_cmp_rev HEAD F && + test_path_is_missing file6 && + touch file6 && + test_must_fail git rebase --continue && + test_cmp_rev HEAD F && + rm file6 && + git rebase --continue && + test $(git cat-file commit HEAD | sed -ne \$p) = I && + git reset --hard original-branch2 +' + +test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' ' + git checkout branch2 && + set_fake_editor && + FAKE_LINES="edit 1 2" git rebase -i --no-ff A && + test $(git cat-file commit HEAD | sed -ne \$p) = F && + test_path_is_missing file6 && + touch file6 && + test_must_fail git rebase --continue && + test $(git cat-file commit HEAD | sed -ne \$p) = F && + rm file6 && + git rebase --continue && + test $(git cat-file commit HEAD | sed -ne \$p) = I +' + test_done -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 5/5] commit: support commit.verbose and --no-verbose
Caleb, On Mon, May 26, 2014 at 01:56:26PM -0500, Caleb Thompson wrote: > Add a new configuration variable commit.verbose to implicitly pass > `--verbose` to `git-commit`. Add `--no-verbose` to commit to negate that > setting. > > Signed-off-by: Caleb Thompson > --- > Documentation/config.txt | 5 + > ' ... > > +test_expect_success 'commit shows verbose diff with set commit.verbose=true' > ' > + echo morecontent >>file && ... > +' > + > +test_expect_success 'commit --verbose overrides verbose=false' ' > + echo evenmorecontent >>file && ... > + > +test_expect_success 'commit does not show verbose diff with > commit.verbose=false' ' > + echo evenmorecontent >>file && ... > +' > + > +test_expect_success 'commit --no-verbose overrides commit.verbose=true' ' > + echo evenmorecontent >>file && ... > +' > + > Some minor style nits... Use a consistent naming convention for your tests. verbose=false looks different than commit.verbose=false at first glance. Also, since "commit.verbose=false" is an invalid syntax for a config option, I would remove the '=' and just make it "commit.verbose false". -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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: Can we stage all files using "git add" command, except some specific files ?
On Tue, May 27, 2014 at 5:06 AM, Javier Domingo Cansino wrote: > If you don't want an specific file, but you neither the .gitignore, > just use .git/info/exclude file for project specific or > $HOME/.config/git/ignore for user level. This is actually better. 'git add' does not allow to specify exclude patterns in command line (more convenient then editing .gitignore) like ls-files. Perhaps we should add it for one-shot exclusion? > Anyway, this is all in man gitignore > > [1] Git ignore man page: http://git-scm.com/docs/gitignore > Javier Domingo Cansino -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/5] commit: support commit.verbose and --no-verbose
Caleb, On Mon, May 26, 2014 at 01:56:21PM -0500, Caleb Thompson wrote: > This patch allows people to set commit.verbose to implicitly send > --verbose to git-commit. It also introduces --no-verbose to > override the configuration setting. > > This version incorporates changes suggested by Eric Sunshine, Duy > Nguyen, and Jeremiah Mahler. > ... > Other than the minor style issue I pointed out in another email, it looks good, and the patch set works properly on my machine. -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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 v3 0/5] commit: support commit.verbose and --no-verbose
Great, thanks Jeremiah! I made that change, and will send up another patch version in the next day or so while I wait on others who may have input. I'm really appreciative of everyone's feedback! Caleb >8-- diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh index b9eb317..88de624 100755 --- a/t/t7507-commit-verbose.sh +++ b/t/t7507-commit-verbose.sh @@ -53,7 +53,7 @@ test_expect_success 'verbose diff is stripped out (mnemonicprefix)' ' check_message message ' -test_expect_success 'commit shows verbose diff with set commit.verbose=true' ' +test_expect_success 'commit shows verbose diff with commit.verbose true' ' echo morecontent >>file && git add file && test_config commit.verbose true && @@ -61,7 +61,7 @@ test_expect_success 'commit shows verbose diff with set commit.verbose=true' ' git commit --amend ' -test_expect_success 'commit --verbose overrides verbose=false' ' +test_expect_success 'commit --verbose overrides commit.verbose false' ' echo evenmorecontent >>file && git add file && test_config commit.verbose false && @@ -69,7 +69,7 @@ test_expect_success 'commit --verbose overrides verbose=false' ' git commit --amend --verbose ' -test_expect_success 'commit does not show verbose diff with commit.verbose=false' ' +test_expect_success 'commit does not show verbose diff with commit.verbose false' ' echo evenmorecontent >>file && git add file && test_config commit.verbose false && @@ -77,7 +77,7 @@ test_expect_success 'commit does not show verbose diff with commit.verbose=false git commit --amend ' -test_expect_success 'commit --no-verbose overrides commit.verbose=true' ' +test_expect_success 'commit --no-verbose overrides commit.verbose true' ' echo evenmorecontent >>file && git add file && test_config commit.verbose true && On Mon, May 26, 2014 at 03:34:20PM -0700, Jeremiah Mahler wrote: > Caleb, > > On Mon, May 26, 2014 at 01:56:21PM -0500, Caleb Thompson wrote: > > This patch allows people to set commit.verbose to implicitly send > > --verbose to git-commit. It also introduces --no-verbose to > > override the configuration setting. > > > > This version incorporates changes suggested by Eric Sunshine, Duy > > Nguyen, and Jeremiah Mahler. > > > ... > > > > Other than the minor style issue I pointed out in another email, it looks > good, and the patch set works properly on my machine. > > -- > Jeremiah Mahler > jmmah...@gmail.com > http://github.com/jmahler pgp_CQLvPy4QM.pgp Description: PGP signature
Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments
Brian, On Tue, May 27, 2014 at 12:33:42AM +0900, Brian Gesiak wrote: > xcalloc takes two arguments: the number of elements and their size. > run_add_interactive passes the arguments in reverse order, passing the > size of a char*, followed by the number of char* to be allocated. > Rearrgange them so they are in the correct order. > > Signed-off-by: Brian Gesiak > --- > builtin/add.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/add.c b/builtin/add.c > index 672adc0..488acf4 100644 > --- a/builtin/add.c > +++ b/builtin/add.c > @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char > *patch_mode, > int status, ac, i; > const char **args; > > - args = xcalloc(sizeof(const char *), (pathspec->nr + 6)); > + args = xcalloc((pathspec->nr + 6), sizeof(const char *)); > ac = 0; > args[ac++] = "add--interactive"; > if (patch_mode) > This patch doesn't apply to any of the branches I have available (master, pu, next). And there is no line containing "pathspec->nr + 6" anywhere in my builtin/add.c. Which branch is your work based off? -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/15] Rearrange xcalloc arguments
Brian, On Tue, May 27, 2014 at 12:33:41AM +0900, Brian Gesiak wrote: > xcalloc takes two arguments: the number of elements and their size. > The vast majority of the Git codebase passes these arguments in the > correct order, but there are some exceptions. This patch series > corrects those exceptions. > Let me see if I understand the issue underlying this patch set. xcalloc works like calloc and takes two arguments, the number of elements and the size of each element. However, many calls specified these arguments in the reverse order. It didn't produce a compile error because both arguments are the same type. And it didn't produce a run time error because A*B is the same as B*A. If this behaved like dd, performance would be different depending on the order. dd if=in of=out bs=1count=1024 dd if=in of=out bs=1024 count=1 Nonetheless, it appears to be a good fix. Nice job! -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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] git-instaweb: add support for Apache 2.4
Detect available Apache MPMs and use first available according to following order of precedence: mpm_event mpm_prefork mpm_worker Add authz_core module if available to avoid HTTP Error 500 errors. Signed-off-by: Jonathan McCrohan --- git-instaweb.sh | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/git-instaweb.sh b/git-instaweb.sh index 4aa3eb8..513efa6 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -345,7 +345,17 @@ PidFile "$fqgitdir/pid" Listen $bind$port EOF - for mod in mime dir env log_config + for mod in mpm_event mpm_prefork mpm_worker + do + if test -e $module_path/mod_${mod}.so + then + echo "LoadModule ${mod}_module " \ +"$module_path/mod_${mod}.so" >> "$conf" + # only one mpm module permitted + break + fi + done + for mod in mime dir env log_config authz_core do if test -e $module_path/mod_${mod}.so then -- 2.0.0.rc2 -- 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 01/15] builtin/add.c: rearrange xcalloc arguments
My apologies! I based my work off of maint, branching off of eea591. My reasoning was that Documentation/SubmittingPatches states that "a bugfix should be based on 'maint'". [1] Now that I think about it, this is probably not the kind of "bug" that statement had in mind. Should I reroll the patch based on master? - Brian Gesiak [1] https://github.com/git/git/blob/4a28f169ad29ba452e0e7bea2583914c10c58322/Documentation/SubmittingPatches#L9 On Tue, May 27, 2014 at 8:11 AM, Jeremiah Mahler wrote: > Brian, > > On Tue, May 27, 2014 at 12:33:42AM +0900, Brian Gesiak wrote: >> xcalloc takes two arguments: the number of elements and their size. >> run_add_interactive passes the arguments in reverse order, passing the >> size of a char*, followed by the number of char* to be allocated. >> Rearrgange them so they are in the correct order. >> >> Signed-off-by: Brian Gesiak >> --- >> builtin/add.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/builtin/add.c b/builtin/add.c >> index 672adc0..488acf4 100644 >> --- a/builtin/add.c >> +++ b/builtin/add.c >> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char >> *patch_mode, >> int status, ac, i; >> const char **args; >> >> - args = xcalloc(sizeof(const char *), (pathspec->nr + 6)); >> + args = xcalloc((pathspec->nr + 6), sizeof(const char *)); >> ac = 0; >> args[ac++] = "add--interactive"; >> if (patch_mode) >> > > This patch doesn't apply to any of the branches I have available > (master, pu, next). And there is no line containing "pathspec->nr + 6" > anywhere in my builtin/add.c. Which branch is your work based off? > > -- > Jeremiah Mahler > jmmah...@gmail.com > http://github.com/jmahler -- 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 01/15] builtin/add.c: rearrange xcalloc arguments
On Tue, May 27, 2014 at 11:22:00AM +0900, Brian Gesiak wrote: > My apologies! I based my work off of maint, branching off of eea591. > > My reasoning was that Documentation/SubmittingPatches states that "a > bugfix should be based on 'maint'". [1] Now that I think about it, > this is probably not the kind of "bug" that statement had in mind. > > Should I reroll the patch based on master? > > - Brian Gesiak > > [1] > https://github.com/git/git/blob/4a28f169ad29ba452e0e7bea2583914c10c58322/Documentation/SubmittingPatches#L9 > OK, got it. I should have read Documentation/SubmittingPatches more closely like you did :-) No need to reroll I can just use the maint branch to test it out. Thanks! -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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 01/15] builtin/add.c: rearrange xcalloc arguments
On Mon, May 26, 2014 at 11:33 AM, Brian Gesiak wrote: > xcalloc takes two arguments: the number of elements and their size. > run_add_interactive passes the arguments in reverse order, passing the > size of a char*, followed by the number of char* to be allocated. > Rearrgange them so they are in the correct order. s/Rearrgange/Rearrange/ Same misspelling afflicts the entire patch series. > Signed-off-by: Brian Gesiak > --- > builtin/add.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/add.c b/builtin/add.c > index 672adc0..488acf4 100644 > --- a/builtin/add.c > +++ b/builtin/add.c > @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char > *patch_mode, > int status, ac, i; > const char **args; > > - args = xcalloc(sizeof(const char *), (pathspec->nr + 6)); > + args = xcalloc((pathspec->nr + 6), sizeof(const char *)); > ac = 0; > args[ac++] = "add--interactive"; > if (patch_mode) > -- > 2.0.0.rc1.543.gc8042da -- 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 v4] Add an explicit GIT_DIR to the list of excludes
When an explicit '--git-dir' option points to a directory inside the work tree, git treats it as if it were any other directory. In particular, 'git status' lists it as untracked, while 'git add -A' stages the metadata directory entirely Add GIT_DIR to the list of excludes in setup_standard_excludes(), while checking that GIT_DIR is not just '.git', in which case it would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE Although an analogous comparison of any given path against '.git' is done in treat_path(), this does not seem to be the right place to compare against GIT_DIR. Instead, the excludes provide an effective mechanism of ignoring a file/directory, and adding GIT_DIR as an exclude is equivalent of putting it into '.gitignore'. Function setup_standard_excludes() was chosen because that is the place where the excludes are initialized by the commands that are concerned about excludes Signed-off-by: Pasha Bolokhov --- Improve test tree structure. Add a check for work_tree==NULL in dir.c:setup_standard_excludes When work_tree is NULL, there is no concept of whether the repo is within work tree or not, but we still default to ignoring GIT_DIR Documentation/technical/api-directory-listing.txt | 4 +- dir.c | 32 + t/t2205-add-gitdir.sh | 163 ++ 3 files changed, 197 insertions(+), 2 deletions(-) create mode 100755 t/t2205-add-gitdir.sh diff --git a/Documentation/technical/api-directory-listing.txt b/Documentation/technical/api-directory-listing.txt index 7f8e78d..fd4a178 100644 --- a/Documentation/technical/api-directory-listing.txt +++ b/Documentation/technical/api-directory-listing.txt @@ -90,8 +90,8 @@ marked. If you to exclude files, make sure you have loaded index first. `add_exclude()`. * To add patterns from a file (e.g. `.git/info/exclude`), call - `add_excludes_from_file()` , and/or set `dir.exclude_per_dir`. A - short-hand function `setup_standard_excludes()` can be used to set + `add_excludes_from_file()` , and/or set `dir.exclude_per_dir`. The + short-hand function `setup_standard_excludes()` must be used to set up the standard set of exclude settings. * Set options described in the Data Structure section above. diff --git a/dir.c b/dir.c index 98bb50f..dd76da1 100644 --- a/dir.c +++ b/dir.c @@ -1588,6 +1588,38 @@ void setup_standard_excludes(struct dir_struct *dir) { const char *path; char *xdg_path; + const char *r_git, *gitdir = get_git_dir(); + char *n_git, *basename; + int len, i; + + /* +* Add git directory to the ignores; do this only if +* GIT_DIR does not end with "/.git" +*/ + r_git = real_path(absolute_path(gitdir)); + n_git = xmalloc(strlen(r_git) + 1 + 1); + normalize_path_copy(n_git, r_git); + + len = strlen(n_git); /* real_path() has stripped trailing slash */ + for (i = len - 1; i > 0 && !is_dir_sep(n_git[i]); i--) ; + basename = n_git + i; + if (is_dir_sep(*basename)) + basename++; + if (strcmp(basename, ".git")) { + const char *worktree = get_git_work_tree(); + + if (worktree == NULL || + dir_inside_of(n_git, get_git_work_tree()) >= 0) { + struct exclude_list *el = add_exclude_list(dir, EXC_CMDL, + "GIT_DIR setup"); + + /* append a trailing slash to exclude directories */ + n_git[len] = '/'; + n_git[len + 1] = '\0'; + add_exclude(basename, "", 0, el, 0); + } + } + free(n_git); dir->exclude_per_dir = ".gitignore"; path = git_path("info/exclude"); diff --git a/t/t2205-add-gitdir.sh b/t/t2205-add-gitdir.sh new file mode 100755 index 000..4cc26af --- /dev/null +++ b/t/t2205-add-gitdir.sh @@ -0,0 +1,163 @@ +#!/bin/sh +# +# Copyright (c) 2014 Pasha Bolokhov +# + +test_description='alternative repository path specified by --git-dir is ignored by add and status' + +. ./test-lib.sh + +# +# Create a tree: +# +# repo-inside/ repo-outside/ +# +# +# repo-inside: +# a b c d subdir/ [meta/] +# +# repo-inside/subdir: +# e f g h meta/ ssubdir/ +# +# repo-inside/subdir/meta: +# aa +# +# repo-inside/subdir/ssubdir: +# meta/ +# +# repo-inside/subdir/ssubdir/meta: +# aaa +# +# +# +# repo-outside: +# external/ tree/ +# +# repo-outside/external: +# [meta/] +# +# repo-outside/tree: +# n o p q meta/ sub/ +# +# repo-outside/tree/meta: +# bb +# +# repo-outside/tree/sub: +# meta/ +# +# repo-outside/tree/sub/meta: +# bbb +# +# +# (both of the above [meta/] denote the actual repositories) +# + +# +# First set of tests (in "repo-inside/"): +# --- +# +# Name the repository "me
Re: Can we stage all files using "git add" command, except some specific files ?
On Tuesday, May 27, 2014 12:06:34 AM you wrote: > If you don't want an specific file, but you neither the .gitignore, > just use .git/info/exclude file for project specific or > $HOME/.config/git/ignore for user level. > > Anyway, this is all in man gitignore > > [1] Git ignore man page: http://git-scm.com/docs/gitignore > Javier Domingo Cansino Hum. That I know, but I show that in my post, just as an example. Here question was other files, not _.gitignore_. Anyway, I understand now, that I am looking for is not available in Git. The way, I was doing, is the only way to do it. Thanks for your reply. -- === Regards, Arup Rakshit -- 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 v3 2/5] commit test: Change $PWD to $(pwd)
Am 5/26/2014 20:56, schrieb Caleb Thompson: > Signed-off-by: Caleb Thompson > --- > t/t7507-commit-verbose.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > index 6d778ed..3b06d73 100755 > --- a/t/t7507-commit-verbose.sh > +++ b/t/t7507-commit-verbose.sh > @@ -8,7 +8,7 @@ cat >check-for-diff < exec grep '^diff --git' "\$1" > EOF > chmod +x check-for-diff > -test_set_editor "$PWD/check-for-diff" > +test_set_editor "$(pwd)/check-for-diff" > > cat >message <<'EOF' > subject Why? I see no benefit. Both $PWD and $(pwd) work fine everywhere, including Windows, and the former is faster, particularly on Windows. -- Hannes -- 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 v3 2/5] commit test: Change $PWD to $(pwd)
On Tue, May 27, 2014 at 1:46 AM, Johannes Sixt wrote: > Am 5/26/2014 20:56, schrieb Caleb Thompson: >> Signed-off-by: Caleb Thompson >> --- >> t/t7507-commit-verbose.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh >> index 6d778ed..3b06d73 100755 >> --- a/t/t7507-commit-verbose.sh >> +++ b/t/t7507-commit-verbose.sh >> @@ -8,7 +8,7 @@ cat >check-for-diff <> exec grep '^diff --git' "\$1" >> EOF >> chmod +x check-for-diff >> -test_set_editor "$PWD/check-for-diff" >> +test_set_editor "$(pwd)/check-for-diff" >> >> cat >message <<'EOF' >> subject > > Why? I see no benefit. Both $PWD and $(pwd) work fine everywhere, > including Windows, and the former is faster, particularly on Windows. Poor advice on my part when reviewing the previous round. When I had read in git/t/README (in the distant past): When a test checks for an absolute path that a git command generated, construct the expected value using $(pwd) rather than $PWD, $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on Windows, where the shell (MSYS bash) mangles absolute path names. For details, see the commit message of 4114156ae9. I must have missed the word "check" in the first sentence. -- 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 v3 2/5] commit test: Change $PWD to $(pwd)
On Tue, May 27, 2014 at 07:46:59AM +0200, Johannes Sixt wrote: > Am 5/26/2014 20:56, schrieb Caleb Thompson: > > Signed-off-by: Caleb Thompson > > --- > > t/t7507-commit-verbose.sh | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > > index 6d778ed..3b06d73 100755 > > --- a/t/t7507-commit-verbose.sh > > +++ b/t/t7507-commit-verbose.sh > > @@ -8,7 +8,7 @@ cat >check-for-diff < > exec grep '^diff --git' "\$1" > > EOF > > chmod +x check-for-diff > > -test_set_editor "$PWD/check-for-diff" > > +test_set_editor "$(pwd)/check-for-diff" > > > > cat >message <<'EOF' > > subject > > Why? I see no benefit. Both $PWD and $(pwd) work fine everywhere, > including Windows, and the former is faster, particularly on Windows. > > -- Hannes I don't know the technical details of why this change is needed. But someone felt it was important enough to put in t/README. - When a test checks for an absolute path that a git command generated, construct the expected value using $(pwd) rather than $PWD, $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on Windows, where the shell (MSYS bash) mangles absolute path names. For details, see the commit message of 4114156ae9. -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- 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 v3 2/5] commit test: Change $PWD to $(pwd)
Please do not cull the Cc list. Am 5/27/2014 8:14, schrieb Jeremiah Mahler: > On Tue, May 27, 2014 at 07:46:59AM +0200, Johannes Sixt wrote: >> Am 5/26/2014 20:56, schrieb Caleb Thompson: >>> Signed-off-by: Caleb Thompson >>> --- >>> t/t7507-commit-verbose.sh | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh >>> index 6d778ed..3b06d73 100755 >>> --- a/t/t7507-commit-verbose.sh >>> +++ b/t/t7507-commit-verbose.sh >>> @@ -8,7 +8,7 @@ cat >check-for-diff <>> exec grep '^diff --git' "\$1" >>> EOF >>> chmod +x check-for-diff >>> -test_set_editor "$PWD/check-for-diff" >>> +test_set_editor "$(pwd)/check-for-diff" >>> >>> cat >message <<'EOF' >>> subject >> >> Why? I see no benefit. Both $PWD and $(pwd) work fine everywhere, >> including Windows, and the former is faster, particularly on Windows. > > I don't know the technical details of why this change is needed. > But someone felt it was important enough to put in t/README. > > - When a test checks for an absolute path that a git command generated, > construct the expected value using $(pwd) rather than $PWD, > $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on > Windows, where the shell (MSYS bash) mangles absolute path names. > For details, see the commit message of 4114156ae9. That someone was I. I appreciate that people study t/README and do not ignore the sentence. However, it does not apply to the situation because the path to the editor is not "generated by a git command and checked for by a test". That said, it is not wrong to use $(pwd) with test_set_editor, it's just unnecessarily slow. -- Hannes -- 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