Author Topic: Smartgit: Renaming only directory creates "removed/added" AND "renamed" files  (Read 630 times)

0 Members and 1 Guest are viewing this topic.

Offline eTobeyTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: de
    • Virtual feature script
After a rename of a folder, git only recognizes a portion of the files as renamed. Interestingly, there is nothing logical i could investigate on: Files in the same folder show as "added/removed" or "renamed", even if they have a very similar name! And of course i havent changed their content.

I tried several times, to find some clues, but i didnt find any. I also have only renamed the directory, to rule out any other problem creating causes.

I cant imagine, git beeing so unreliable, so i guess its smartgit fault? How can i check with git alone?
"Sometimes, after talking with a person, you want to pet a dog, wave at a monkey, and take off your hat to an elephant." (Maxim Gorki)

sincetheSDS800XHDhasatroublesomekeyboardandidontlikedoingunecessaryclicksmylabelsusuallylooklikethistext
 

Offline eTobeyTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: de
    • Virtual feature script
Git can not find a moved/renamed file  (at some circumstances), even if the content is identical:
I have renamed 2 directorys which had files of the same filename, but different content in it. It looked, as it would work, but when the files were staged, it all got messed up.

The workaround is to simply do every rename in its own commit. Not such a great tool as i have thought ::)

The problem for me was, the comparing of two commits of the file would not work in smartgit when it was removed/added. But it still keept somehow track of it as the same file. Strange at the very least.

( Yes, its only negative feedback )
"Sometimes, after talking with a person, you want to pet a dog, wave at a monkey, and take off your hat to an elephant." (Maxim Gorki)

sincetheSDS800XHDhasatroublesomekeyboardandidontlikedoingunecessaryclicksmylabelsusuallylooklikethistext
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Did you rename with the command git mv? That's a very usual catch for the young players.
 

Offline eTobeyTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: de
    • Virtual feature script
No i havent.

I have read a lot of times, that mv is just like remove and add together. So it wouldnt make a difference then?

But also it showed the desired result before the files were staged, so it worked somehow. Why did that change after the files were staged?
"Sometimes, after talking with a person, you want to pet a dog, wave at a monkey, and take off your hat to an elephant." (Maxim Gorki)

sincetheSDS800XHDhasatroublesomekeyboardandidontlikedoingunecessaryclicksmylabelsusuallylooklikethistext
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2496
  • Country: gb
Perhaps try to recreate the problem in the simplest possible case. Then it's easier for others to try it out and help answer your question.
 

Offline eTobeyTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: de
    • Virtual feature script
Perhaps try to recreate the problem in the simplest possible case. Then it's easier for others to try it out and help answer your question.

I would have done that, but i found a workaround. After my experience with the Siglent crew and the bugs/issues of that SDS800X HD, i rather not waste much more time anymore to try to contribute to the community, if the outcome seems to be near 0, and me getting scolded too.
"Sometimes, after talking with a person, you want to pet a dog, wave at a monkey, and take off your hat to an elephant." (Maxim Gorki)

sincetheSDS800XHDhasatroublesomekeyboardandidontlikedoingunecessaryclicksmylabelsusuallylooklikethistext
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
No i havent.

I have read a lot of times, that mv is just like remove and add together. So it wouldnt make a difference then?

git mv is not mv, that's the whole point. Start by googling git mv. It's such common catch for young players you will find as much guidance and tutorials as you would ever need.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15683
  • Country: fr
IME, if you always use 'git add .' before committing, it will track all additions/renames/deletes... so that's enough.
Now, if you want more fine-grained tracking, rather than brutally track every change you made to your local repo, git mv is an option. (I think you also have git rm to remove one file from tracking.)
I tend to prefer 'git add .' to have an exact mirror of my changes, and I haven't seen any issues with that so far.

But I don't particularly like git (I for one prefer Mercurial), so I may be missing some ultra important factor that would make what I said above too risky or not doing exactly what I think it does, so take that with a pinch of salt.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 4098
  • Country: 00
After a rename of a folder, git only recognizes a portion of the files as renamed.

In order to properly rename or move file or folder, you need to execute
Code: [Select]
git mv <old_name> <new_name>

before commit you can check if all changes are correct with
Code: [Select]
git status

Remember, git is command line tool, so don't believe GUI shells and extensions and check the status with command line before commit
« Last Edit: November 03, 2024, 09:42:51 pm by radiolistener »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf