From: Jonathan Nieder <jrnieder@gmail.com>
To: Johan Herland <johan@herland.net>
Cc: git@vger.kernel.org, bebarino@gmail.com, gitster@pobox.com
Subject: Re: [PATCH 08/18] git notes merge: Initial implementation handling trivial merges only
Date: Sat, 9 Oct 2010 12:29:55 -0500 [thread overview]
Message-ID: <20101009172955.GB17799@burratino> (raw)
In-Reply-To: <201010090155.20858.johan@herland.net>
Johan Herland wrote:
> I agree, but I'd like to name it 'git notes get-ref' instead, to stay
> consistent with the current subcommand (instead of option) design.
Sounds good. :)
> Jonathan Nieder wrote:
>> I would find it easier to read
>>
>> if (o->verbosity >= DEFAULT_VERBOSITY)
>> fprintf(stderr, ...)
>>
>> unless there are going to be a huge number of messages.
>
> The current version is modeled on the show() and output() functions in
> merge-recursive.c. I think that works better in this situation.
> Or maybe you have a better solution for merge-recursive.c as well?
Hmm --- isn't the point of output() that it indents to the appropriate
level to portray a recursive merge?
Similarly, show() prevents those confusing messages from the internal
merge between ancestors from being printed when the user is not
interested.
But if you think they are important abstractions to maintain, I won't
stop you. :)
>>> +
>>> + if (!o->local_ref || get_sha1(o->local_ref, local_sha1)) {
>>> + /* empty notes ref => assume empty notes tree */
[...]
> I'm not sure when you think we should (or shouldn't) error out.
get_sha1() can return -1 in the following cases:
- starts with :/, regex does not match.
- starts with :, entry not present in index
- in form <rev>:<path>, <path> does not exist in <rev>
- in form <rev>^, <rev> does not exist or that parent does not
exist
- tag being used as commit points to a tree instead
- et c.
Especially if the caller tries
git notes merge 'afjkdlsa^{gobbledeegook'
I would not like the merge to succeed.
So as I see it, there are four cases:
- get_sha1() succeeds and returns a commit ==> merge that rev
- get_sha1() succeeds and returns a non-commit ==> fail
- get_sha1() fails, but resolve_ref() indicates a ref valid
for writing ==> merge empty tree
- get_sha1() fails, invalid refname ==> fail
The current code does not notice case 4, does it?
> I guess this becomes a discussion of whether we should model notes
> merges on the 'resolve' merge strategy or the 'recursive' merge
> strategy. Without having studied each strategy in-depth, I don't know
> how much "better" 'recursive' is than 'resolve', especially not from
> the POV of notes merges.
I think 'resolve' should be good enough for now. We can always add
'recursive' later.
The cases where 'recursive' might help are those in which both sides
made a lot of changes to the same notes. It helps in two ways:
signaling conflicts that might have been otherwise missed and merging
cleanly in cases that might otherwise produce spurious conflicts.
In theory, it makes the result less "arbitrary"; in practice, it seems
to help avoid some conflicts in ugly cases like merging one week's pu
with the next week's pu.
[...]
> Almost. If you look at the notes_merge() docs in notes-merge.h by the
> end of this series, you'll see the following return values:
>
> 0: Merge trivially succeeded in an existing commit (e.g. fast-forward).
>
> 1: Merge successfully completes a merge commit (i.e. no conflicts).
>
> -1: Merge results is conflicts.
What kind of caller would care about the distinction between 1 and -1
here (just curious)?
Jonathan
next prev parent reply other threads:[~2010-10-09 17:33 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-29 0:23 [PATCH 00/18] git notes merge Johan Herland
2010-09-29 0:23 ` [PATCH 01/18] (trivial) notes.h: Minor documentation fixes to copy_notes() Johan Herland
2010-10-05 14:55 ` Jonathan Nieder
2010-10-05 15:22 ` Johan Herland
2010-10-05 15:26 ` Jonathan Nieder
2010-09-29 0:23 ` [PATCH 02/18] notes.h: Make default_notes_ref() available in notes API Johan Herland
2010-09-29 0:23 ` [PATCH 03/18] notes.h/c: Clarify the handling of notes objects that are == null_sha1 Johan Herland
2010-10-05 15:21 ` Jonathan Nieder
2010-10-05 22:30 ` Johan Herland
2010-09-29 0:23 ` [PATCH 04/18] notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond Johan Herland
2010-10-05 15:38 ` Jonathan Nieder
2010-10-06 19:40 ` Johan Herland
2010-09-29 0:23 ` [PATCH 05/18] (trivial) t3303: Indent with tabs instead of spaces for consistency Johan Herland
2010-09-29 0:23 ` [PATCH 06/18] notes.c: Use two newlines (instead of one) when concatenating notes Johan Herland
2010-09-29 0:23 ` [PATCH 07/18] builtin/notes.c: Split notes ref DWIMmery into a separate function Johan Herland
2010-10-05 15:50 ` Jonathan Nieder
2010-10-07 13:56 ` Johan Herland
2010-09-29 0:23 ` [PATCH 08/18] git notes merge: Initial implementation handling trivial merges only Johan Herland
2010-10-07 4:37 ` Test script style (Re: [PATCH 08/18] git notes merge: Initial implementation handling trivial merges only) Jonathan Nieder
2010-10-07 4:57 ` Junio C Hamano
2010-10-07 6:24 ` [PATCH 08/18] git notes merge: Initial implementation handling trivial merges only Jonathan Nieder
2010-10-08 23:55 ` Johan Herland
2010-10-09 17:29 ` Jonathan Nieder [this message]
2010-10-21 2:12 ` Johan Herland
2010-09-29 0:23 ` [PATCH 09/18] builtin/notes.c: Refactor creation of notes commits Johan Herland
2010-09-29 0:23 ` [PATCH 10/18] git notes merge: Handle real, non-conflicting notes merges Johan Herland
2010-09-29 16:20 ` Ævar Arnfjörð Bjarmason
2010-09-29 23:25 ` Johan Herland
2010-09-29 0:23 ` [PATCH 11/18] git notes merge: Add automatic conflict resolvers (ours, theirs, union) Johan Herland
2010-10-02 9:14 ` Stephen Boyd
2010-10-04 15:10 ` Johan Herland
2010-09-29 0:23 ` [PATCH 12/18] Documentation: Preliminary docs on 'git notes merge' Johan Herland
2010-10-02 8:55 ` Stephen Boyd
2010-10-04 15:15 ` Johan Herland
2010-09-29 0:23 ` [PATCH 13/18] git notes merge: Manual conflict resolution, part 1/2 Johan Herland
2010-09-29 0:23 ` [PATCH 14/18] git notes merge: Manual conflict resolution, part 2/2 Johan Herland
2010-09-29 16:19 ` Ævar Arnfjörð Bjarmason
2010-09-29 23:37 ` Johan Herland
2010-09-29 0:23 ` [PATCH 15/18] git notes merge: List conflicting notes in notes merge commit message Johan Herland
2010-09-29 0:23 ` [PATCH 16/18] git notes merge: --commit should fail if underlying notes ref has moved Johan Herland
2010-09-29 0:23 ` [PATCH 17/18] git notes merge: Add another auto-resolving strategy: "cat_sort_uniq" Johan Herland
2010-09-29 0:23 ` [PATCH 18/18] git notes merge: Add testcases for merging notes trees at different fanouts Johan Herland
2010-09-29 14:56 ` [PATCH 00/18] git notes merge Sverre Rabbelier
2010-09-29 15:16 ` Johan Herland
2010-09-29 15:20 ` Sverre Rabbelier
2010-09-29 16:04 ` Johan Herland
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=20101009172955.GB17799@burratino \
--to=jrnieder@gmail.com \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johan@herland.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).