git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* clean/smudge-filter with "attached file"?
@ 2022-01-26 12:52 Josef Wolf
  2022-01-26 20:06 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Wolf @ 2022-01-26 12:52 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: clean/smudge-filter with "attached file"?
  2022-01-26 12:52 clean/smudge-filter with "attached file"? Josef Wolf
@ 2022-01-26 20:06 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-01-26 20:06 UTC (permalink / raw)
  To: Josef Wolf; +Cc: git

Josef Wolf <jw@raven.inka.de> writes:

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

Perhaps post-checkout hook to notice missing checksum files and
recompute them would work, but this is clearly outside of what
clean/smudge wants to do and what they were invented for (i.e. the
contents of the file in the working tree itself need to be adjusted
in the working tree and in the repository, hence there is a filter
in each direction).  As the mechanism being "filter", i.e. a
bytestream is converted into another bytestream, it is not even
designed to muck with other things on the filesystem.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 12:52 clean/smudge-filter with "attached file"? Josef Wolf
2022-01-26 20:06 ` Junio C Hamano

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).