OPNsense Forum

English Forums => Development and Code Review => Topic started by: dinguz on November 28, 2021, 09:32:53 PM

Title: how to force a download of accidentally deleted files?
Post by: dinguz on November 28, 2021, 09:32:53 PM

I have done this:

    # pkg install git
    # cd /usr
    # git clone https://github.com/opnsense/tools
    # cd tools
    # make update


After that, I have made some local changes to build a custom kernel, which worked fine.
However, I accidentally removed some files. How do I download them again? If I do 'make update' it recognizes them as locally deleted, but doesn't seem to offer an option to re-download them.
Title: Re: how to force a download of accidentally deleted files?
Post by: rackg on November 29, 2021, 02:41:59 AM
Use git checkout restore deleted file from git repository. Also you can use the command git rev-list to find the checksum of the deleted commit. You can check out that commit too.
Title: Re: how to force a download of accidentally deleted files?
Post by: dinguz on November 29, 2021, 09:59:14 PM
Everything seems to be wrapped in these 'make' commands. Are we supposed to invoke 'git' directly?
Besides that, I am not sure what is the right syntax for these commands is.

root@jdjdehaan:/usr/tools # git checkout /usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf
fatal: /usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf: '/usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf' is outside repository at '/usr/tools'
root@jdjdehaan:/usr/tools # git checkout src/opnsense/service/templates/OPNsense/Proxy/squid.conf
error: pathspec 'src/opnsense/service/templates/OPNsense/Proxy/squid.conf' did not match any file(s) known to git

Title: Re: how to force a download of accidentally deleted files?
Post by: rackg on November 30, 2021, 01:51:53 AM
AFAIK Tools directory does only make update, however git management should be done directly. You have tired the command out side the repository i.e from /usr/tool instead of /usr/core/ hence it failed. You need to change the corresponding directory  to /usr/core/ before you try any git command. For more details @ https://www.git-tower.com/learn/git/faq/restoring-deleted-files will help you.
Title: Re: how to force a download of accidentally deleted files?
Post by: dinguz on November 30, 2021, 06:31:08 AM
Thanks, I supposed I made some trivial mistake but couldn't find out what exactly  ;)