notes: add notes.merge strategy option
v2 cover notes: add notes.merge strategy option
From: Jacob Keller <[email protected]>
This series adds a default merge strategy option for git-notes, so that the user does not have to type "-s" every time. It is overridden by the -s option.
I also added some tests to ensure that the "--abort" "--commit" and "-s" options must be independent. In addition, I found a small documentation bug which is corrected in the first patch of the series.
I Cc'd a couple more people in this version of the patch in order to hopefully get some more review. This is based on pu incase there were any other conflicts, but I can easily rebase if necessary.
Jacob Keller (2):
notes: document cat_sort_uniq rewriteMode
notes: add notes.merge option to select default strategy
Documentation/config.txt | 11 +++++-- Documentation/git-notes.txt | 33 +++++++++++++-------- builtin/notes.c | 55 +++++++++++++++++++++++++---------- notes-merge.h | 16 +++++----- t/t3309-notes-merge-auto-resolve.sh | 29 ++++++++++++++++++ t/t3310-notes-merge-manual-resolve.sh | 12 ++++++++ 6 files changed, 119 insertions(+), 37 deletions(-)
Signature · 1 line
2.5.0.482.gfcd5645
PATCH v2 1/2 notes: document cat_sort_uniq rewriteMode
From: Jacob Keller <[email protected]>
Teach documentation about the cat_sort_uniq rewriteMode that got added at the same time as the equivalent merge strategy.
--- Documentation/config.txt | 4 ++-- Documentation/git-notes.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
Documentation/config.txt +2 -2
@@ -1965,8 +1965,8 @@ notes.rewriteMode:: When copying notes during a rewrite (see the "notes.rewrite.<command>" option), determines what to do if the target commit already has a note. Must be one of - `overwrite`, `concatenate`, or `ignore`. Defaults to - `concatenate`. + `overwrite`, `concatenate`, `cat_sort_uniq`, or `ignore`. + Defaults to `concatenate`. + This setting can be overridden with the `GIT_NOTES_REWRITE_MODE` environment variable.
Documentation/git-notes.txt +2 -1
@@ -331,7 +331,8 @@ environment variable. notes.rewriteMode:: When copying notes during a rewrite, what to do if the target commit already has a note. Must be one of `overwrite`, - `concatenate`, and `ignore`. Defaults to `concatenate`. + `concatenate`, `cat_sort_uniq`, or `ignore`. Defaults to + `concatenate`. + This setting can be overridden with the `GIT_NOTES_REWRITE_MODE` environment variable.
Signature · 1 line
2.5.0.482.gfcd5645
PATCH v2 2/2 notes: add notes.merge option to select default strategy
In reply to Jacob KellerFrom: Jacob Keller <[email protected]>
Teach git-notes about a new configuration option "notes.merge" for selecting the default notes merge strategy. Document the option in config.txt and git-notes.txt
Add tests for the configuration option. Ensure that command line --strategy option overrides the configured value. Ensure that -s can't be passed with --commit or --abort. Ensure that --abort and --commit can't be used together.
--- Documentation/config.txt | 7 +++++ Documentation/git-notes.txt | 30 ++++++++++++------- builtin/notes.c | 55 +++++++++++++++++++++++++---------- notes-merge.h | 16 +++++----- t/t3309-notes-merge-auto-resolve.sh | 29 ++++++++++++++++++ t/t3310-notes-merge-manual-resolve.sh | 12 ++++++++ 6 files changed, 115 insertions(+), 34 deletions(-)
Documentation/config.txt +7 -0
@@ -1937,6 +1937,13 @@ mergetool.writeToTemp:: mergetool.prompt:: Prompt before each invocation of the merge resolution program. +notes.merge:: + Which merge strategy to choose by default when resolving notes + conflicts. Must be one of `manual`, `ours`, `theirs`, `union`, + or `cat_sort_uniq`. Defaults to `manual`. See "NOTES MERGE + STRATEGIES" section of linkgit:git-notes[1] for more information + on each strategy. + notes.displayRef:: The (fully qualified) refname from which to show notes when showing commit messages. The value of this variable can be set
Documentation/git-notes.txt +19 -11
@@ -101,13 +101,13 @@ merge:: any) into the current notes ref (called "local"). + If conflicts arise and a strategy for automatically resolving -conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the -conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), -and instructs the user to manually resolve the conflicts there. -When done, the user can either finalize the merge with -'git notes merge --commit', or abort the merge with -'git notes merge --abort'. +conflicting notes (see the -s/--strategy option or notes.merge +config option) is not given, the "manual" resolver is used. +This resolver checks out the conflicting notes in a special +worktree (`.git/NOTES_MERGE_WORKTREE`), and instructs the user +to manually resolve the conflicts there. When done, the user +can either finalize the merge with 'git notes merge --commit', +or abort the merge with 'git notes merge --abort'. remove:: Remove the notes for given objects (defaults to HEAD). When
@@ -181,10 +181,10 @@ OPTIONS -s <strategy>:: --strategy=<strategy>:: When merging notes, resolve notes conflicts using the given - strategy. The following strategies are recognized: "manual" - (default), "ours", "theirs", "union" and "cat_sort_uniq". - See the "NOTES MERGE STRATEGIES" section below for more - information on each notes merge strategy. + strategy. Overrides "notes.merge". The following strategies are + recognized: `manual`, `ours`, `theirs`, `union` and + `cat_sort_uniq`. See the `NOTES MERGE STRATEGIES` section below + for more information on each notes merge strategy. --commit:: Finalize an in-progress 'git notes merge'. Use this option
@@ -310,6 +310,14 @@ core.notesRef:: This setting can be overridden through the environment and command line. +notes.merge:: + Which merge strategy to choose by default when resolving notes + conflicts. Must be one of `manual`, `ours`, `theirs`, `union`, + or `cat_sort_uniq`. Defaults to `manual`. See "NOTES MERGE + STRATEGIES" section above for more information on each strategy. ++ +This setting can be overridden by passing the `--strategy` option. + notes.displayRef:: Which ref (or refs, if a glob or specified more than once), in addition to the default set by `core.notesRef` or
builtin/notes.c +39 -16
87 lines not on this page · raw message
notes-merge.h +9 -7
@@ -8,18 +8,20 @@ enum notes_merge_verbosity { NOTES_MERGE_VERBOSITY_MAX = 5 }; +enum notes_merge_strategy { +NOTES_MERGE_RESOLVE_MANUAL =0 , +NOTES_MERGE_RESOLVE_OURS , +NOTES_MERGE_RESOLVE_THEIRS , +NOTES_MERGE_RESOLVE_UNION , +NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ +}; +struct notes_merge_options {const char *local_ref;const char *remote_ref;struct strbuf commit_msg;int verbosity; -enum { -NOTES_MERGE_RESOLVE_MANUAL =0 , -NOTES_MERGE_RESOLVE_OURS , -NOTES_MERGE_RESOLVE_THEIRS , -NOTES_MERGE_RESOLVE_UNION , -NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ - } strategy; +enum notes_merge_strategy strategy;unsigned has_worktree:1 ; };
t/t3309-notes-merge-auto-resolve.sh +29 -0
@@ -298,6 +298,13 @@ test_expect_success 'merge z into y with invalid strategy => Fail/No changes' ' verify_notes y y ' +test_expect_success 'merge z into y with invalid configuration option => Fail/No changes' ' + git config core.notesRef refs/notes/y && + test_must_fail git -c notes.merge="foo" notes merge z && + # Verify no changes (y) + verify_notes y y +' + cat <<EOF | sort >expect_notes_ours 68b8630d25516028bed862719855b3d6768d7833 $commit_sha15 5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
@@ -365,6 +372,17 @@ test_expect_success 'reset to pre-merge state (y)' ' verify_notes y y ' +test_expect_success 'merge z into y with "ours" configuration option => Non-conflicting 3-way merge' ' + git -c notes.merge="ours" notes merge z && + verify_notes y ours +' + +test_expect_success 'reset to pre-merge state (y)' ' + git update-ref refs/notes/y refs/notes/y^1 && + # Verify pre-merge state + verify_notes y y +' + cat <<EOF | sort >expect_notes_theirs 9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15 5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
@@ -432,6 +450,17 @@ test_expect_success 'reset to pre-merge state (y)' ' verify_notes y y ' +test_expect_success 'merge z into y with "theirs" strategy overriding configuration option "ours" => Non-conflicting 3-way merge' ' + git -c notes.merge="ours" notes merge --strategy=theirs z && + verify_notes y theirs +' + +test_expect_success 'reset to pre-merge state (y)' ' + git update-ref refs/notes/y refs/notes/y^1 && + # Verify pre-merge state + verify_notes y y +' + cat <<EOF | sort >expect_notes_union 7c4e546efd0fe939f876beb262ece02797880b54 $commit_sha15 5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
t/t3310-notes-merge-manual-resolve.sh +12 -0
@@ -314,6 +314,18 @@ y and z notes on 1st commit EOF +test_expect_success 'do not allow mixing --commit and --abort' ' + test_must_fail git notes merge --commit --abort +' + +test_expect_success 'do not allow mixing --commit and --strategy' ' + test_must_fail git notes merge --commit --strategy theirs +' + +test_expect_success 'do not allow mixing --abort and --strategy' ' + test_must_fail git notes merge --abort --strategy theirs +' + test_expect_success 'finalize conflicting merge (z => m)' ' # Resolve conflicts and finalize merge cat >.git/NOTES_MERGE_WORKTREE/$commit_sha1 <<EOF &&
Signature · 1 line
2.5.0.482.gfcd5645
Re: [PATCH v2 2/2] notes: add notes.merge option to select default strategy
Quoted 9 lines · Jacob Keller
Teach git-notes about a new configuration option "notes.merge" for selecting the default notes merge strategy. Document the option in config.txt and git-notes.txt
Add tests for the configuration option. Ensure that command line --strategy option overrides the configured value. Ensure that -s can't be passed with --commit or --abort. Ensure that --abort and --commit can't be used together.
Quoted 4 lines
Signed-off-by Jacob Keller <[email protected]>Cc Johan Herland <[email protected]>Cc Michael Haggerty <[email protected]>Cc Eric Sunshine <[email protected]>
Thanks, this looks better than the previous round. A few comments below...
Quoted 12 lines
Documentation/git-notes.txt +0
-4@@ -101,13 +101,13 @@ merge:: any) into the current notes ref (called "local"). + If conflicts arise and a strategy for automatically resolving -conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the -conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), -and instructs the user to manually resolve the conflicts there.
Documentation/git-notes.txt merge:: · line 110
Quoted 10 lines
Documentation/git-notes.txt +7
-3-When done, the user can either finalize the merge with -'git notes merge --commit', or abort the merge with -'git notes merge --abort'. +conflicting notes (see the -s/--strategy option or notes.merge +config option) is not given, the "manual" resolver is used. +This resolver checks out the conflicting notes in a special +worktree (`.git/NOTES_MERGE_WORKTREE`), and instructs the user +to manually resolve the conflicts there. When done, the user +can either finalize the merge with 'git notes merge --commit', +or abort the merge with 'git notes merge --abort'.
When you re-wrap the text like this, it's difficult to spot your one little change in all the diff noise. For the sake of review, it's often better to minimize the change, even if it leaves the text more jagged than you'd like.
Quoted 4 lines
Documentation/git-notes.txt +0
-0remove:: Remove the notes for given objects (defaults to HEAD). When@@ -181,10 +181,10 @@ OPTIONS -s <strategy>::
Documentation/git-notes.txt OPTIONS · line 187
Quoted 10 lines
Documentation/git-notes.txt +4
-4--strategy=<strategy>:: When merging notes, resolve notes conflicts using the given - strategy. The following strategies are recognized: "manual" - (default), "ours", "theirs", "union" and "cat_sort_uniq". - See the "NOTES MERGE STRATEGIES" section below for more - information on each notes merge strategy. + strategy. Overrides "notes.merge". The following strategies are + recognized: `manual`, `ours`, `theirs`, `union` and + `cat_sort_uniq`. See the `NOTES MERGE STRATEGIES` section below + for more information on each notes merge strategy.
Ditto.
Quoted 14 lines
Documentation/git-notes.txt +0
-0--commit:: Finalize an in-progress 'git notes merge'. Use this optionbuiltin/notes.c +4
-0@@ -741,6 +743,25 @@ static int merge_commit(struct notes_merge_options *o)return ret; } +static int parse_notes_strategy (const char *arg,enum notes_merge_strategy *strategy) +{ +if (!strcmp (arg,"manual" )) + *strategy =NOTES_MERGE_RESOLVE_MANUAL ;
builtin/notes.c static int merge_commit(struct notes_merge_options *o) · line 759
Quoted 10 lines
builtin/notes.c +10
-0+else if (!strcmp (arg,"ours" )) + *strategy =NOTES_MERGE_RESOLVE_OURS ; +else if (!strcmp (arg,"theirs" )) + *strategy =NOTES_MERGE_RESOLVE_THEIRS ; +else if (!strcmp (arg,"union" )) + *strategy =NOTES_MERGE_RESOLVE_UNION ; +else if (!strcmp (arg,"cat_sort_uniq" )) + *strategy =NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ ; +else { +return 1 ;
In this codebase, it's customary to return 0 on success and -1 on error
builtin/notes.c static int merge_commit(struct notes_merge_options *o) · line 760
Quoted 1 line
builtin/notes.c +1
-0+ }
Style: drop unnecessary braces
Quoted 8 lines
builtin/notes.c +4
-0+ +return 0 ; +} +static int merge (int argc,const char **argv,const char *prefix) {struct strbuf remote_ref =STRBUF_INIT , msg =STRBUF_INIT ;
builtin/notes.c static int get_ref(int argc, const char **argv, const char *prefix) · line 970
Quoted 10 lines
builtin/notes.c +7
-0@@ -950,6 +961,18 @@ static int get_ref(int argc, const char **argv, const char *prefix)return 0 ; } +static int git_notes_config (const char *var,const char *value,void *cb) +{ +if (!strcmp (var,"notes.merge" )) { +if (!value) +return config_error_nonbool (var); +if (parse_notes_strategy (value, &merge_strategy)) +return error ("Unknown notes merge strategy: %s" , value);
For the non-error case, don't you want to 'return 0' here to indicate that you handled the config variable rather than letting it fall through to git_default_config() below?
Quoted 8 lines
builtin/notes.c +5
-0+ } + +return git_default_config (var, value, cb); +} +int cmd_notes (int argc,const char **argv,const char *prefix) {int result;
Re: [PATCH v2 2/2] notes: add notes.merge option to select default strategy
Quoted 12 lines · Eric Sunshine
Quoted 12 lines
If conflicts arise and a strategy for automatically resolving
Documentation/git-notes.txt +4
-7-conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the -conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), -and instructs the user to manually resolve the conflicts there. -When done, the user can either finalize the merge with -'git notes merge --commit', or abort the merge with -'git notes merge --abort'. +conflicting notes (see the -s/--strategy option or notes.merge +config option) is not given, the "manual" resolver is used. +This resolver checks out the conflicting notes in a special +worktree (`.git/NOTES_MERGE_WORKTREE`), and instructs the user
Quoted 8 lines
Documentation/git-notes.txt merge:: · line 110
Quoted 3 lines
Documentation/git-notes.txt +3
-0+to manually resolve the conflicts there. When done, the user +can either finalize the merge with 'git notes merge --commit', +or abort the merge with 'git notes merge --abort'.When you re-wrap the text like this, it's difficult to spot your one little change in all the diff noise. For the sake of review, it's often better to minimize the change, even if it leaves the text more jagged than you'd like.
This results in something incredibly jagged. I can't find a good way to split which minimizes the change. Would a 3rd patch which just re-flows this be an acceptable alternative
ie: add the words in one patch then re-flow afterwards in a second patch with no changes?
There is no good alternative as other re-flows I tried end up looking way too jagged, as compared to surrounding documentation.
Regards,
Jake
Re: [PATCH v2 2/2] notes: add notes.merge option to select default strategy
Quoted 26 lines · Jacob Keller
Quoted 12 lines · Eric Sunshine
Quoted 12 lines
If conflicts arise and a strategy for automatically resolving
Documentation/git-notes.txt +4
-7-conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the -conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), -and instructs the user to manually resolve the conflicts there. -When done, the user can either finalize the merge with -'git notes merge --commit', or abort the merge with -'git notes merge --abort'. +conflicting notes (see the -s/--strategy option or notes.merge +config option) is not given, the "manual" resolver is used. +This resolver checks out the conflicting notes in a special +worktree (`.git/NOTES_MERGE_WORKTREE`), and instructs the userQuoted 8 lines
Documentation/git-notes.txt merge:: · line 110
Quoted 3 lines
Documentation/git-notes.txt +3
-0+to manually resolve the conflicts there. When done, the user +can either finalize the merge with 'git notes merge --commit', +or abort the merge with 'git notes merge --abort'.When you re-wrap the text like this, it's difficult to spot your one little change in all the diff noise. For the sake of review, it's often better to minimize the change, even if it leaves the text more jagged than you'd like.
This results in something incredibly jagged. I can't find a good way to split which minimizes the change. Would a 3rd patch which just re-flows this be an acceptable alternative
Quoted 5 lines
ie: add the words in one patch then re-flow afterwards in a second patch with no changes?
There is no good alternative as other re-flows I tried end up looking way too jagged, as compared to surrounding documentation.
Don't worry too much about it. Consider it something to keep in mind for future patches. I reviewed the change and it seemed okay. I mentioned it because one of the goals of patch submission, in addition to making an actual change, is to ease the review process. If Junio is okay with accepting it as is, then it's probably not worth spending more time trying to refine it.
Having said that, I came up with the following for those two paragraphs, which gives a much less noisy diff and doesn't look too jagged:
--- 8< ---
If conflicts arise and a strategy for automatically resolving
-conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the +conflicting notes (see -s/--strategy or notes.merge configuration) is +not given, the "manual" resolver is used. This resolver checks out the
conflicting notes in a special worktree (.git/NOTES_MERGE_WORKTREE), and instructs the user to manually resolve the conflicts there. When done, the user can either finalize the merge with
--- 8< ---
...and...
--- 8< ---
When merging notes, resolve notes conflicts using the given
- strategy. The following strategies are recognized: "manual"
+ strategy. Overrides the "notes.merge" configuration variable.
+ The following strategies are recognized: "manual"
(default), "ours", "theirs", "union" and "cat_sort_uniq". See the "NOTES MERGE STRATEGIES" section below for more information on each notes merge strategy.
--- 8< ---
Re: [PATCH v2 2/2] notes: add notes.merge option to select default strategy
Quoted 10 lines · Eric Sunshine
Don't worry too much about it. Consider it something to keep in mind for future patches. I reviewed the change and it seemed okay. I mentioned it because one of the goals of patch submission, in addition to making an actual change, is to ease the review process. If Junio is okay with accepting it as is, then it's probably not worth spending more time trying to refine it.
Having said that, I came up with the following for those two paragraphs, which gives a much less noisy diff and doesn't look too jagged:
Yea, I actually have re-worked it as well to something more suitable. I'm re-sending anyways as I fixed some of the other style issues and the one bug about not returning 0 on good read of the notes.merge value.
Regards
Jake
Re: [PATCH v2 2/2] notes: add notes.merge option to select default strategy
In reply to Eric SunshineQuoted 36 lines · Eric Sunshine
Quoted 9 lines · Jacob Keller
Teach git-notes about a new configuration option "notes.merge" for selecting the default notes merge strategy. Document the option in config.txt and git-notes.txt
Add tests for the configuration option. Ensure that command line --strategy option overrides the configured value. Ensure that -s can't be passed with --commit or --abort. Ensure that --abort and --commit can't be used together.
Quoted 4 lines
Signed-off-by Jacob Keller <[email protected]>Cc Johan Herland <[email protected]>Cc Michael Haggerty <[email protected]>Cc Eric Sunshine <[email protected]>Thanks, this looks better than the previous round. A few comments below...
Quoted 19 lines
Documentation/git-notes.txt +4
-7@@ -101,13 +101,13 @@ merge:: any) into the current notes ref (called "local"). + If conflicts arise and a strategy for automatically resolving -conflicting notes (see the -s/--strategy option) is not given, -the "manual" resolver is used. This resolver checks out the -conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), -and instructs the user to manually resolve the conflicts there. -When done, the user can either finalize the merge with -'git notes merge --commit', or abort the merge with -'git notes merge --abort'. +conflicting notes (see the -s/--strategy option or notes.merge +config option) is not given, the "manual" resolver is used. +This resolver checks out the conflicting notes in a special +worktree (`.git/NOTES_MERGE_WORKTREE`), and instructs the user
Quoted 9 lines
Documentation/git-notes.txt merge:: · line 110
Quoted 3 lines
Documentation/git-notes.txt +3
-0+to manually resolve the conflicts there. When done, the user +can either finalize the merge with 'git notes merge --commit', +or abort the merge with 'git notes merge --abort'.When you re-wrap the text like this, it's difficult to spot your one little change in all the diff noise. For the sake of review, it's often better to minimize the change, even if it leaves the text more jagged than you'd like.
Even if it leaves it incredibly jagged? That is one of the downsides with diff of flowed text like this :(
Quoted 27 lines
Quoted 4 lines
Documentation/git-notes.txt +0
-0remove:: Remove the notes for given objects (defaults to HEAD). When@@ -181,10 +181,10 @@ OPTIONS -s <strategy>::Documentation/git-notes.txt OPTIONS · line 187
Quoted 10 lines
Documentation/git-notes.txt +4
-4--strategy=<strategy>:: When merging notes, resolve notes conflicts using the given - strategy. The following strategies are recognized: "manual" - (default), "ours", "theirs", "union" and "cat_sort_uniq". - See the "NOTES MERGE STRATEGIES" section below for more - information on each notes merge strategy. + strategy. Overrides "notes.merge". The following strategies are + recognized: `manual`, `ours`, `theirs`, `union` and + `cat_sort_uniq`. See the `NOTES MERGE STRATEGIES` section below + for more information on each notes merge strategy.Ditto.
Quoted 10 lines
Documentation/git-notes.txt +0
-0--commit:: Finalize an in-progress 'git notes merge'. Use this optionbuiltin/notes.c +0
-0@@ -741,6 +743,25 @@ static int merge_commit(struct notes_merge_options *o)return ret; }
Quoted 17 lines
Quoted 4 lines
builtin/notes.c +4
-0+static int parse_notes_strategy (const char *arg,enum notes_merge_strategy *strategy) +{ +if (!strcmp (arg,"manual" )) + *strategy =NOTES_MERGE_RESOLVE_MANUAL ;builtin/notes.c static int merge_commit(struct notes_merge_options *o) · line 759
Quoted 10 lines
builtin/notes.c +10
-0+else if (!strcmp (arg,"ours" )) + *strategy =NOTES_MERGE_RESOLVE_OURS ; +else if (!strcmp (arg,"theirs" )) + *strategy =NOTES_MERGE_RESOLVE_THEIRS ; +else if (!strcmp (arg,"union" )) + *strategy =NOTES_MERGE_RESOLVE_UNION ; +else if (!strcmp (arg,"cat_sort_uniq" )) + *strategy =NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ ; +else { +return 1 ;In this codebase, it's customary to return 0 on success and -1 on error
Fair enough.
Quoted 15 lines
builtin/notes.c static int merge_commit(struct notes_merge_options *o) · line 760
Quoted 1 line
builtin/notes.c +1
-0+ }Style: drop unnecessary braces
Quoted 11 lines
builtin/notes.c +4
-0+ +return 0 ; +} +static int merge (int argc,const char **argv,const char *prefix) {struct strbuf remote_ref =STRBUF_INIT , msg =STRBUF_INIT ;@@ -950,6 +961,18 @@ static int get_ref(int argc, const char **argv, const char *prefix)return 0 ; }
Quoted 12 lines
builtin/notes.c static int get_ref(int argc, const char **argv, const char *prefix) · line 970
Quoted 7 lines
builtin/notes.c +7
-0+static int git_notes_config (const char *var,const char *value,void *cb) +{ +if (!strcmp (var,"notes.merge" )) { +if (!value) +return config_error_nonbool (var); +if (parse_notes_strategy (value, &merge_strategy)) +return error ("Unknown notes merge strategy: %s" , value);For the non-error case, don't you want to 'return 0' here to indicate that you handled the config variable rather than letting it fall through to
git_default_config()below?
Makes sense, I can fix that.
Regards,
Jake
Quoted 8 lines
Quoted 8 lines
builtin/notes.c +5
-0+ } + +return git_default_config (var, value, cb); +} +int cmd_notes (int argc,const char **argv,const char *prefix) {int result;
Quoted 5 lines · Jacob Keller
From: Jacob Keller <[email protected]>
This series adds a default merge strategy option for git-notes, so that the user does not have to type "-s" every time. It is overridden by the -s option.
I like this addition. A natural extension (i.e. future work, you needn't worry about it for now) would be to allow this configuration to be per notes ref. Different notes refs are used to hold different kinds of data, and where cat_sort_uniq may be a good strategy for one particular notes ref, it may be a poor default for other notes refs. So we should consider adding notes.<notesref>.merge options to allow more fine-grained control of which notes merge strategies apply to which notes refs.
Quoted 2 lines
I also added some tests to ensure that the "--abort" "--commit" and "-s" options must be independent.
Good. These could easily be split out into a separate commit, though, as they are independent of the notes.merge addition.
Quoted 5 lines
In addition, I found a small documentation
bug which is corrected in the first patch of the series.I Cc'd a couple more people in this version of the patch in order to hopefully get some more review.
Thanks, appreciated (although AFAICS the cover letter was not CCed to me).
Quoted 2 lines
This is based on pu incase there were
any other conflicts, but I can easily rebase if necessary.
Junio has the final word here, but I believe the preferred workflow is to base your patch series on master or next, as those do not jump around quite as much as pu does.
Quoted 4 lines
Jacob Keller (2):
notes: documentcat_sort_uniqrewriteMode
notes: add notes.merge option to select default strategy
Both patches Acked-by: Johan Herland <[email protected]>
...Johan
Quoted 16 lines
Documentation/config.txt | 11 +++++-- Documentation/git-notes.txt | 33 +++++++++++++-------- builtin/notes.c | 55 +++++++++++++++++++++++++---------- notes-merge.h | 16 +++++----- t/t3309-notes-merge-auto-resolve.sh | 29 ++++++++++++++++++ t/t3310-notes-merge-manual-resolve.sh | 12 ++++++++ 6 files changed, 119 insertions(+), 37 deletions(-)--
2.5.0.482.gfcd5645--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Johan Herland, <[email protected]> www.herland.net