git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: "Дилян Палаузов" <dilyan.palauzov@aegee.org>
Cc: git@vger.kernel.org
Subject: Re: git diff --text does not work during rebase for binary files
Date: Mon, 22 Mar 2021 12:53:19 +0700	[thread overview]
Message-ID: <4ef94ca7-ec69-f350-1d76-6bb8745786f1@gmail.com> (raw)
In-Reply-To: <6afc8f1365627f08247f73da7e7e362c0b8ea560.camel@aegee.org>



On 22/03/21 00.30, Дилян Палаузов wrote:
> Hello,
> 
> I create a small text file ending with \0 and add it to git:

Did you mean `echo -e "\0" >> a.txt`?

> In .gitattributes I specify:
> 
> *.txt diff merge=text text
> 
> I create several commits by changing the small text file.
> 
> The result is at https://github.com/dilyanpalauzov/git-diff-biinary .
> 
> I do now
> 
>    git rebase -i HEAD~2
> and before the “second commit” type E to edit that commit.
> 
> I change the small file.
> 
> git add a.txt && git rebase --continue
> 
> git says:
> 
> [detached HEAD bc00e34] second commit
>   Date: Sun Mar 21 19:16:15 2021 +0200
>   1 file changed, 2 insertions(+), 1 deletion(-)
> warning: Cannot merge binary files: a.txt (HEAD vs. 04c77de (third
> commit))
> Auto-merging a.txt
> CONFLICT (content): Merge conflict in a.txt
> error: could not apply 04c77de... third commit
> Resolve all conflicts manually, mark them as resolved with
> "git add/rm <conflicted_files>", then run "git rebase --continue".
> You can instead skip this commit: run "git rebase --skip".
> To abort and get back to the state before "git rebase", run "git rebase
> --abort".
> Could not apply 04c77de... third commit
> 
> 
> 'git diff' and 'git diff --text' show:
> 
> diff --cc a.txt
> index 7a61015,dc817ec..0000000
> --- a/a.txt
> +++ b/a.txt
> 
> The file does not contain <<HEAD===>>> markers, despite having
> merge=text attribute.
> 
> HOW CAN I force git diff to show the differences and git merge to
> include the <<<===>>> markers?
> 
> I have to say, that at different occassions git diff --text does work
> ass expected (e.g. when I call git diff --cached --text).
> 
> I call now
> git rebase --abort
> git log -p
> 
> git shows the differences in the small text file ending with \0.  So
> apparently log reads the option, but diff does not.
> 
> Using git 2.30.2.
> 
> Greetings
>    Дилян
> 

Does `file a.txt` shows it as being binary file? I do the similar and it just says "data".

-- 
An old man doll... just what I always wanted! - Clara

  reply	other threads:[~2021-03-22  5:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 17:30 git diff --text does not work during rebase for binary files Дилян Палаузов
2021-03-22  5:53 ` Bagas Sanjaya [this message]
2021-03-22  8:45   ` Дилян Палаузов
2021-03-26 11:31     ` Jeff King

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=4ef94ca7-ec69-f350-1d76-6bb8745786f1@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=dilyan.palauzov@aegee.org \
    --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).