git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Turner <dturner@twopensource.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, David Turner <dturner@twitter.com>
Subject: Re: [PATCH v4 3/3] cat-file: add --follow-symlinks to --batch
Date: Mon, 11 May 2015 18:31:11 -0400	[thread overview]
Message-ID: <1431383471.15048.9.camel@ubuntu> (raw)
In-Reply-To: <xmqqd2263lxf.fsf@gitster.dls.corp.google.com>

On Mon, 2015-05-11 at 13:21 -0700, Junio C Hamano wrote:
dturner@twopensource.com writes:
> 
> > +--follow-symlinks::
> > +	Follow symlinks inside the repository.  Instead of providing
> > +	output about the link itself, provide output about the linked-to
> > +	object.  This option requires --batch or --batch-check.  In the
> > +	event of a symlink loop (or more than 40 symlinks in a symlink
> > +	resolution chain), the file will be treated as missing.  If a
> > +	symlink points outside the repository (e.g. a link to /foo or a
> > +	root-level link to ../foo), the portion of the link which is
> > +	outside the repository will be printed.  Follow-symlinks will
> > +	be silently turned off if <object> specifies an object in the
> > +	index rather than one in the object database.
> 
> One thing that I found is missing from the above and other places in
> the documents updated by this patch, when I pretend that I am an
> end-user who never saw the discussion for the problem definition and
> design of the solution on the list, is what "symlink" this refers
> to and how I am expected to use this feature.
> 
I'll send something like this when I re-roll:

Follow symlinks inside the repository when requesting objects with
extended SHA-1 expressions of the form tree-ish:path-in-tree. Instead of
providing output about the link itself, provide output about the
linked-to object.  This option requires --batch or	--batch-check.  In
the event of a symlink loop (or more than 40 symlinks in a symlink
resolution chain), the file will be treated as missing.  If a symlink
points outside the tree-ish (e.g. a link to /foo or a root-level link
to ../foo), the portion of the link which is outside the tree will be
printed. Follow-symlinks will be silently turned off if <object>
specifies an object in the index rather than one in the object database.

I could also provide some examples, if you think this would be useful.

> +If --follow-symlinks is used, and a symlink in the repository points
> > +outside the repository, then `cat-file` will ignore any custom
format
> > +and print:
> > +
> > +------------
> > +symlink SP <size> LF <symlink> LF
> > +------------
> 
> A symlink contain LF, obviously, and we should use some quoting
> convention.  Perhaps quote_c_style() on a string that needs it is
> sufficient---most sane people do not put LF or literally '\' 'n' or
> '"' in their symbolic links, so the ugly output is not visible for
> them, and it is far better to be able to say "If you have funny
> characters in your symlinks, they will be quoted" than "If you have
> funny characters in your symlinks, you are SOL".
> 
There is no need for quoting because <size> is sufficient to
disambiguate the parsing (just as is the case for blobs, which might
contain arbitrary characters).

  reply	other threads:[~2015-05-11 22:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 17:56 (unknown), dturner
2015-05-11 17:56 ` [PATCH v4 1/3] tree-walk: learn get_tree_entry_follow_symlinks dturner
2015-05-11 17:56 ` [PATCH v4 2/3] sha1_name: get_sha1_with_context learns to follow symlinks dturner
2015-05-11 19:42   ` Junio C Hamano
2015-05-11 17:56 ` [PATCH v4 3/3] cat-file: add --follow-symlinks to --batch dturner
2015-05-11 20:21   ` Junio C Hamano
2015-05-11 22:31     ` David Turner [this message]
2015-05-11 22:39       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1431383471.15048.9.camel@ubuntu \
    --to=dturner@twopensource.com \
    --cc=dturner@twitter.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).