Portál AbcLinuxu, 12. května 2025 15:31
# diff -ruN projekt.stary projekt.novy > projekt.patch
[projekt.opatchovany]# patch -p1 -i ../projekt.patch
Po tomto mi tam ostanú aj staré nepotrebné súbory v opatchovanom projekte ako som písal.
Neviete prosim niekto aký použiť prepínač? Ďakujem pekne.
patch -E -p1 -i ../projekt.patch
-E or --remove-empty-files Remove output files that are empty after the patches have been applied. Normally this option is unneces- sary, since patch can examine the time stamps on the header to determine whether a file should exist after patching. However, if the input is not a context diff or if patch is conforming to POSIX, patch does not remove empty patched files unless this option is given. When patch removes a file, it also attempts to remove any empty ancestor directories.
$ find . ./patch ./test ./test/a ./test/a/a ./test/b ./test/b/b ./test/c ./test/c/c ./test2 ./test2/a ./test2/a/a ./test2/b ./test2/b/b ./test2/d ./test2/d/d$ diff -ruN test test2 > patch:
$ cat patch diff -ruN test/a/a test2/a/a --- test/a/a 2010-12-30 20:41:47.453125000 +0100 +++ test2/a/a 2010-12-30 20:37:17.656250000 +0100 @@ -1,2 +1 @@ 1 -2 diff -ruN test/b/b test2/b/b --- test/b/b 2010-12-30 20:41:50.078125000 +0100 +++ test2/b/b 2010-12-30 20:37:20.437500000 +0100 @@ -1,2 +1 @@ 1 -2 diff -ruN test/c/c test2/c/c --- test/c/c 2010-12-30 20:40:32.640625000 +0100 +++ test2/c/c 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -1 diff -ruN test/d/d test2/d/d --- test/d/d 1970-01-01 01:00:00.000000000 +0100 +++ test2/d/d 2010-12-30 20:41:16.390625000 +0100 @@ -0,0 +1 @@ +1/test/$ patch -p1 -i ../patch
patching file a/a patching file b/b patching file c/c patching file d/d
$ find . ./patch ./test ./test/a ./test/a/a ./test/b ./test/b/b ./test/d ./test/d/d ./test2 ./test2/a ./test2/a/a ./test2/b ./test2/b/b ./test2/d ./test2/d/dPuvodni adresar c/ a soubor c to odstranilo a naopak pridalo adresar d/ a soubor d. Takze netusim :D.. NN
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.