Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


davidcole

4970 posts

Uber Geek

Trusted

#277335 8-Oct-2020 14:26
Send private message quote this post

I'm working on a script that will copy from a cloned git repository to an external folder.

 

I can get the files changed with

 

git diff --diff-filter=M --name-only /git/folder /e/folder

 

/git/folder has 1 file in it, a config file.

 

/e/folder has the config file and others (binaries etc).

 

What I want to know if if I can get if the /e/folder has something in it only.  If /git/folder has modifications then that's allowed as I'll copy that file over to top.  But I want to detected that a modification has been made to e/folder which is the dest, and stop the process so the user can sort it out.   I can't easily use the repository for holding the config and the binaries.

 

I'm trying to source control configuration files on servers to be able to track changes etc to them, and later automate their deployment.

 

 





Previously known as psycik

OpenHAB: Gigabyte AMD A8 BrixOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Xiaomi Humidity and Temperature sensors and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 10
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


Create new topic
  #2581362 8-Oct-2020 14:39
Send private message quote this post

If you want to check if the E folder's file contents is the same as a revision that already exists in the repository, you could use git show to get an older revision and compare the two.


davidcole

4970 posts

Uber Geek

Trusted

  #2581720 9-Oct-2020 07:15
Send private message quote this post

So git show, shows the files changed in the last commit?  But what if there's been multiple commits that haven't been applied to e?

 

This is why i assumed I needed diff, but I only care about a diff where teh result is a + or -, depending on the direction of the diff I can show just modifications, but you don't seem to be able to ignore all + or -...as then I'd be able to say, yes the e version has had a a modification so stop.....

 

 





Previously known as psycik

OpenHAB: Gigabyte AMD A8 BrixOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Xiaomi Humidity and Temperature sensors and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 10
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


 
 
 
 


marpada
337 posts

Ultimate Geek


  #2581795 9-Oct-2020 10:01
Send private message quote this post

Is /e/folder a regular folder or a git repository (remote)? If the former I don't think any git command will show you the difference between the two, but you can use the regular diff command to compare them or rsync to copy the changes back and forth.


davidcole

4970 posts

Uber Geek

Trusted

  #2581804 9-Oct-2020 10:24
Send private message quote this post

marpada:

 

Is /e/folder a regular folder or a git repository (remote)? If the former I don't think any git command will show you the difference between the two, but you can use the regular diff command to compare them or rsync to copy the changes back and forth.

 

 

/e/folder is reguler and git diff does seem to sucessfully comppare working copy to the regular folder.

 

So if theres a difference in the working copy it does:

 

--- a/Common/Apps/ArchiveMerge/config.xml
+++ b/E:/Apps/ArchiveMerge/config.xml
-<!-- change in git -->

 

And if the other way around

 

--- a/Common/Apps/ArchiveMerge/config.xml
+++ b/E:/Apps/ArchiveMerge/config.xml
+  <!-- change in working -->

 

But Ideally for my script to work, I'm happy for the -<!-- change in git --> to be ignored, as I'm about to sort that.....but if I see the  +  <!-- change in working --> I want to stop and alert the user.

 

 





Previously known as psycik

OpenHAB: Gigabyte AMD A8 BrixOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Xiaomi Humidity and Temperature sensors and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 10
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


davidcole

4970 posts

Uber Geek

Trusted

  #2581818 9-Oct-2020 10:56
Send private message quote this post

So this might be ridicuously hacky....but I think I can now Identify the b side changes:

 

git diff  --output-indicator-new=~ --diff-filter=M  Common/Apps/ /e/Apps/ | cut -c1 | grep -e \~

 

Changes the new indicator to ~ and then I go looking for that character which is a change on working copy side.

 

 





Previously known as psycik

OpenHAB: Gigabyte AMD A8 BrixOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Xiaomi Humidity and Temperature sensors and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 10
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


Create new topic





News »

Nanoleaf enhances lighting line with launch of Triangles and Mini Triangles
Posted 17-Oct-2020 20:18


Synology unveils DS1621+ 
Posted 17-Oct-2020 20:12


Ingram Micro introduces FootfallCam to New Zealand channel
Posted 17-Oct-2020 20:06


Dropbox adopts Virtual First working policy
Posted 17-Oct-2020 19:47


OPPO announces Reno4 Series 5G line-up in NZ
Posted 16-Oct-2020 08:52


Microsoft Highway to a Hundred expands to Asia Pacific
Posted 14-Oct-2020 09:34


Spark turns on 5G in Auckland
Posted 14-Oct-2020 09:29


AMD Launches AMD Ryzen 5000 Series Desktop Processors
Posted 9-Oct-2020 10:13


Teletrac Navman launches integrated multi-camera solution for transport and logistics industry
Posted 8-Oct-2020 10:57


Farmside hits 10,000 RBI customers
Posted 7-Oct-2020 15:32


NordVPN starts deploying colocated servers
Posted 7-Oct-2020 09:00


Google introduces Nest Wifi routers in New Zealand
Posted 7-Oct-2020 05:00


Orcon to bundle Google Nest Wifi router with new accounts
Posted 7-Oct-2020 05:00


Epay and Centrapay partner to create digital gift cards
Posted 2-Oct-2020 17:34


Inseego launches 5G MiFi M2000 mobile hotspot
Posted 2-Oct-2020 14:53









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.