Re: git reset --hard can leave modified files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 02, 2022 at 10:07:11PM +0000, Mirochnik, Oleg V wrote:
[]
> >
> > In other words
> > (I may be wrong due a lack of time to dig deeper into the llvm repo) the problem
> > seems to come from upstream.
> >
> > And we could find out, what upstream really wants and needs, and may be able
> > to help here.
> >
> > Is this maybe something you can do, contact upstream ?
> No, I could not as I'm not a llvm contributor.
You can become one ;-)

> Here is another related discussion, hopefully could be useful -- https://reviews.llvm.org/D48494
>
> Actually, I don't quite understand what your suggestions are.
>
> Are you telling it's not a git bug but an invalid setup in the llvm-project repo?
Yes

> If so, then I'd suggest you (or git community) provide a clear description
> (or link to a related document) what needs to be done to make it valid
> and I'd ask one of our contributors to propose a correspondent fix into the upstream.
> Or you agree it's a bug.
> Then I'd ask to propose your recommendations as a temporary (or permanent) workaround.
>
> Could you please clarify?

Now, the documentation, which I think you ask for, is here:
https://git-scm.com/docs/gitattributes

If I look at the repo, commit 4ff40855fcc0c1320f31350bc9e93d4d6ce6891f
(HEAD -> git-bug-reproducer, origin/git-bug-reproducer)

and run the official eol-diagnostic tool:
$ git ls-files --eol >eol-prob.txt
and then
$ grep "^i/crlf.*attr/text" eol-prob.txt
I get 9 files listed, so I pick the first one for a discussion:

i/crlf  w/crlf  attr/text eol=crlf      clang-tools-extra/test/clang-apply-replacements/Inputs/crlf/crlf.cpp

What we have in the repo is a "conflict".
The attributes says it is a text file, and the index file (what had been commited)
has CRLF.
Git can not resolve the conflict.
(setting text=auto could work. Or normalize. Or both. Normalization is recomended anyway)

So, the solution would be to renormalize all files:

$ git add --renormalize .
(The . is important)

After that you will see those 9 files modified, and they need to be commited.

In general, for a cross-platform project, it could be useful to set up a
.gitattributes file in the top directory, with one line:
* text=auto

That file can then be tweaked for BAT or sh files as needed.

That should all be in the documentation - if not, please ask and/or send us
patches.











[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux