<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/git.git/t/t3301-notes.sh, branch sb/string-list-split-appends</title>
<subtitle>github.com: git/git.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/'/>
<entry>
<title>notes: allow treeish expressions as notes ref</title>
<updated>2016-01-12T23:10:01+00:00</updated>
<author>
<name>Mike Hommey</name>
<email>mh@glandium.org</email>
</author>
<published>2015-10-08T02:54:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=ee76f92fe883305c1260952f5b325b0503311fc9'/>
<id>ee76f92fe883305c1260952f5b325b0503311fc9</id>
<content type='text'>
init_notes() is the main point of entry to the notes API. It ensures
that the input can be used as ref, because it needs a ref to update to
store notes tree after modifying it.

There however are many use cases where notes tree is only read, e.g.
"git log --notes=...".  Any notes-shaped treeish could be used for such
purpose, but it is not allowed due to existing restriction.

Allow treeish expressions to be used in the case the notes tree is going
to be used without write "permissions".  Add a flag to distinguish
whether the notes tree is intended to be used read-only, or will be
updated.

With this change, operations that use notes read-only can be fed any
notes-shaped tree-ish can be used, e.g. git log --notes=notes@{1}.

Signed-off-by: Mike Hommey &lt;mh@glandium.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
init_notes() is the main point of entry to the notes API. It ensures
that the input can be used as ref, because it needs a ref to update to
store notes tree after modifying it.

There however are many use cases where notes tree is only read, e.g.
"git log --notes=...".  Any notes-shaped treeish could be used for such
purpose, but it is not allowed due to existing restriction.

Allow treeish expressions to be used in the case the notes tree is going
to be used without write "permissions".  Add a flag to distinguish
whether the notes tree is intended to be used read-only, or will be
updated.

With this change, operations that use notes read-only can be fed any
notes-shaped tree-ish can be used, e.g. git log --notes=notes@{1}.

Signed-off-by: Mike Hommey &lt;mh@glandium.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>notes: correct documentation of DWIMery for notes references</title>
<updated>2015-09-22T22:24:01+00:00</updated>
<author>
<name>Jacob Keller</name>
<email>jacob.keller@gmail.com</email>
</author>
<published>2015-09-22T22:15:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=e14c92e841fd6d99c8c17af05a411a85ac212254'/>
<id>e14c92e841fd6d99c8c17af05a411a85ac212254</id>
<content type='text'>
expand_notes_ref is used by --ref from git-notes(1) and --notes from the
git log to find the full refname of a notes reference. Previously the
documentation of these options was not clear about what sorts of
expansions would be performed. Fix the documentation to clearly and
accurately describe the behavior of the expansions.

Add a test for this expansion when using git notes get-ref in order to
prevent future patches from changing this behavior.

Signed-off-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
expand_notes_ref is used by --ref from git-notes(1) and --notes from the
git log to find the full refname of a notes reference. Previously the
documentation of these options was not clear about what sorts of
expansions would be performed. Fix the documentation to clearly and
accurately describe the behavior of the expansions.

Add a test for this expansion when using git notes get-ref in order to
prevent future patches from changing this behavior.

Signed-off-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix unclosed here document in t3301.sh</title>
<updated>2015-01-22T20:23:42+00:00</updated>
<author>
<name>Kacper Kornet</name>
<email>draenog@pld-linux.org</email>
</author>
<published>2015-01-22T11:59:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=85cb1d0ba883627f38ad994aa489bf0b3dc40f7f'/>
<id>85cb1d0ba883627f38ad994aa489bf0b3dc40f7f</id>
<content type='text'>
Commit 908a3203632a02568df230c0fccf9a2cd8da24e6 introduced  indentation
to here documents in t3301.sh. However in one place &lt;&lt;-EOF was missing
-, which broke this test when run with mksh-50d. This commit fixes it.

Signed-off-by: Kacper Kornet &lt;draenog@pld-linux.org&gt;
Acked-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 908a3203632a02568df230c0fccf9a2cd8da24e6 introduced  indentation
to here documents in t3301.sh. However in one place &lt;&lt;-EOF was missing
-, which broke this test when run with mksh-50d. This commit fixes it.

Signed-off-by: Kacper Kornet &lt;draenog@pld-linux.org&gt;
Acked-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>t3301: modernize style</title>
<updated>2014-11-14T21:33:09+00:00</updated>
<author>
<name>Johan Herland</name>
<email>johan@herland.net</email>
</author>
<published>2014-11-12T00:40:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=908a3203632a02568df230c0fccf9a2cd8da24e6'/>
<id>908a3203632a02568df230c0fccf9a2cd8da24e6</id>
<content type='text'>
Make this test script appear somewhat less old-fashioned:

 - Use test helper functions:
    - write_script
    - test_commit
    - test_write_lines
    - test_line_count
    - test_config
    - test_unconfig
    - test_path_is_missing

 - Remove whitespace between redirection operators and their targets.

 - Move preparation of "expect" files into tests.

 - Rename "output" files to "actual".

 - More consistent quoting, especially around commands that might
   expand to nothing.

 - More visibility of important whitespace with ${indent}.

 - Combine pairs of tests that unnecessarily split setup and verification.

Improved-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Improved-by: Michael Blume &lt;blume.mike@gmail.com&gt;
Improved-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make this test script appear somewhat less old-fashioned:

 - Use test helper functions:
    - write_script
    - test_commit
    - test_write_lines
    - test_line_count
    - test_config
    - test_unconfig
    - test_path_is_missing

 - Remove whitespace between redirection operators and their targets.

 - Move preparation of "expect" files into tests.

 - Rename "output" files to "actual".

 - More consistent quoting, especially around commands that might
   expand to nothing.

 - More visibility of important whitespace with ${indent}.

 - Combine pairs of tests that unnecessarily split setup and verification.

Improved-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Improved-by: Michael Blume &lt;blume.mike@gmail.com&gt;
Improved-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>notes: empty notes should be shown by 'git log'</title>
<updated>2014-11-12T19:00:22+00:00</updated>
<author>
<name>Johan Herland</name>
<email>johan@herland.net</email>
</author>
<published>2014-11-12T00:40:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=8a4acd699536c518c9245714d6175aa39d13eb9d'/>
<id>8a4acd699536c518c9245714d6175aa39d13eb9d</id>
<content type='text'>
If the user has gone through the trouble of explicitly adding an empty
note, then "git log" should not silently skip it (as if it didn't exist).

Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the user has gone through the trouble of explicitly adding an empty
note, then "git log" should not silently skip it (as if it didn't exist).

Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>builtin/notes: add --allow-empty, to allow storing empty notes</title>
<updated>2014-11-12T19:00:11+00:00</updated>
<author>
<name>Johan Herland</name>
<email>johan@herland.net</email>
</author>
<published>2014-11-12T00:40:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=d73a5b933db1e722faa54d6709e89e2450d7c1e3'/>
<id>d73a5b933db1e722faa54d6709e89e2450d7c1e3</id>
<content type='text'>
Although the "git notes" man page advertises that we support binary-safe
notes addition (using the -C option), we currently do not support adding
the empty note (i.e. using the empty blob to annotate an object). Instead,
an empty note is always treated as an intent to remove the note
altogether.

Introduce the --allow-empty option to the add/append/edit subcommands,
to explicitly allow an empty note to be stored into the notes tree.

Also update the documentation, and add test cases for the new option.

Reported-by: James H. Fisher &lt;jhf@trifork.com&gt;
Improved-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Although the "git notes" man page advertises that we support binary-safe
notes addition (using the -C option), we currently do not support adding
the empty note (i.e. using the empty blob to annotate an object). Instead,
an empty note is always treated as an intent to remove the note
altogether.

Introduce the --allow-empty option to the add/append/edit subcommands,
to explicitly allow an empty note to be stored into the notes tree.

Also update the documentation, and add test cases for the new option.

Reported-by: James H. Fisher &lt;jhf@trifork.com&gt;
Improved-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>t3301: verify that 'git notes' removes empty notes by default</title>
<updated>2014-11-10T20:08:21+00:00</updated>
<author>
<name>Johan Herland</name>
<email>johan@herland.net</email>
</author>
<published>2014-11-09T12:30:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=d0923b6d4c01e3c5b86d56b1741292eda7c181fe'/>
<id>d0923b6d4c01e3c5b86d56b1741292eda7c181fe</id>
<content type='text'>
Add test cases documenting the current behavior when trying to
add/append/edit empty notes. This is in preparation for adding
--allow-empty; to allow empty notes to be stored.

Improved-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add test cases documenting the current behavior when trying to
add/append/edit empty notes. This is in preparation for adding
--allow-empty; to allow empty notes to be stored.

Improved-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Improved-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'dt/tests-with-env-not-subshell'</title>
<updated>2014-03-31T23:30:40+00:00</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-31T23:30:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=fa73d354689aa577d564b03d22f87c34b6288a78'/>
<id>fa73d354689aa577d564b03d22f87c34b6288a78</id>
<content type='text'>
* dt/tests-with-env-not-subshell:
  tests: use "env" to run commands with temporary env-var settings
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* dt/tests-with-env-not-subshell:
  tests: use "env" to run commands with temporary env-var settings
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: use "env" to run commands with temporary env-var settings</title>
<updated>2014-03-19T19:55:57+00:00</updated>
<author>
<name>David Tran</name>
<email>unsignedzero@gmail.com</email>
</author>
<published>2014-03-18T18:54:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=512477b175288a429aaf4071dc9fe94f17f0e4ee'/>
<id>512477b175288a429aaf4071dc9fe94f17f0e4ee</id>
<content type='text'>
Ordinarily, we would say "VAR=VAL command" to execute a tested
command with environment variable(s) set only for that command.
This however does not work if 'command' is a shell function (most
notably 'test_must_fail'); the result of the assignment is retained
and affects later commands.

To avoid this, we used to assign and export environment variables
and run such a test in a subshell, like so:

        (
                VAR=VAL &amp;&amp; export VAR &amp;&amp;
                test_must_fail git command to be tested
        )

But with "env" utility, we should be able to say:

        test_must_fail env VAR=VAL git command to be tested

which is much shorter and easier to read.

Signed-off-by: David Tran &lt;unsignedzero@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ordinarily, we would say "VAR=VAL command" to execute a tested
command with environment variable(s) set only for that command.
This however does not work if 'command' is a shell function (most
notably 'test_must_fail'); the result of the assignment is retained
and affects later commands.

To avoid this, we used to assign and export environment variables
and run such a test in a subshell, like so:

        (
                VAR=VAL &amp;&amp; export VAR &amp;&amp;
                test_must_fail git command to be tested
        )

But with "env" utility, we should be able to say:

        test_must_fail env VAR=VAL git command to be tested

which is much shorter and easier to read.

Signed-off-by: David Tran &lt;unsignedzero@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>notes: disallow reusing non-blob as a note object</title>
<updated>2014-02-20T22:14:33+00:00</updated>
<author>
<name>Johan Herland</name>
<email>johan@herland.net</email>
</author>
<published>2014-02-12T09:54:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/git.git/commit/?id=ce8daa1eb863c9cdefb06feae2ee7c742ea89847'/>
<id>ce8daa1eb863c9cdefb06feae2ee7c742ea89847</id>
<content type='text'>
Currently "git notes add -C $object" will read the raw bytes from $object,
and then copy those bytes into the note object, which is hardcoded to be
of type blob. This means that if the given $object is a non-blob (e.g.
tree or commit), the raw bytes from that object is copied into a blob
object. This is probably not useful, and certainly not what any sane
user would expect. So disallow it, by erroring out if the $object passed
to the -C option is not a blob.

The fix also applies to the -c option (in which the user is prompted to
edit/verify the note contents in a text editor), and also when -c/-C is
passed to "git notes append" (which appends the $object contents to an
existing note object). In both cases, passing a non-blob $object does not
make sense.

Also add a couple of tests demonstrating expected behavior.

Suggested-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently "git notes add -C $object" will read the raw bytes from $object,
and then copy those bytes into the note object, which is hardcoded to be
of type blob. This means that if the given $object is a non-blob (e.g.
tree or commit), the raw bytes from that object is copied into a blob
object. This is probably not useful, and certainly not what any sane
user would expect. So disallow it, by erroring out if the $object passed
to the -C option is not a blob.

The fix also applies to the -c option (in which the user is prompted to
edit/verify the note contents in a text editor), and also when -c/-C is
passed to "git notes append" (which appends the $object contents to an
existing note object). In both cases, passing a non-blob $object does not
make sense.

Also add a couple of tests demonstrating expected behavior.

Suggested-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Johan Herland &lt;johan@herland.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
