All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	Git List <git@vger.kernel.org>, Mike Hommey <mh@glandium.org>,
	Johan Herland <johan@herland.net>,
	Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: [PATCH 1/2] notes: don't expand qualified refs in expand_notes_ref
Date: Tue, 22 Sep 2015 11:37:57 -0700	[thread overview]
Message-ID: <xmqqa8se47wa.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CA+P7+xrwM44tMHMW+dEJx_tMtcMVEQELNq=J=rqs1uQ+feuZqQ@mail.gmail.com> (Jacob Keller's message of "Tue, 22 Sep 2015 10:54:12 -0700")

Jacob Keller <jacob.keller@gmail.com> writes:

> The other issue here is that expand_notes_ref is called on the --ref
> argument waaay before the current code even decides if the operation
> is "read" or "write". Thus we'd have to break this out and handle
> things very differently.

I think you hit the right nail here.  The handling of --ref argument
is what you need to adjust to the new world order.

And "safety" is a red herring.  Those who are used to run

	git log --notes=refs/heads/master

and relies on it to refer to refs/notes/refs/heads/master must
continue to be able to do so.  Changing expand_notes_ref() the
way the proposed patch does will break them, won't it?  "safety"
is not the only (or even the primary) requirement, but the
correctness must also be kept.

> It seems like a lot more heavy lifting to change the entire flow of
> how we decide when to expand "--ref" for "read" operations vs "write"
> operations.
>
> That is, git notes list.
>
> It's easy to change behavior of git notes merge as it handles its
> argument for where to merge from separately, but it's not so easy to
> change git notes show...

Yes, exactly.

I am _more than_ OK to see that read-only accesses to the notes tree
allowed anything under refs/ (like the proposed patch did) and also
a raw 40-hex object name in the endgame, but I really would not want
to see "we meant well and attempted to enhance 'notes merge' but we
ended up regressing the behaviour of unrelated operations all of a
sudden".

If you cannot do your change without breaking the existing users,
then you at least need a sound transition plan.  But I am not sure
yet if you have to break the world (yet).  Let me think aloud a bit
more.

There aren't all that many callers of expand_notes_ref().

My preference is to leave that function as-is, especially keep the
behaviour of the caller in revision.c that handles --show-notes=
(and --notes= that is its synonym) the same as before.

All the other callers are only reachable from the codepath that
originates from cmd_notes(), if I am reading the code correctly, and
that can be enhanced without breaking the existing users.  One
obvious way to do so would be to make "--ref" to keep the call to
expand_notes_ref(), and add another "--notes-rawref" or whatever
option that does not restrict it to "refs/notes", but there may be
other ways.

  reply	other threads:[~2015-09-22 18:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 22:06 [PATCH 0/2] notes: allow read only notes actions on refs outside of refs/notes Jacob Keller
2015-09-16 22:06 ` [PATCH 1/2] notes: don't expand qualified refs in expand_notes_ref Jacob Keller
2015-09-16 22:34   ` Junio C Hamano
2015-09-16 23:00     ` Jacob Keller
2015-09-22  6:50     ` Jacob Keller
2015-09-22 14:17       ` Junio C Hamano
2015-09-22 15:26         ` Jacob Keller
2015-09-22 17:54         ` Jacob Keller
2015-09-22 18:37           ` Junio C Hamano [this message]
2015-09-22 18:48             ` Jacob Keller
2015-09-16 22:06 ` [PATCH 2/2] notes: allow non-writable actions on refs outside of refs/notes Jacob Keller
2015-09-16 22:36 ` [PATCH 0/2] notes: allow read only notes " Mike Hommey
2015-09-16 23:01   ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa8se47wa.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    --cc=johan@herland.net \
    --cc=mh@glandium.org \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.