Don't attempt to remove the Linux attr extents flag (see chattr(1)).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Fix metadata._set_up_path() to allow restoration of top-level files.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Change metadata "owner" to "user" everywhere to match stat(2), tar, etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Default to stdin/stdout in bup meta when -f is not specified.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Convert BUP_DIR to an absolute path so chdir() won't cause trouble.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Always run metadata tests; disable root-level tests when not on Linux.

Disable the root-level test-meta.sh tests when the uname output
doesn't match Linux since they're not likely to work elsewhere right
now.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Depend on the kernel headers, not the ext2 headers, for Linux attr support.

Switch to the kernel FS_* defines (in linux/ext2_fs.h) instead of the
EXT* defines (in ext2fs/ext2_fs.h -- from the ext2fs headers).

Also add FS_NOCOW_FL to the "modifiable flags" mask whenever it's
available.

Reported-by: Yung-Chin Oei <yungchin@yungchin.nl>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Yung-Chin Oei <yungchin@yungchin.nl>
Add _open_noatime() and use it bup_get_linux_file_attr().

Reported-by: Yung-Chin Oei <yungchin@yungchin.nl>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Yung-Chin Oei <yungchin@yungchin.nl>
Implement git.PackIdxV{1,2}.hashes_sorted_by_ofs()
Implement BitArray
Add repack command
Implement repository wide locking

Add git.lock(), git.unlock() and git.is_locked(), which handle locking
of the repository.
Add locking to repack command
Make save and repack respect a lock
unlock repository on error "No reachable objects found"

running bup repack on an empty repository left the repository locked.

Signed-off-by: Tim Riemenschneider <debian@tim-riemenschneider.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
also delete pack-*.vol000+200.par2 files after repack

otherwise these would be left behind

Signed-off-by: Tim Riemenschneider <debian@tim-riemenschneider.de>
[zz@zoranzaric.de: Remove the test that counts packfiles]
Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Bugfix: repack did not work for "larger" repositories

repack only worked, if the git.PackIdxList still contained all the
*.idx files, one per *.pack file. If they got replaced by a *.midx file,
not only it traversed objects multiple times, these objects are not
considered for repack. (Since I think that the other pack-files are
untouched, no data-loss should occur)

This fix tells PackIdxList to ignore the midx-files.

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Fix: Use env-var BUP_MAIN_EXE

Instead of running 'bup fsck -g' (and thus require bup being in the PATH)
use the environment variable BUP_MAIN_EXE
(otherwise the testcase with par2 fails, too)

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Delete midx after repack

otherwise subsequent bup-runs fire warnings of missing .idx files used by the
(old) midx-file(s)

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
A test-case for the repack-with-midx-problem

(containing a recipe to reproduce it)

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
[zz@zoranzaric.de: Remove grep-writing-objects-tests because we don't
rewrite the packfile anymore]
Signed-off-by: Zoran Zaric <zz@zoranzaric.de>