git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Dmitry Potapov <dpotapov@gmail.com>
Cc: Alexander Litvinov <litvinov2004@gmail.com>,
	git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Subject: Re: [PATCH] hash-object --no-filters
Date: Sat, 02 Aug 2008 10:28:13 -0700	[thread overview]
Message-ID: <7vmyjvnx76.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080801220932.GK7008@dpotapov.dyndns.org> (Dmitry Potapov's message of "Sat, 2 Aug 2008 02:09:32 +0400")

Dmitry Potapov <dpotapov@gmail.com> writes:

> The --no-filters option makes git hash-object to work as there were no
> input filters. This option is useful for importers such as git-svn to
> put new version of files as is even if autocrlf is set.

I think this is going in the right direction, but I have to wonder a few
things.

First, on hash-object.

 (1) "hash-object --stdin" always hashes literally.  We may want to be
     able to say "The contents is this but pretend it came from this path
     and apply the usual input rules", perhaps with "--path=" option;

 (2) "hash-object temporaryfile" may want to honor the same "--path"
     option;

 (3) "hash-object --stdin-paths" may want to get pair of paths (i.e. two
     lines per entry) to do the same.

If we want to do the above, the existing low-level interface needs to be
adjusted.

index_pipe() and index_fd() can learn to take an additional string
parameter for attribute lookup to implement (1) and (2) above.  Perhaps
the string can be NULL to signal --no-filter behaviour, in which case the
HASH_OBJECT_LITERALLY change may not be necessary for this codepath.

index_path() is a healper for add_to_index() which is used for normal
addition of working tree entities, and I do not see an immediate need to
teach it about this "use this different path for attribute lookup" at
least for now.

By the way, why do we have index_pipe() and index_fd() to begin with?  Is
it because users of index_pipe() do not know what the path it is hashing
and also the fd being a pipe we cannot mmap it?

If these two are the only reasons, then I wonder if we can:

 - accept NULL as path and stat parameters for callers without a filename
   (which automatically implies we are doing a regular blob and we hash
   literally); and

 - first try to mmap(), and if it fails fall back to the "read once into
   strbuf" codepath to solve mmap-vs-pipe issue.

I am not sure if such a unification of these two functions is useful,
though.

  parent reply	other threads:[~2008-08-02 17:29 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  8:44 git-svn does not seems to work with crlf convertion enabled Alexander Litvinov
2008-07-23  9:18 ` Johannes Schindelin
2008-07-23 11:52   ` Alexander Litvinov
2008-07-23 12:57     ` Johannes Schindelin
2008-07-23 15:49       ` Avery Pennarun
2008-07-23 16:07         ` Johannes Schindelin
2008-07-24  3:13       ` Alexander Litvinov
2008-08-06 11:15       ` Petr Baudis
2008-08-06 12:35         ` Peter Harris
2008-08-06 12:43         ` Johannes Schindelin
2008-08-06 13:51           ` git-svn on MSysGit and why is it (going to be?) unsupported Petr Baudis
2008-08-06 15:23             ` Avery Pennarun
2008-08-06 16:11         ` git-svn does not seems to work with crlf convertion enabled Dmitry Potapov
2008-07-24 14:24     ` Dmitry Potapov
2008-07-24 14:40       ` Johannes Schindelin
2008-07-24 16:28         ` Avery Pennarun
2008-07-30  4:37   ` Alexander Litvinov
2008-07-31  5:43   ` [PATCH] git-svn now " Alexander Litvinov
2008-07-31  5:57     ` Alexander Litvinov
2008-07-31 10:45       ` Dmitry Potapov
2008-07-31 19:09         ` [RFC] hash-object --no-filters Dmitry Potapov
2008-08-01  3:23         ` [PATCH] git-svn now work with crlf convertion enabled Alexander Litvinov
2008-08-01  5:09           ` Junio C Hamano
2008-08-01  7:44             ` Dmitry Potapov
2008-08-01 11:27               ` Alexander Litvinov
2008-08-01  7:47           ` Dmitry Potapov
2008-08-01  8:08             ` Junio C Hamano
2008-08-01  9:24               ` Dmitry Potapov
2008-08-01 19:42                 ` Junio C Hamano
2008-08-01 22:09                   ` Dmitry Potapov
2008-08-01 22:14                     ` Junio C Hamano
2008-08-01 23:10                       ` Dmitry Potapov
2008-08-02 17:28                     ` Junio C Hamano [this message]
2008-08-03  5:42                       ` [PATCH] hash-object --no-filters Dmitry Potapov
2008-08-03  5:56                         ` Dmitry Potapov
2008-08-03 14:36                           ` [PATCH 1/5] correct argument checking test for git hash-object Dmitry Potapov
2008-08-03 14:36                             ` [PATCH 2/5] correct usage help string for git-hash-object Dmitry Potapov
2008-08-03 14:36                               ` [PATCH 3/5] use parse_options() in git hash-object Dmitry Potapov
2008-08-03 14:36                                 ` [PATCH 4/5] add --path option to " Dmitry Potapov
2008-08-03 14:36                                   ` [PATCH 5/5] add --no-filters " Dmitry Potapov
2008-08-03 20:44                           ` [PATCH] hash-object --no-filters Junio C Hamano
2008-08-01 11:11               ` [PATCH] git-svn now work with crlf convertion enabled Alexander Litvinov
2008-08-01 12:36                 ` Dmitry Potapov
2008-08-04  3:10                   ` Alexander Litvinov
2008-08-04  0:48     ` Eric Wong

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=7vmyjvnx76.fsf_-_@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=litvinov2004@gmail.com \
    --cc=normalperson@yhbt.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).