git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thomas Braun <thomas.braun@virtuell-zuhause.de>
To: Michael Ernst <mernst@cs.washington.edu>, git@vger.kernel.org
Subject: Re: Feature request: a merge strategy that makes any file difference a merge conflict
Date: Mon, 1 Apr 2024 13:00:59 +0200	[thread overview]
Message-ID: <17b55da7-42d0-48df-95a6-8433e1c028b0@virtuell-zuhause.de> (raw)
In-Reply-To: <CAAJCdQQB3_DWOTCTbb-TAkLUX_XVd5TBd3z0M2_KrHxKxr69Kw@mail.gmail.com>

On 29.03.2024 20:20, Michael Ernst wrote:

[...]

> What do you think of this feature request?

I wanted to propose to mark the relevant files as binary as that should 
prevent the merge to happen. But this is not working.

git init

echo "*.txt binary" > .gitattributes
git add .gitattributes
git commit -m ".gitattributes: Add it" .gitattributes

echo "a" > test.txt
git add test.txt
git commit -m "test.txt: main" test.txt

git checkout -b feature
echo "ab" > test.txt
git commit -m "test.txt: feature" test.txt

git checkout main
git merge --no-ff --stat --no-edit  feature

Merge made by the 'ort' strategy.
  test.txt | Bin 22 -> 3 bytes
  1 file changed, 0 insertions(+), 0 deletions(-)

git log -p test.txt
commit ec7cab2fa30c26738c6254202a399a616959a661 (feature)
Author: Thomas Braun <thomas.braun@byte-physics.de>
Date:   Mon Apr 1 12:56:07 2024 +0200

     test.txt: feature

diff --git a/test.txt b/test.txt
index 346a56a..81bf396 100644
Binary files a/test.txt and b/test.txt differ

commit 61e195554351dada7494e4eb4935d96120680420
Author: Thomas Braun <thomas.braun@byte-physics.de>
Date:   Mon Apr 1 12:50:29 2024 +0200

     test.txt: main

diff --git a/test.txt b/test.txt
new file mode 100644
index 0000000..346a56a
Binary files /dev/null and b/test.txt differ

I would have expected to see a merge conflict as git can't know how to 
merge binaries. Or am I misunderstanding something here?


      parent reply	other threads:[~2024-04-01 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 19:20 Feature request: a merge strategy that makes any file difference a merge conflict Michael Ernst
2024-03-29 19:40 ` Junio C Hamano
2024-03-29 20:43   ` Michael Ernst
2024-04-01 11:00 ` Thomas Braun [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

  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=17b55da7-42d0-48df-95a6-8433e1c028b0@virtuell-zuhause.de \
    --to=thomas.braun@virtuell-zuhause.de \
    --cc=git@vger.kernel.org \
    --cc=mernst@cs.washington.edu \
    /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).