git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ZheNing Hu <adlternative@gmail.com>
To: Git List <git@vger.kernel.org>, ZheNing Hu <adlternative@gmail.com>
Subject: Re: [QUESTION] how to diff one blob with nothing
Date: Fri, 28 Jul 2023 11:35:28 +0800	[thread overview]
Message-ID: <CAOLTT8TOs2eTryXWTy5aZ8BGNAymgjrsg1BCLbigFunkFpc7JQ@mail.gmail.com> (raw)
In-Reply-To: <20230727171334.6qg2xtecvmplg3or@carbon>

Konstantin Khomoutov <kostix@bswap.ru> 于2023年7月28日周五 01:13写道:
>
> >> If you haven't created one, of course it would fail.  It should help
> >> to do
> >>
> >>     $ git hash-object -w --stdin </dev/null
> >>
> >> before running
> >>
> >>     $ git diff 00750edc e69de29bb
> >>
> >
> > This is a viable solution, but it's a bit ugly since a read-only "diff"
> > requires ”write“ an empty blob.
>
> You could probably just do
>
>   git cat-file -s e69de29bb
>
> to figure out whether a blob is empty.
>
> What is your end goal? Do you indeed want to produce a "trivial patch" which
> merely "adds" all the lines of the blob you'd like to compare to an empty one
> (assuming the blob conains text)?
>

Yes, I need to compare the diff between multiple versions of blobs in real time
(only given the blobID). Once a file is deleted or created, I have to
perform this
comparison with the "empty blob".

      reply	other threads:[~2023-07-28  3:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  9:59 [QUESTION] how to diff one blob with nothing ZheNing Hu
2023-07-19 16:15 ` Junio C Hamano
2023-07-26 18:00   ` ZheNing Hu
2023-07-26 18:23     ` Junio C Hamano
2023-07-27 17:46       ` Taylor Blau
2023-07-28  3:40         ` ZheNing Hu
2023-08-03  5:16           ` ZheNing Hu
2023-08-03 15:24             ` Taylor Blau
2023-08-04  2:28               ` ZheNing Hu
2023-08-04  8:28                 ` Christian Couder
2023-08-04 18:34                   ` Taylor Blau
2023-08-04 19:00                     ` Junio C Hamano
2023-08-05  8:27                       ` ZheNing Hu
2023-07-27 17:13     ` Konstantin Khomoutov
2023-07-28  3:35       ` ZheNing Hu [this message]

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=CAOLTT8TOs2eTryXWTy5aZ8BGNAymgjrsg1BCLbigFunkFpc7JQ@mail.gmail.com \
    --to=adlternative@gmail.com \
    --cc=git@vger.kernel.org \
    /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).