git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Merging branches with smudge filter

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 9, 2016, 09:15 UTC
Message-ID
<56B9AE20.70905@drmicha.warpmail.net>
In-Reply-To
<CACqLfM=G-=kD+wnDG-oWz4-eKW1ET_vnsenEXdCDwRsv0YXcSA@mail.gmail.com>

[Please bottom-reply on this list] Leonardo venit, vidit, dixit 08.02.2016 18:52:

Show 7 quoted lines
> Hi. I understand what you mean, but if that's the case, I don't get
> how every file was merged successfully despite the encryption, except
> two of them. I thought the smudge filter was supposed to be applied to
> every blob before any git operation, thus exposing the clean source
> code. Well, in the end I've merged these two files manually. I think I
> might have done something wrong while branching. I'm still learning.
> Next time I'll be more attentive.

Simple rule with filters: "cleaned" is what is stored in the repo (as blobs) "smudged" is what you see in your files in the working tree

Now, if Git is asked to merge two revisions and some blobs were not changed at all, or only by one side of the merge, these parts of the merge can be resolved trivially.

The others can't. You may want to try merge tools, or even a custom merge driver (see git-merge man page).

Michael
Show 24 quoted lines
> 2016-02-08 15:32 GMT-02:00 Junio C Hamano <gitster@pobox.com>:
>> Leonardo <leobasilio@gmail.com> writes:
>>
>>> Hi, everybody. I'm new to git and I'd like to keep track of some codes
>>> we have here in our company. They have some sensitive information I
>>> would like to keep private. After some googling, I found some
>>> solutions that encrypt/decrypt the files using filters as they're
>>> committed/checked out. I've been using this approach and it suits my
>>> needs. Now I need to merge two branches, but the process is failing
>>> for two files in particular. First of all, here's my config file:
>>>
>>> [filter "openssl"]
>>>     clean = openssl enc -aes-256-cbc -a -nosalt -pass pass:password
>>>     smudge = openssl enc -d -aes-256-cbc -a -nosalt -pass pass:password
>>>     required
>>
>> Git works on the "clean" representation of the data, i.e. the
>> representation of the blob object stored in the object database and
>> in the index, when manipulating the contents, e.g. diffing two
>> variants, patching (think "add -p"), merging, etc.
>>
>> As you are making the "clean" version an encrypted opaque sequence
>> of bytes, it is expected that you wouldn't be able to run 3-way
>> merges.
Previous: Leonardo
Message 4 of 4 in “Merging branches with smudge filter”
  1. LeonardoFeb 4, 2016
  2. Junio C HamanoFeb 8, 2016
  3. LeonardoFeb 8, 2016
  4. Michael J GruberFeb 9, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.