[PATCH 00/20] Separate `ref_cache` into a separate module

2017-03-20 Thread Michael Haggerty
nch, v6 [2]. They are also available from my GitHub fork [1] as branch `separate-ref-cache`. Happily, this patch series actually removes a few more lines than it adds, mostly thanks to the simpler `verify_refname_available()` implementation. Michael [1] https://github.com/mhagger/git [2] http://public-inb

Re: [PATCH v6 17/27] refs: move submodule code out of files-backend.c

2017-03-20 Thread Michael Haggerty
On 03/20/2017 01:09 PM, Duy Nguyen wrote: > On Mon, Mar 20, 2017 at 4:05 AM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >>> [...] >>> diff --git a/refs/refs-internal.h b/refs/refs-internal.h >>> index f732473e1d..dfa1817929 100644 >>>

Re: [PATCH v3 2/4] refs: introduce get_worktree_ref_store()

2017-03-20 Thread Michael Haggerty
On 03/20/2017 01:01 PM, Duy Nguyen wrote: > On Mon, Mar 20, 2017 at 1:59 PM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >> I guess I can hold my nose and accept storing worktree and submodule >> `ref_store`s together in a single hashmap > > Release you

Re: [PATCH v3 2/4] refs: introduce get_worktree_ref_store()

2017-03-20 Thread Michael Haggerty
e" in the names, because that will be a continuing source of confusion to readers. For example, * lookup_submodule_ref_store() * register_submodule_ref_store() * submodule_hash_entry * submodule_hash_cmp() * alloc_submodule_hash_entry() * submodule_ref_stores Any docstrings would also have to be updated. As a new naming scheme, maybe use s/submodule/other/, for example `lookup_other_ref_store()` etc. > [...] Michael

Re: Use base32?

2017-03-20 Thread Michael Steuer
On 20/03/2017 16:21, Jason Hennessey wrote: On Wed, 8 Mar 2017, Johannes Schindelin wrote: Linus Torvalds writes ("Re: RFC: Another proposed hash function transition plan"): > > Of course, having written that, I now realize how it would cause problems for the usual shit-for-brains

Re: [PATCH v6 00/27] Remove submodule from files-backend.c

2017-03-19 Thread Michael Haggerty
optional comments, but nothing serious. With or without the suggested changes, I think it's ready to go. Thanks for working on this! Reviewed-by: Michael Haggerty <mhag...@alum.mit.edu> Michael

Re: [PATCH v6 26/27] t1406: new tests for submodule ref store

2017-03-19 Thread Michael Haggerty
ts. At least in t1405 the names of the constants appear in the test name, meaning that anybody changing the constants' values in the future will probably find the "3" in that file. Would you do the same here, please, or at least mention the constant names in a comment here? > [...] Michael

Re: [PATCH v6 18/27] files-backend: replace submodule_allowed check in files_downcast()

2017-03-19 Thread Michael Haggerty
> * the ref_store and to record the ref_store for later lookup. > */ > -typedef struct ref_store *ref_store_init_fn(const char *gitdir); > +typedef struct ref_store *ref_store_init_fn(const char *gitdir, > + unsigned int flags); > > typedef int ref_init_db_fn(struct ref_store *refs, struct strbuf *err); Michael [1] http://public-inbox.org/git/8fafd49f-71a6-ee97-6a69-c23e23c5d...@alum.mit.edu/

Re: [PATCH v6 17/27] refs: move submodule code out of files-backend.c

2017-03-19 Thread Michael Haggerty
py of `gitdir`? > */ > -typedef struct ref_store *ref_store_init_fn(const char *submodule); > +typedef struct ref_store *ref_store_init_fn(const char *gitdir); > > typedef int ref_init_db_fn(struct ref_store *refs, struct strbuf *err); Michael

Re: [PATCH v6 16/27] path.c: move some code out of strbuf_git_path_submodule()

2017-03-19 Thread Michael Haggerty
the index), return the repository > + * path of that submodule in 'buf'. Return -1 on error or when the > + * submodule is not initialized. > + */ Thanks for writing a docstring, but given that this is a public function, I think it is preferred to put the docstring in the header file. > [...] Michael

Re: [PATCH v6 11/27] refs.c: introduce get_main_ref_store()

2017-03-19 Thread Michael Haggerty
erfluous and the function could look like static struct ref_store *get_main_ref_store(void) { if (!main_ref_store) main_ref_store = ref_store_init(NULL); return main_ref_store; } > [...] Michael [1] http://public-inbox.org/git/0bef1e49-e96b-1666-9b88-f4262c2ae...@alum.mit.edu/

Re: [PATCH v6 09/27] files-backend: add and use files_refname_path()

2017-03-19 Thread Michael Haggerty
lace to be dealing with such errors, and indeed it seems like the check `is_nonbare_repository_dir()` in `get_ref_store()` should make such errors impossible, so I think your change is OK. If you agree, it might be appropriate to mention that reasoning in the commit message. > [...] Michael

Re: [PATCH v6 03/27] files-backend: delete dead code in files_init_db()

2017-03-19 Thread Michael Haggerty
to fix potential permission screwups. > > After 6fb5acfd8f, refs dirs are created after template is copied. Nobody > will change directory permission again. So the extra adjust_shared_perm() > is redudant. Delete them. LGTM. Thanks for the careful research. Michael

Re: [PATCH v6 02/27] files-backend: make files_log_ref_write() static

2017-03-19 Thread Michael Haggerty
> * directory, where dirname is a reference directory name including > You changed the declaration, but the definition still makes the function non-static. Michael

[PATCH 1/2] describe: localize debug output fully

2017-03-17 Thread Michael J Gruber
git describe --debug localizes all debug messages but not the terms head, lightweight, annotated that it outputs for the candidates. Localize them, too. Also, increase the width of that field to create room for the translated terms. Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.

[PATCH 2/2] l10n: de: translate describe debug terms

2017-03-17 Thread Michael J Gruber
Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> --- Junio: this is just a l10n-followup to the previous code patch ;) po/de.po | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/po/de.po b/po/de.po index e9c86f5488..913db393dc 100644 --- a/po

[PATCH] l10n: de: lower case after semi-colon

2017-03-17 Thread Michael J Gruber
Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> --- Just a minor thing. I'm wondering about lower/upper case at the beginning of the line, though. Do we have a rule for de.po? po/de.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/de.po b/po/de.po

Re: Shared repositories no longer securable against privilege escalation

2017-03-17 Thread Michael Haggerty
soft failure. Alternatively, some form of stale > lockfile handling (currently there is none) could be made to work with > a writable HEAD.lock in a read-only bare repository. > > Obigatory HEAD.lock creation was introduced in the following commit: > > commit 92b1551b1d407

Re: [PATCH 2/2] name-rev: favor describing with tags and use committer date to tiebreak

2017-03-17 Thread Michael J Gruber
> hops, without taking the "taggerdate" into account. As we are > taking over the "taggerdate" field to store the committer date for > tips with commits: > > (1) keep the original logic when comparing names based on two refs > both of which are from refs/tags/; > > (2) favoring a name

Re: [PATCH 1/3] describe: debug is incompatible with contains

2017-03-17 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 15.03.2017 20:21: > Michael J Gruber <g...@drmicha.warpmail.net> writes: > >> `git describe --contains` calls into `git name-rev` which does not have >> any searching to do and thus does not display any debug information. >>

Re: [PATCH 2/3] git-prompt: add a describe style for any tags

2017-03-17 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 15.03.2017 20:25: > Michael J Gruber <g...@drmicha.warpmail.net> writes: > >> git-prompt has various describe styles, among them "describe" (by >> annotated tags) and "default" (by exact match with any tag). >

[PATCH 2/3] git-prompt: add a describe style for any tags

2017-03-15 Thread Michael J Gruber
git-prompt has various describe styles, among them "describe" (by annotated tags) and "default" (by exact match with any tag). Add a mode "tag" that describes by any tag, annotated or not. Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> ---

[RFD PATCH 3/3] name-rev: Allow lightweight tags and branch refs

2017-03-15 Thread Michael J Gruber
name (e.g. foo~5) coming from an annotated tag. Instead, assign the commit date to lightweight tags or branch refs so that they get their fair chance of being picked up. Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> --- Originally, I didn't even think of submitting this as is

[PATCH 0/3] describe --contains sanity

2017-03-15 Thread Michael J Gruber
2 patches and 1 RFD around describe (--contains). They are technically independent, but happened along the same stroll in that area when I tried to match documentation, my expectations, and reality. 1 and 2 should be no-brainers. 3 is something to ponder for a while. Michael J Gruber (3

[PATCH 1/3] describe: debug is incompatible with contains

2017-03-15 Thread Michael J Gruber
`git describe --contains` calls into `git name-rev` which does not have any searching to do and thus does not display any debug information. Say so in the documentation and catch the incompatible arguments. Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> --- Documentati

[PATCH] git-status: make porcelain more robust

2017-03-14 Thread Michael J Gruber
Signed-off-by: Michael J Gruber <g...@drmicha.warpmail.net> --- wt-status.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wt-status.c b/wt-status.c index d47012048f..234e77a6d6 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1730,12 +1730,1

Re: Stable GnuPG interface, git should use GPGME

2017-03-14 Thread Michael J Gruber
Bernhard E. Reiter venit, vidit, dixit 13.03.2017 13:49: > Am Montag 13 März 2017 11:14:57 schrieb Michael J Gruber: >> Ævar Arnfjörð Bjarmason venit, vidit, dixit 10.03.2017 15:23: >>> On Fri, Mar 10, 2017 at 11:00 AM, Bernhard E. Reiter > >>>> please consider us

Re: Stable GnuPG interface, git should use GPGME

2017-03-13 Thread Michael J Gruber
ith other things that require gpg. As for the library: While - technically speaking - the command line is not a stable API for gpg, it does work across versions of gpg, and gpg 2.2 will be the first real stable branch that uses the new key store layout. So I'd rather wait for that to stabilize before going away from what turned out to be most stable so far. Note that we (git) refrain from parsing ordinary output/return codes of gpg and use status-fd as we should (and as documented). Michael

Re: [PATCH v5 07/24] files-backend: add and use files_refname_path()

2017-03-09 Thread Michael Haggerty
ath(refs, , dirname); > path_baselen = path.len; > > if (err) { I just noticed another thing. After this change, `err` is never set, so the `if (err)` block (and `err` itself) can be deleted. > [...] Michael

Re: [PATCH v5 24/24] t1406: new tests for submodule ref store

2017-03-03 Thread Michael Haggerty
e other, then maybe some of the setup code could be made to look alike? Then the division could be one test file for the functions that work for both main and submodules, and a second for the functions that only work for main. Just a thought... Michael

Re: [PATCH v5 00/24] Remove submodule from files-backend.c

2017-03-03 Thread Michael Haggerty
uch legwork and added so many tests. Michael

Re: [PATCH v5 23/24] t1405: some basic tests on main ref store

2017-03-03 Thread Michael Haggerty
rev-parse foo` && > + git checkout --detach && > + test_commit bar-commit && > + git checkout -b bar && > + BAR_SHA1=`git rev-parse bar` && > + $RUN update-ref updating refs/heads/foo $BAR_SHA1 $FOO_SHA1 0 && > + echo $BAR_SHA1 >expected && > + git rev-parse refs/heads/foo >actual && > + test_cmp expected actual > +' > + > +test_expect_success 'delete_ref(refs/heads/foo)' ' > + SHA1=`git rev-parse foo` && > + git checkout --detach && > + $RUN delete-ref refs/heads/foo $SHA1 0 && > + test_must_fail git rev-parse refs/heads/foo -- > +' The last two tests have the same name. You might also want to test these functions when the old oid is incorrect or when the reference is missing. > +test_done Thanks for all the new tests! Michael

Re: [PATCH v5 20/24] files-backend: avoid ref api targetting main ref store

2017-03-03 Thread Michael Haggerty
ve_ref_unsafe(ref_store, "HEAD", > +RESOLVE_REF_NO_RECURSE, > +head_oid.hash, _type); > + head_ref = xstrdup_or_null(head_ref); If you combine the last two statements, you can avoid the ugly cast. > [...] Michael

Re: [PATCH v5 19/24] refs: new transaction related ref-store api

2017-03-03 Thread Michael Haggerty
t see a strong argument for one vs. the other. It might be more natural to make `delete_pseudoref()` take a `refs` argument and do the check internally. (Same comments below where `write_pseudoref()` is called.) Michael > return delete_pseudoref(refname, old_sha1); > +

Re: [PATCH v5 16/24] files-backend: replace submodule_allowed check in files_downcast()

2017-03-03 Thread Michael Haggerty
fs = > + files_downcast(ref_store, REF_STORE_READ | REF_STORE_ODB, > +"peel_ref"); > int flag; > unsigned char base[20]; > > + files_assert_main_repository(refs, "peel_ref"); Instead of this call, couldn't you add `REF_STORE_MAIN` to the flags passed to `files_downcase()`? > + > if (current_ref_iter && current_ref_iter->refname == refname) { > struct object_id peeled; > > [...] Michael

Re: [PATCH v5 15/24] refs: move submodule code out of files-backend.c

2017-03-03 Thread Michael Haggerty
- return ref_store; > - } > - > refs->gitdir = xstrdup(gitdir); > get_common_dir_noenv(, gitdir); > refs->gitcommondir = strbuf_detach(, NULL); > @@ -1014,8 +1000,7 @@ static struct ref_store *files_ref_store_create(const > char *submodule) > static void files_assert_main_repository(struct files_ref_store *refs, >const char *caller) > { > - if (refs->submodule) > - die("BUG: %s called for a submodule", caller); > + /* This function is to be deleted in the next patch */ I don't think the above comment is correct anymore. Possibly the commit log message is also out of date too, but I haven't read far enough ahead to know. > [...] Michael

Re: [PATCH v5 24/24] t1406: new tests for submodule ref store

2017-03-02 Thread Michael Haggerty
On 03/02/2017 07:13 AM, Duy Nguyen wrote: > On Wed, Mar 1, 2017 at 10:11 PM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >> By trial and error, I found that the test succeeds if I comment out the >> "for_each_reflog()" test. By having that test write its res

Re: [PATCH v5 24/24] t1406: new tests for submodule ref store

2017-03-01 Thread Michael Haggerty
On 03/01/2017 01:34 PM, Duy Nguyen wrote: > On Wed, Mar 1, 2017 at 12:34 AM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >> On 02/22/2017 03:04 PM, Nguyễn Thái Ngọc Duy wrote: >>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com> >>> --- &

Re: [PATCH v5 12/24] refs.c: kill register_ref_store(), add register_submodule_ref_store()

2017-03-01 Thread Michael Haggerty
On 03/01/2017 01:00 PM, Duy Nguyen wrote: > On Wed, Mar 1, 2017 at 1:03 AM, Michael Haggerty <mhag...@alum.mit.edu> wrote: >>> struct ref_store *get_ref_store(const char *submodule) >>> { >>> struct strbuf submodule_sb = STRBUF_INIT; >&g

Re: [PATCH v5 14/24] path.c: move some code out of strbuf_git_path_submodule()

2017-02-28 Thread Michael Haggerty
> diff --git a/submodule.h b/submodule.h > index 05ab674f0..fc3d0303e 100644 > --- a/submodule.h > +++ b/submodule.h > @@ -81,6 +81,7 @@ extern int push_unpushed_submodules(struct sha1_array > *commits, > int dry_run); > extern void connect_work_tree_and_git_dir(const char *work_tree, const char > *git_dir); > extern int parallel_submodules(void); > +int submodule_to_gitdir(struct strbuf *buf, const char *submodule); A docstring is always nice :-) > > /* > * Prepare the "env_array" parameter of a "struct child_process" for > executing > Michael

Re: [PATCH v5 00/24] Remove submodule from files-backend.c

2017-02-28 Thread Michael Haggerty
On 02/22/2017 03:04 PM, Nguyễn Thái Ngọc Duy wrote: > v5 goes a bit longer than v4, basically: I've read through patch 14/24 so far, and they all look good except for the mostly superficial comments that I have sent so far. I like the way this is heading! I'll try to continue tomorrow. Michael

Re: [PATCH v5 13/24] refs.c: make get_main_ref_store() public and use it

2017-02-28 Thread Michael Haggerty
d to operate directly on ref stores. Nice. Michael

Re: [PATCH v5 12/24] refs.c: kill register_ref_store(), add register_submodule_ref_store()

2017-02-28 Thread Michael Haggerty
*get_ref_store(const char *submodule) > { > struct strbuf submodule_sb = STRBUF_INIT; > @@ -1480,6 +1479,9 @@ struct ref_store *get_ref_store(const char *submodule) > if (is_nonbare_repository_dir(_sb)) > refs = ref_store_init(submodule); > strbuf_release(_sb); > + > + if (refs) I think `refs` should always be non-NULL here for the same reason. > + register_submodule_ref_store(refs, submodule); > return refs; > } Michael

Re: [PATCH v5 08/24] files-backend: remove the use of git_path()

2017-02-28 Thread Michael Haggerty
fs, > return; > } > > - strbuf_git_path(sb, "%s", refname); > + switch (ref_type(refname)) { > + case REF_TYPE_PER_WORKTREE: > + case REF_TYPE_PSEUDOREF: > + strbuf_addf(sb, "%s/%s", refs->gitdir, refname); > + break; > + case REF_TYPE_NORMAL: > + strbuf_addf(sb, "%s/%s", refs->gitcommondir, refname); > + break; > + default: > + die("BUG: unknown ref type %d of ref %s", > + ref_type(refname), refname); > + } > } > > /* > Michael

Re: [PATCH v5 09/24] refs.c: introduce get_main_ref_store()

2017-02-28 Thread Michael Haggerty
+ if (main_ref_store) > + return main_ref_store; > + > + refs = ref_store_init(NULL); > + return refs; Unnecessary temporary variable? > [...] Michael

Re: [PATCH v5 07/24] files-backend: add and use files_refname_path()

2017-02-28 Thread Michael Haggerty
h_submodule(, refs->submodule, "%s", > dirname); > - else > - strbuf_git_path(, "%s", dirname); > + files_refname_path(refs, , dirname); It's so nice to see these ugly `if (refs->submodule)` code blocks disappearing! > [...] Michael

Re: [PATCH v5 24/24] t1406: new tests for submodule ref store

2017-02-28 Thread Michael Haggerty
ticed that a test in this file fails: t1406-submodule-ref-store.sh (Wstat: 256 Tests: 15 Failed: 1) Failed test: 10 Non-zero exit status: 1 I didn't have time to look into it more; let me know if you can't reproduce it. Michael

Re: [PATCH v5 05/24] files-backend: move "logs/" out of TMP_RENAMED_LOG

2017-02-28 Thread Michael Haggerty
sed use of worktrees is that the worktree might live far from the main directory, or even on removable media. But it's not possible to rename files across partitions. Maybe this will come out in the wash once worktrees are ref_stores themselves. For that matter, what if a user tries to rename a worktree ref into a common ref or vice versa? > if (delete_ref(oldrefname, orig_sha1, REF_NODEREF)) { > [...] Michael

Re: [PATCH v5 04/24] files-backend: convert git_path() to strbuf_git_path()

2017-02-28 Thread Michael Haggerty
gt; + safe_create_dir(sb.buf, 1); > + strbuf_reset(); > + strbuf_git_path(, "refs/tags"); > + safe_create_dir(sb.buf, 1); > + strbuf_reset(); > if (get_shared_repository()) { > - adjust_shared_perm(git_path("refs/heads")); > - adjust_shared_perm(git_path("refs/tags")); > + strbuf_git_path(, "refs/heads"); > + adjust_shared_perm(sb.buf); > + strbuf_reset(); > + strbuf_git_path(, "refs/tags"); > + adjust_shared_perm(sb.buf); > } > + strbuf_release(); > return 0; > } It looks to me like `safe_create_dir()` already has the ability to `adjust_shared_perm()`, or am I missing something? (I realize that this is preexisting code.) Michael

Re: show all merge conflicts

2017-02-27 Thread Michael J Gruber
merged cleanly but someone did a "git commit --amend" to > make it the merge dirty after the fact. > > I do like your approach, it's very simple and reliable. But in my > situation I'm writing pre-receive hooks for bare repos, so I don't > think I can actually do "git merge"! > > I think my suggestion would work for OP, as long as they also run "git > show -c" alongside it. (And your suggestion would work, too, of > course). If you're curious, I kept rebasing Thomas' remerge-diff (on top of our next) so far. You can find it at https://github.com/mjg/git/tree/remerge-diff if you're interested. I don't know what problems were found back then, or what it would take to get this in-tree now. Michael

Reference for quote "creating branch is not the issue, merging is", in context of Subversion/Git

2017-02-26 Thread Michael Hüttermann
icle where Linus elaborated on this? Thanks for your help. Kind regards Michael

Re: [PATCH v4 00/15] Remove submodule from files-backend.c

2017-02-20 Thread Michael Haggerty
ion to my design comments before doing so. Thanks, Michael

Re: [PATCH v4 11/15] refs.c: make get_main_ref_store() public and use it

2017-02-20 Thread Michael Haggerty
le_ref_store()`, added in a later patch) in refs/refs-internal.h for now. If you want to move the declarations straight to `refs.h` now to avoid code churn in some later patch series, then please mention that fact in the commit message. Michael

Re: [PATCH v4 14/15] files-backend: remove submodule_allowed from files_downcast()

2017-02-20 Thread Michael Haggerty
On 02/20/2017 01:33 PM, Duy Nguyen wrote: > On Mon, Feb 20, 2017 at 7:30 PM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >> On 02/20/2017 01:21 PM, Duy Nguyen wrote: >>> On Mon, Feb 20, 2017 at 7:11 PM, Michael Haggerty <mhag...@alum.mit.edu> >>> w

Re: [PATCH v4 14/15] files-backend: remove submodule_allowed from files_downcast()

2017-02-20 Thread Michael Haggerty
On 02/20/2017 01:21 PM, Duy Nguyen wrote: > On Mon, Feb 20, 2017 at 7:11 PM, Michael Haggerty <mhag...@alum.mit.edu> > wrote: >> On 02/18/2017 02:33 PM, Nguyễn Thái Ngọc Duy wrote: >>> Since submodule or not is irrelevant to files-backend after the last >>&

Re: [PATCH v4 14/15] files-backend: remove submodule_allowed from files_downcast()

2017-02-20 Thread Michael Haggerty
troduced a boolean "main_repository" flag in `struct ref_store`, and use that member to implement `files_assert_main_repository()`. That way `files_ref_store::submodule` can still be removed, which is the more important goal from a design standpoint. Michael

Re: [PATCH v4 06/15] files-backend: remove the use of git_path()

2017-02-20 Thread Michael Haggerty
, )) { /* reflog */ > + if (is_per_worktree_ref(ref)) > + strbuf_addf(sb, "%s/%s", refs->gitdir.buf, tmp.buf); > + else > + strbuf_addf(sb, "%s/%s", refs->gitcommondir.buf, > tmp.buf); This code would also be simpler if there were separate functions for packed-refs, loose references, and reflogs. > [...] Michael

Re: [PATCH v2 04/16] files-backend: replace *git_path*() with files_path()

2017-02-20 Thread Michael Haggerty
ple so that reference names that differ only in case can be stored on a case-insensitive filesystem, or to store reflogs using a naming scheme that is not susceptible to D/F conflicts so that we can retain reflogs for deleted references. Michael [1] The only exception I see is one call `files_pa

Re: git alias for options

2017-02-17 Thread Michael J Gruber
liased to `status -s -b -uno .' As you see here, this can include non-option arguments such as the pathsepc '.'. You cannot alias options independent of the command, though. Michael

Re: [PATCH] tempfile: avoid "ferror | fclose" trick

2017-02-17 Thread Michael Haggerty
fclose(fp); > > does the same thing. True; I'd forgotten the convention that non-failing functions are allowed to change errno. Your solution is obviously simpler and faster. Michael

Re: [PATCH v2 00/19] object_id part 6

2017-02-17 Thread Michael Haggerty
rious. I'm curious; what fraction of the overall convert-to-object_id campaign do you estimate is done so far? Are you getting close to the promised land yet? Michael

Re: [PATCH v2 15/19] refs: simplify parsing of reflog entries

2017-02-17 Thread Michael Haggerty
't it? Also, I think instead of the initial test `sb->len < minlen`, it would be enough to check `!sb->len` (i.e., error if it's zero to avoid a buffer underflow in `sb->buf[sb->len - 1])`, because the `parse_oid_hex()` calls together with the `*p++ != ' '` and `sb->buf[sb->len - 1] != '\n'` checks already ensure that the string has at least the minimum length. Then you could do away with `minlen` entirely. Michael

Re: [PATCH v2 14/19] hex: introduce parse_oid_hex

2017-02-17 Thread Michael Haggerty
; makes it sound like the function might be satisfied with fewer than 40 characters. Finally, you might mention the useful fact that `p` is only updated if the function succeeds. > [...] Michael

Re: [PATCH v2 11/19] builtin/replace: convert to struct object_id

2017-02-17 Thread Michael Haggerty
bject_oid. > [...] Michael

Re: [PATCH] tempfile: avoid "ferror | fclose" trick

2017-02-17 Thread Michael Haggerty
we don't know the correct errno from the error reported by ferror(), so maybe the fclose() errno is more likely to hint at the underlying reason for the failure. So I (reluctantly) propose if (ferror(fp)) { if (!fclose(fp)) { /* * ferror() doesn't set errno, so we have to * set one. (By contrast, when fclose() fails * too, we leave *its* errno in place.) */ errno = EIO; } return -1; } return fclose(); Michael

Re: [PATCH v2 9/9] read_loose_refs(): read refs using resolve_ref_recursively()

2017-02-12 Thread Michael Haggerty
On 02/10/2017 08:22 PM, Junio C Hamano wrote: > Michael Haggerty <mhag...@alum.mit.edu> writes: >> [...] > > OK, but one thing puzzles me... > >> @@ -1390,27 +1390,6 @@ static struct ref_store *main_ref_store; >> static struct hashmap submodule_r

[PATCH v2 5/9] refs: store submodule ref stores in a hashmap

2017-02-10 Thread Michael Haggerty
Aside from scaling better, this means that the submodule name needn't be stored in the ref_store instance anymore (which will be changed in a moment). This, in turn, will help loosen the strict 1:1 relationship between ref_stores and submodules. Signed-off-by: Michael Haggerty <m

[PATCH v2 9/9] read_loose_refs(): read refs using resolve_ref_recursively()

2017-02-10 Thread Michael Haggerty
resolve_ref_recursively() to be exposed to the refs subsystem, though not to non-refs code. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 50 +- refs/files-backend.c | 18 -- refs/refs-internal.h | 5 ++

[PATCH v2 1/9] refs: reorder some function definitions

2017-02-10 Thread Michael Haggerty
This avoids the need to add forward declarations in the next step. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 64 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/refs.c b/refs.c

[PATCH v2 4/9] register_ref_store(): new function

2017-02-10 Thread Michael Haggerty
Move the responsibility for registering the ref_store for a submodule from base_ref_store_init() to a new function, register_ref_store(). Call the latter from ref_store_init(). Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 43 +---

[PATCH v2 6/9] refs: push the submodule attribute down

2017-02-10 Thread Michael Haggerty
Push the submodule attribute down from ref_store to files_ref_store. This is another step towards loosening the 1:1 connection between ref_stores and submodules. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 11 -- refs/files-backend.

[PATCH v2 3/9] refs: remove some unnecessary handling of submodule == ""

2017-02-10 Thread Michael Haggerty
The only external entry point to the ref_store lookup functions is get_ref_store(), which ensures that submodule == "" is passed along as NULL. So ref_store_init() and lookup_ref_store() don't have to handle submodule being specified as the empty string. Signed-off-by: Michael Hagg

[PATCH v2 7/9] base_ref_store_init(): remove submodule argument

2017-02-10 Thread Michael Haggerty
This is another step towards weakening the 1:1 relationship between ref_stores and submodules. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 3 +-- refs/files-backend.c | 2 +- refs/refs-internal.h | 7 +++ 3 files changed, 5 insertions(+), 7 del

[PATCH v2 8/9] files_ref_store::submodule: use NULL for the main repository

2017-02-10 Thread Michael Haggerty
oring NULL for this case is more idiomatic and a tiny bit less code. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs/files-backend.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index c9d2d28

[PATCH v2 2/9] refs: make some ref_store lookup functions private

2017-02-10 Thread Michael Haggerty
The following functions currently don't need to be exposed: * ref_store_init() * lookup_ref_store() That might change in the future, but for now make them private. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 19 +-- refs/refs-inte

[PATCH v2 0/9] Store submodules in a hash, not a linked list

2017-02-10 Thread Michael Haggerty
le hashmap (the default is OK). This patch series is also available from my fork on GitHub [2] as branch "submodule-hash". Michael [1] http://public-inbox.org/git/cover.1486629195.git.mhag...@alum.mit.edu/T/#u [2] https://github.com/mhagger/git Michael Haggerty (9): refs: reorder some

Re: [PATCH 0/5] Store submodules in a hash, not a linked list

2017-02-10 Thread Michael Haggerty
On 02/10/2017 01:40 AM, Jeff King wrote: > On Thu, Feb 09, 2017 at 10:23:35PM +0100, Michael Haggerty wrote: > >>>> So push the submodule attribute down to the `files_ref_store` class >>>> (but continue to let the `ref_store`s be looked up by submodule). >>

Re: [PATCH 1/5] refs: store submodule ref stores in a hashmap

2017-02-10 Thread Michael Haggerty
On 02/09/2017 09:34 PM, Junio C Hamano wrote: > Michael Haggerty <mhag...@alum.mit.edu> writes: >> [...] >> +static int submodule_hash_cmp(const void *entry, const void *entry_or_key, >> + const void *keydata) >> +{ >> +const

Re: [PATCH 0/5] Store submodules in a hash, not a linked list

2017-02-09 Thread Michael Haggerty
On 02/09/2017 08:58 PM, Jeff King wrote: > On Thu, Feb 09, 2017 at 02:26:57PM +0100, Michael Haggerty wrote: > [...] >> A `files_ref_store` would be perfectly happy to represent, say, the >> references *physically* stored in a linked worktree (e.g., `HEAD`, >> `refs/bis

Re: [PATCH 3/5] register_ref_store(): new function

2017-02-09 Thread Michael Haggerty
On 02/09/2017 06:20 PM, Stefan Beller wrote: > On Thu, Feb 9, 2017 at 5:27 AM, Michael Haggerty <mhag...@alum.mit.edu> wrote: >> Move the responsibility for registering the ref_store for a submodule >> from base_ref_store_init() to a new function, register_ref_store(). Ca

Re: [PATCH 1/5] refs: store submodule ref stores in a hashmap

2017-02-09 Thread Michael Haggerty
g etc.) I suppose this code path could be changed to return NULL without initializing the hashmap, but the hashmap will be initialized a moment later by ref_store_init(), so I don't see much difference either way. Thanks for your review! Michael

Re: What's cooking in git.git (Feb 2017, #02; Mon, 6)

2017-02-09 Thread Michael Haggerty
far. Now we do. > > Expecting a reroll. > cf. <5051c78e-51f9-becd-e1a6-9c0b781d6...@alum.mit.edu> I think you missed v4 of this patch series [1], which is the re-roll that you were waiting for. And I missed that you missed it... Michael [1] http://public-inbox.org/git/cover.1483719289.git.mhag...@alum.mit.edu/

Re: Bug with fixup and autosquash

2017-02-09 Thread Michael J Gruber
indicate that rebase is fine as is? How about: - introduce "git commit --fixup-fixed=" or the like which parses commits "-m fixup! " - teach "git commit --fixup=" to check for duplicates (same prefix, maybe only in "recent" history) and make it issue a warning, say: prefix matches the following commits: Issue git commit --amend -m 'fixup! ' to fixup a specific commit. (Or git commit --amend --fixup-fixed= if that flies.) Additionally, we could teach commit --fixup-fixed to commit -m "fixup! " so that we have both uniqueness and verbosity in the rebase-i-editor. This would allow "rebase -i" to fall back to the old mode when "" is not in the range it operates on. We could also try to rewrite s when rebasing (without squashing) fixup!-commits, of course. Michael

Re: [RFD] should all merge bases be equal?

2017-02-09 Thread Michael Haggerty
e who use less disciplined workflows than git.git or the Linux kernel. For example, many people merge a lot more frequently and chaotically, maybe even with the parents reversed from the canonical order. Anyway, I mostly wanted to remind you of the earlier discussion of this topic. There's a lot m

Re: [PATCH 2/2] worktree.c: use submodule interface to access refs from another worktree

2017-02-09 Thread Michael Haggerty
On 02/09/2017 12:59 PM, Duy Nguyen wrote: > On Thu, Feb 9, 2017 at 1:07 PM, Michael Haggerty <mhag...@alum.mit.edu> wrote: >> It is unquestionably a good goal to avoid parsing references outside of >> `refs/files-backend.c`. But I'm not a fan of this approach. > &g

[PATCH 2/5] refs: push the submodule attribute down

2017-02-09 Thread Michael Haggerty
Push the submodule attribute down from ref_store to files_ref_store. This is another step towards loosening the 1:1 connection between ref_stores and submodules. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 9 refs/files-backend.

[PATCH 4/5] files_ref_store::submodule: use NULL for the main repository

2017-02-09 Thread Michael Haggerty
oring NULL for this case is more idiomatic and a tiny bit less code. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs/files-backend.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 794b88c

[PATCH 5/5] read_loose_refs(): read refs using resolve_ref_recursively()

2017-02-09 Thread Michael Haggerty
resolve_ref_recursively() to be exposed to the refs subsystem, though not to non-refs code. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 8 refs/files-backend.c | 18 -- refs/refs-internal.h | 5 + 3 files changed, 13 insertions(+), 18 del

[PATCH 0/5] Store submodules in a hash, not a linked list

2017-02-09 Thread Michael Haggerty
ely() directly using the `ref_store` instance that it already has in hand, rather than indirectly via the public wrappers. Michael [1] http://public-inbox.org/git/341999fc-4496-b974-c117-c18a2fca1...@alum.mit.edu/ [2] http://public-inbox.org/git/37fe2024-0378-a974-a28d-18a89d3e2...@alum.mit.edu/ [3] https:

[PATCH 1/5] refs: store submodule ref stores in a hashmap

2017-02-09 Thread Michael Haggerty
Aside from scaling better, this means that the submodule name needn't be stored in the ref_store instance anymore (which will be changed in a moment). This, in turn, will help loosen the strict 1:1 relationship between ref_stores and submodules. Signed-off-by: Michael Haggerty <m

[PATCH 3/5] register_ref_store(): new function

2017-02-09 Thread Michael Haggerty
ref_stores and submodules. Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu> --- refs.c | 19 +-- refs/files-backend.c | 2 +- refs/refs-internal.h | 15 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index 7

Re: [PATCH 2/2] worktree.c: use submodule interface to access refs from another worktree

2017-02-09 Thread Michael Haggerty
On 02/09/2017 07:55 AM, Junio C Hamano wrote: > Michael Haggerty <mhag...@alum.mit.edu> writes: > >> There are two meanings of the concept of a "ref store", and I think this >> change muddles them: >> >> 1. The references that happen to be *phy

Re: [PATCH 2/2] worktree.c: use submodule interface to access refs from another worktree

2017-02-08 Thread Michael Haggerty
est solution would be to expose the concept of `ref_store` in the public refs API. Then users of submodules would essentially do struct ref_store *refs = get_submodule_refs(submodule_path); ... resolve_ref_recursively(refs, refname, 0, sha1, ) ... ... for_each_ref(refs, fn, cb_data) ... whereas for a worktree

Re: [PATCH 1/2] refs.c: add resolve_ref_submodule()

2017-02-08 Thread Michael Haggerty
submodule() assume that its submodule name is already clean? It would be nice to have a docstring here. I also have some higher-level concerns about the approach of this patch series, which I'll write about in a comment to patch 2/2. Michael

Re: [git-users] More on that "merge branch checkout" problem -- cannot abort/go back?

2017-01-31 Thread Michael
y #2: The three versions in the conflict file were "nothing" (the old develop that had none of these changes), "what was checked in" (the feature branch), and "everything"; what I wanted was "everything - what was checked in" (which is what git diff r

show all merge conflicts

2017-01-27 Thread Michael Spiegel
merge and a merge conflict that is resolved by with the changes from one the parents? Thanks, --Michael

Re: The design of refs backends, linked worktrees and submodules

2017-01-19 Thread Michael Haggerty
eferences. I've taken some stabs at picking these apart into separate ref stores, but haven't had time to make very satisfying progress. By the time of GitMerge I might have a better feeling for whether I can devote some time to this project. Michael [1] https://github.com/mhagger/git

problem with insider build for windows and git

2017-01-12 Thread Michael Gooch
when running commands like pull and clone I get the following message: Cygwin WARNING: Couldn't compute FAST_CWD pointer. This typically occurs if you're using an older Cygwin version on a newer Windows. Please update to the latest available Cygwin version from https://cygwin.com/. If

Re: [ANNOUNCE] git-test: run automated tests against a range of Git commits

2017-01-11 Thread Michael Haggerty
On 01/10/2017 10:35 AM, Jeff King wrote: > On Sun, Jan 08, 2017 at 10:52:25AM +0100, Michael Haggerty wrote: >> [...] Since my last email, I have implemented a bunch of what we discussed [1]. Because of the new semantics, I also *renamed the main command* from git t

Re: [RFC PATCH 0/5] Localise error headers

2017-01-09 Thread Michael J Gruber
Jeff King venit, vidit, dixit 04.01.2017 08:05: > On Mon, Jan 02, 2017 at 12:14:49PM +0100, Michael J Gruber wrote: > >> Currently, the headers "error: ", "warning: " etc. - generated by die(), >> warning() etc. - are not localized, but

<    3   4   5   6   7   8   9   10   11   12   >