git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Josef Wolf <jw@raven.inka.de>
To: git@vger.kernel.org
Subject: clean/smudge-filter with "attached file"?
Date: Wed, 26 Jan 2022 13:52:09 +0100	[thread overview]
Message-ID: <20220126125209.GD16463@raven.inka.de> (raw)

Hello,

I have an application, which creates XML data files with attached
checksum (uuencoded sha1) files. For example, the application might
create

  a/b/c              # XML file
  a/b/c.chsum        # chsum of this file
  a/b/d/e            # another XML file
  a/b/d/e.chsum      # chsum of this file

It creates hundreds of those files, some with chsum-files attached
and some not. And some of those files are XML, other are binary or
simple text.

In addition, this application "shuffles" content of those XML files,
which results in a lot of clutter when those files are tracked by git.

Unfortunately, the application refuses to load those files when the
checksum file does not match its contents.

Those files seemed to be good candidates for git's clean/smudge-filter.

A clean-filter would bring the files into a canonical format (that is,
sorted and whitespace-normalized) when the file is to be committed.

A smudge-filter would be used to re-calculate the checksum-files on
checkout/update.

Unfortunately, the description of clean/smudge-filters states:

   Note that "%f" is the name of the path that is being worked on.
   Depending on the version that is being filtered, the corresponding
   file on disk may not exist, or may have different contents. So,
   smudge and clean commands should not try to access the file on disk, but
   only act as filters on the content provided to them on standard input.

Uh! That means that the content the filter emits on stdout does not
nececcerily match the content that is supposed to be in the file when the
git command finishes? Thus, simply calculate the checksum and store it in
associated checksum file might result in a checksum failure when the
application tries to load those files?

Am I missing something? Or am I completely off the road?

Any help?

-- 
Josef Wolf
jw@raven.inka.de

             reply	other threads:[~2022-01-26 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 12:52 Josef Wolf [this message]
2022-01-26 20:06 ` clean/smudge-filter with "attached 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=20220126125209.GD16463@raven.inka.de \
    --to=jw@raven.inka.de \
    --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.
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).