| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
In silent mode, loops which do nothing but print messages turn into
no-ops. Skip them completely to save some time.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Keep /dev/null opened as we will need it repeatedly. Avoiding
repeated calls to open brings a small performance boost.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
| |
Drop support for backup removal (option -x). Quilt doesn't use it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
| |
Drop support for -L on restore, quilt doesn't use it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
The two callers of restore_fast already know if they are operating on
an empty or non-empty backup-file. Move the code back to the calling
sites, to avoid this redundant test.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Misc cleanups:
* Add my copyright and simplify the reference to the initial version.
* Drop the program description, as it is redundant with the usage
function.
* Clarify the usage message, to make it clear what each option is
doing, and which ones are compatible with each other.
* Let the script complain if no action is given, as this has to be a
user or developer error.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When copying many files to a snapshot directory, try a mass copy
first, as it is much faster. It is however not portable and may thus
fail. If it fails, fallback to per-file processing, which always
works.
This change results in a huge performance boost on systems where
the cp command supports all the required options (which includes
all systems using GNU coreutils.)
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Create a dedicated function for mass-copying files. At the moment it
isn't bringing any gain, but this will get improved next.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We are abusing backup-files's "backup" function for quilt snapshot.
What we need is semantically different, and it works almost by
accident. We don't want linked copies of the files, we want real
copies, and the fact that "quilt snapshot" may touch the working
files is a little frightening IMHO.
So, implement a separate "copy" function which does what we need. Not
only it does the right thing, but it will also be somewhat faster
than "backup", as we can do straight copies of the files without
checking for their link count first.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
| |
The mass link/copy will create the required directories by itself if
it succeeds. As files being removed don't require the creation of a
directory, this means we can move the creation of the directories
to the case where non-empty files have to be processed individually.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When restoring all files from a backup directory, try a mass link (or
copy) first, as it is much faster. It is however not portable and may
thus fail. If it fails, fallback to per-file processing, which always
works.
This change results in a huge performance boost on systems where
the cp command supports all the required options (which includes
all systems using GNU coreutils.)
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Create two separate lists for empty and non-empty files. This will
allow dedicated handling of each set of files.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
| |
Remember the results of the find command, to avoid having to run it
again later. We use a temporary file rather than a local variable,
because you can't store binary zeroes in a bash string, and because
the temporary file approach performs better on large file sets.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The "check for hard links" use case is almost always a no-op. Check
if any work is needed at all first, and only if this is the case,
walk the list of files and unlink the faulty files. This approach
results in a huge performance gain in the most common case, and a
very small performance loss in the uncommon case.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
| |
Move the code to restore all files from a backup directory to a
separate function. This only duplicates a small amount of code, and
makes the code clearer. This will also allow further optimizations of
the specific use case of "quilt pop".
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
In if/else constructs, always start with the positive case, to avoid
a negation.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Optimize the noop operation. The only use case in quilt is to ensure
that files have a link count of 1, so we can check that OPT_NOLINKS
is set once and for all, instead of checking again with every file.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Don't use the ${VAR} construct when we don't have to, it's slightly
slower than simple variable names. Likewise, don't use quotes when
we don't have to.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When restoring all files, batch the first steps (directory creation
and target file removal) and last steps (optional touch and backup
file removal). This makes the typical restore case (quilt pop) much,
much faster.
Note: a similar optimization would be possible for the removal
function (-x), but quilt doesn't use this function at the moment.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Use quilt's internal implementation of dirname. This is more
efficient than calling an external binary, and avoids a dependency.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Make the various file list selection methods mutually exclusive.
This is the actual usage scheme by quilt, and handling them
separately makes the code both clearer and more efficient.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
No need to copy all file names to a dedicated array, we can use $@
directly instead.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Optimize backup:
* Due to the way quilt uses backup-files, the backup file will never
exist, so there is no point checking for this.
* Don't attempt to create directories which already exist.
* Use > instead of touch to create new files, it's faster.
* Stop supporting option -t on backup, it's undocumented and quilt
doesn't use it.
* Drop unneeded quotes around constant.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Optimize restore:
* Don't call mkdir if we know the directory already exists.
* Don't try to optimize the -L case, quilt doesn't use it anyway and
the current optimization is broken.
* Move common code at the end of the function.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
The different actions don't have much code in common, so it would be
more efficient to let different functions handle them.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
| |
Let find report errors by itself.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Enforce the fact that the prefix must be a directory. This is what
quilt does, and enforcing it allows some code clean-ups.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Calling dirname and basename is costly, and here we really don't have
to. We can simply use a different temporary file name.
Additionally, if stat succeeds, it will always return a valid number,
so we can relax the tests.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Expand functions copy_file and link_or_copy_file at calling
locations, the code is so simple that it hardly deserves dedicated
functions.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
The program name $0 is a global variable, there is no point in
passing it to functions as a parameter.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Don't test for the presence of files to process. Nothing wrong will
happen if we don't have any file to process, and backup-files is for
quilt's internal use only, so there is no need to be paranoid.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
Quilt doesn't make use of the suffix (-z) option of backup-files, so
there is no point in implementing it
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
| |
Finally get rid of the old C implementation of backup-files, together
with all the related checks in configure and variables in Makefile.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
|
|
| |
Use rmdir -p instead of open-coding it. The more complex code was
maybe needed to properly handle symbolic links, but we know that
there won't be symbolic links in the backup directory, so the extra
complexity isn't needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
|
| |
Avoid using uncommon cp options which hurt portability. I fail to see
why we would need them anyway, as we are never working with symbolic
links by construction (quilt doesn't support them.)
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Raphael Hertzog <hertzog@debian.org>
|
|
|
|
|
|
|
|
| |
The stat command on BSD takes different parameters from the GNU one.
Let configure find out which variant is available, and use the right
parameters.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
|
|
|
|
| |
Make backup-files a shell script instead of a binary, so we can make
quilt arch: all [Steve Langasek, thanks so much]
(Closes: Debian #363659)
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
|
| |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Based on a preliminary patch by Yasushi SHOJI.
None of quilt code uses parse-patch anymore. The last one, it seems,
was contrib/import.diff, which was removed at 2f9728a9. So, just
remove it.
|
|
|
|
|
|
|
| |
file permissions
Access control lists will add a "+", and SELinux will add a "."; we don't care
in the test suite.
|
|
|
|
|
| |
In addition to Signed-off-by and Acked-by, also CC people in Suggested-by,
Reviewed-by, Requested-by, Reported-by, and Tested-by headers.
|
|
|
|
|
|
|
| |
There is no guarantee that the wrapper script can be executed.
For example users can mount their temporary directories with noexec
for security reasons. Instead of failing with no explanation,
complain when this situation is detected.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When using bash TAB completion in "quilt push <TAB>", if no patch is
applied, it shows the standard error of the command "quilt applied"
("No patches applied"), used in the source file bash_completion to get
the list of applied patches.
This is similar to commit 6af132b5061f6773f9591ebde625c92a395ebc91,
but for the push script that were forgotten previously.
|
|
|
|
| |
This avoids generating it twice, once for README and once for quilt.1.
|
| |
|