git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Elijah Newren <newren@gmail.com>,
	Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH 1/1] merge-file: add an option to process object IDs
Date: Tue, 24 Oct 2023 21:23:03 +0000	[thread overview]
Message-ID: <ZTg1t33cxzvmvAVK@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <CAPig+cT_yq-ke4RTpTdTTLsnJFxCtyGAP2K0mQ_S23jJYtUp=w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]

On 2023-10-24 at 20:12:52, Eric Sunshine wrote:
> On Tue, Oct 24, 2023 at 3:58 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > git merge-file knows how to merge files on the file system already.  It
> > would be helpful, however, to allow it to also merge single blobs.
> > Teach it an `--object-id` option which means that its arguments are
> > object IDs and not files to allow it to do so.
> >
> > Since we obviously won't be writing the data to the first argument,
> > either write to the object store and print the object ID, or honor the
> > -p argument and print it to standard out.
> >
> > We handle the empty blob specially since read_mmblob doesn't read it
> > directly, instead throwing an error, and otherwise users cannot specify
> > an empty ancestor.
> >
> > Signed-off-by: brian m. carlson <bk2204@github.com>
> > ---
> > diff --git a/builtin/merge-file.c b/builtin/merge-file.c
> > @@ -99,20 +116,29 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
> >         if (ret >= 0) {
> > -               const char *filename = argv[0];
> > -               char *fpath = prefix_filename(prefix, argv[0]);
> > -               FILE *f = to_stdout ? stdout : fopen(fpath, "wb");
> > +               if (object_id && !to_stdout) {
> > +                       struct object_id oid;
> > +                       if (result.size)
> > +                               write_object_file(result.ptr, result.size, OBJ_BLOB, &oid);
> 
> Should this be caring about errors by checking the return value of
> write_object_file()?

Probably so.  I think I saw write_object_file_prepare returned void and
misinterpreted that as write_object_file returning void.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2023-10-24 21:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 19:56 [PATCH 0/1] Object ID support for git merge-file brian m. carlson
2023-10-24 19:56 ` [PATCH 1/1] merge-file: add an option to process object IDs brian m. carlson
2023-10-24 20:12   ` Eric Sunshine
2023-10-24 21:23     ` brian m. carlson [this message]
2023-10-29  6:17   ` Elijah Newren
2023-10-29 10:12     ` Phillip Wood
2023-10-30 16:14       ` brian m. carlson
2023-10-29 14:18     ` brian m. carlson
2023-10-30 16:39       ` Elijah Newren
2023-10-29  6:24 ` [PATCH 0/1] Object ID support for git merge-file Elijah Newren
2023-10-29 10:15   ` Phillip Wood
2023-10-30 15:54   ` Taylor Blau
2023-10-30 16:24     ` brian m. carlson
2023-10-30 17:14       ` Elijah Newren
2023-10-30 16:26 ` [PATCH v2 " brian m. carlson
2023-10-30 16:26   ` [PATCH v2 1/1] merge-file: add an option to process object IDs brian m. carlson
2023-10-31 21:48     ` Martin Ågren
2023-10-31 22:31       ` brian m. carlson
2023-11-01  3:44         ` Junio C Hamano
2023-11-01 19:16           ` brian m. carlson
2023-10-30 17:15   ` [PATCH v2 0/1] Object ID support for git merge-file Elijah Newren
2023-10-31  0:03     ` Junio C Hamano
2023-10-31 11:05   ` Phillip Wood
2023-10-31 23:06     ` Junio C Hamano
2023-11-01 19:24 ` [PATCH v3 0/2] " brian m. carlson
2023-11-01 19:24   ` [PATCH v3 1/2] git-merge-file doc: drop "-file" from argument placeholders brian m. carlson
2023-11-01 23:53     ` Junio C Hamano
2023-11-02  8:53       ` Martin Ågren
2023-11-02  9:18         ` brian m. carlson
2023-11-02  9:29           ` Martin Ågren
2023-11-02 16:28         ` Junio C Hamano
2023-11-01 19:24   ` [PATCH v3 2/2] merge-file: add an option to process object IDs brian m. carlson
2023-11-02  8:51     ` Martin Ågren
2023-11-01 23:55   ` [PATCH v3 0/2] Object ID support for git merge-file 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=ZTg1t33cxzvmvAVK@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=sunshine@sunshineco.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).