Replying to myself...
JCH> While you are at it, you might also want to add an option to
JCH> write-blob to specify the type of the object you are hashing, so
JCH> that would make [*1*]:
JCH> git-write-blob [-n] [-t <type>] <file>...
JCH> [Footnote]
JCH> *1* I considered this instead:
JCH> git-write-blob [-n | -t <type>] <file>...
JCH> which means that if you specify type then -n is implied. But
JCH> making -t independent would let you have inverse of
JCH> git-cat-file; a silly example:
JCH> $ git-cat-file -t $FOO
JCH> tree
JCH> $ git-cat-file tree $FOO >tmp1
JCH> $ FOO1=$(git-write-blob -t tree tmp1)
JCH> If we go this route, we may also want to rename it to
JCH> write-object, but I would want to have it as a separate patch
JCH> after this series settles down.
Come to think of it, there is only one in-tree user of
write-blob remaining. Renaming it to hash-object, changing the
default behaviour to just hash without storing and instead give
it --write (or just -w) flag would make more sense. Without -t,
the type should default to "blob".
Then, the above stupid example would then become:
$ git-cat-file -t $FOO
tree
$ git-cat-file tree $FOO >tmp1
$ FOO1=$(git-hash-object -t tree tmp1)
And the only in-tree user git-cvsimport-script would be changed to:
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -683,7 +683,7 @@ while(<CVS>) {
$fn =~ s#^/+##;
my ($tmpname, $size) = $cvs->file($fn,$rev);
print "".($init ? "New" : "Update")." $fn: $size bytes.\n" if
$opt_v;
- open my $F, '-|', "git-write-blob $tmpname"
+ open my $F, '-|', "git-hash-object -w $tmpname"
or die "Cannot create object: $!\n";
my $sha = <$F>;
chomp $sha;
-
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