<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.h, branch v2.3.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.7</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-11-25T18:09:58Z</updated>
<entry>
<title>repack_without_refs(): make the refnames argument a string_list</title>
<updated>2014-11-25T18:09:58Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-11-25T08:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a45b2f347245d321bf5c07fbe3f8091d122732f'/>
<id>urn:sha1:4a45b2f347245d321bf5c07fbe3f8091d122732f</id>
<content type='text'>
Most of the callers have string_lists available already, whereas two
of them had to read data out of a string_list into an array of strings
just to call this function. So change repack_without_refs() to take
the list of refnames to omit as a string_list, and change the callers
accordingly.

Suggested-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs.c: allow listing and deleting badly named refs</title>
<updated>2014-10-15T17:47:26Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-09-03T18:45:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d0f810f0bc0d6b51722b400f70c2590713f168e8'/>
<id>urn:sha1:d0f810f0bc0d6b51722b400f70c2590713f168e8</id>
<content type='text'>
We currently do not handle badly named refs well:

  $ cp .git/refs/heads/master .git/refs/heads/master.....@\*@\\.
  $ git branch
    fatal: Reference has invalid format: 'refs/heads/master.....@*@\.'
  $ git branch -D master.....@\*@\\.
    error: branch 'master.....@*@\.' not found.

Users cannot recover from a badly named ref without manually finding
and deleting the loose ref file or appropriate line in packed-refs.
Making that easier will make it easier to tweak the ref naming rules
in the future, for example to forbid shell metacharacters like '`'
and '"', without putting people in a state that is hard to get out of.

So allow "branch --list" to show these refs and allow "branch -d/-D"
and "update-ref -d" to delete them.  Other commands (for example to
rename refs) will continue to not handle these refs but can be changed
in later patches.

Details:

In resolving functions, refuse to resolve refs that don't pass the
git-check-ref-format(1) check unless the new RESOLVE_REF_ALLOW_BAD_NAME
flag is passed.  Even with RESOLVE_REF_ALLOW_BAD_NAME, refuse to
resolve refs that escape the refs/ directory and do not match the
pattern [A-Z_]* (think "HEAD" and "MERGE_HEAD").

In locking functions, refuse to act on badly named refs unless they
are being deleted and either are in the refs/ directory or match [A-Z_]*.

Just like other invalid refs, flag resolved, badly named refs with the
REF_ISBROKEN flag, treat them as resolving to null_sha1, and skip them
in all iteration functions except for for_each_rawref.

Flag badly named refs (but not symrefs pointing to badly named refs)
with a REF_BAD_NAME flag to make it easier for future callers to
notice and handle them specially.  For example, in a later patch
for-each-ref will use this flag to detect refs whose names can confuse
callers parsing for-each-ref output.

In the transaction API, refuse to create or update badly named refs,
but allow deleting them (unless they try to escape refs/ and don't match
[A-Z_]*).

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packed-ref cache: forbid dot-components in refnames</title>
<updated>2014-10-15T17:47:25Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2014-09-26T19:22:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f3cc52d840418c1a38bb4ae9a09a479e77d95e77'/>
<id>urn:sha1:f3cc52d840418c1a38bb4ae9a09a479e77d95e77</id>
<content type='text'>
Since v1.7.9-rc1~10^2 (write_head_info(): handle "extra refs" locally,
2012-01-06), this trick to keep track of ".have" refs that are only
valid on the wire and not on the filesystem is not needed any more.

Simplify by removing support for the REFNAME_DOT_COMPONENT flag.

This means we'll be slightly stricter with invalid refs found in a
packed-refs file or during clone.  read_loose_refs() already checks
for and skips refnames with .components so it is not affected.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Reviewed-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>branch -d: avoid repeated symref resolution</title>
<updated>2014-10-15T17:47:25Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2014-09-11T01:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=62a2d52514aed2b684409cb48e40e0cd14335d1b'/>
<id>urn:sha1:62a2d52514aed2b684409cb48e40e0cd14335d1b</id>
<content type='text'>
If a repository gets in a broken state with too much symref nesting,
it cannot be repaired with "git branch -d":

 $ git symbolic-ref refs/heads/nonsense refs/heads/nonsense
 $ git branch -d nonsense
 error: branch 'nonsense' not found.

Worse, "git update-ref --no-deref -d" doesn't work for such repairs
either:

 $ git update-ref -d refs/heads/nonsense
 error: unable to resolve reference refs/heads/nonsense: Too many levels of symbolic links

Fix both by teaching resolve_ref_unsafe a new RESOLVE_REF_NO_RECURSE
flag and passing it when appropriate.

Callers can still read the value of a symref (for example to print a
message about it) with that flag set --- resolve_ref_unsafe will
resolve one level of symrefs and stop there.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Reviewed-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs.c: make write_ref_sha1 static</title>
<updated>2014-10-15T17:47:23Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-04-28T22:36:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aae383db8c384dc46abe199899235f67c838e601'/>
<id>urn:sha1:aae383db8c384dc46abe199899235f67c838e601</id>
<content type='text'>
No external users call write_ref_sha1 any more so let's declare it static.

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs.c: ref_transaction_commit: distinguish name conflicts from other errors</title>
<updated>2014-10-15T17:47:23Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-05-16T21:14:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=28e6a97e39edb84599693db971e36d793d36e413'/>
<id>urn:sha1:28e6a97e39edb84599693db971e36d793d36e413</id>
<content type='text'>
In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either
when we lstat the new refname or if the name checking function reports that
the same type of conflict happened.  In both cases, it means that we can not
create the new ref due to a name conflict.

Start defining specific return codes for _commit.  TRANSACTION_NAME_CONFLICT
refers to a failure to create a ref due to a name conflict with another ref.
TRANSACTION_GENERIC_ERROR is for all other errors.

When "git fetch" is creating refs, name conflicts differ from other errors in
that they are likely to be resolved by running "git remote prune &lt;remote&gt;".
"git fetch" currently inspects errno to decide whether to give that advice.
Once it switches to the transaction API, it can check for
TRANSACTION_NAME_CONFLICT instead.

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs.c: pass the ref log message to _create/delete/update instead of _commit</title>
<updated>2014-10-15T17:47:22Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-04-30T19:22:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db7516ab9f435e3ce86b257c6631fb4d2dfb12ae'/>
<id>urn:sha1:db7516ab9f435e3ce86b257c6631fb4d2dfb12ae</id>
<content type='text'>
Change the ref transaction API so that we pass the reflog message to the
create/delete/update functions instead of to ref_transaction_commit.
This allows different reflog messages for each ref update in a multi-ref
transaction.

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'da/rev-parse-verify-quiet'</title>
<updated>2014-09-29T19:36:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-29T19:36:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=507fe835ed0753ff266fdb998853cc5dea3758c6'/>
<id>urn:sha1:507fe835ed0753ff266fdb998853cc5dea3758c6</id>
<content type='text'>
"rev-parse --verify --quiet $name" is meant to quietly exit with a
non-zero status when $name is not a valid object name, but still
gave error messages in some cases.

* da/rev-parse-verify-quiet:
  stash: prefer --quiet over shell redirection of the standard error stream
  refs: make rev-parse --quiet actually quiet
  t1503: use test_must_be_empty
  Documentation: a note about stdout for git rev-parse --verify --quiet
</content>
</entry>
<entry>
<title>Merge branch 'da/styles'</title>
<updated>2014-09-19T18:38:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83510ef3fda0df6acd6680410698a1762042a8af'/>
<id>urn:sha1:83510ef3fda0df6acd6680410698a1762042a8af</id>
<content type='text'>
* da/styles:
  stylefix: asterisks stick to the variable, not the type
</content>
</entry>
<entry>
<title>refs: make rev-parse --quiet actually quiet</title>
<updated>2014-09-19T17:46:15Z</updated>
<author>
<name>David Aguilar</name>
<email>davvid@gmail.com</email>
</author>
<published>2014-09-19T03:45:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c41a87dd80cd32cfd6e2d670153a9b69dc627f71'/>
<id>urn:sha1:c41a87dd80cd32cfd6e2d670153a9b69dc627f71</id>
<content type='text'>
When a reflog is deleted, e.g. when "git stash" clears its stashes,
"git rev-parse --verify --quiet" dies:

	fatal: Log for refs/stash is empty.

The reason is that the get_sha1() code path does not allow us
to suppress this message.

Pass the flags bitfield through get_sha1_with_context() so that
read_ref_at() can suppress the message.

Use get_sha1_with_context1() instead of get_sha1() in rev-parse
so that the --quiet flag is honored.

Signed-off-by: David Aguilar &lt;davvid@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
