aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-08-25 00:16:49 +0200
committerLudovic Courtès <ludo@gnu.org>2014-08-25 00:16:49 +0200
commitc6df09941b9fb225788e9efa276b7aa92e19d3c0 (patch)
treecc23035709113272f728a94d58f1768810cfce2d /tests
parentbcac69f674ce1525c263632ba796297b850b5147 (diff)
downloadpatches-c6df09941b9fb225788e9efa276b7aa92e19d3c0.tar
patches-c6df09941b9fb225788e9efa276b7aa92e19d3c0.tar.gz
guix-register: By default, attempt to deduplicate registered items.
* nix/guix-register/guix-register.cc (GUIX_OPT_DEDUPLICATE): New macro. (options): Add --no-deduplication. (deduplication): New variable. (parse_opt): Handle GUIX_OPT_DEDUPLICATE. (register_validity): Add 'optimize' parameter and honor it. (main): Move 'store' instanatiation after 'settings.nixStore' assignment. * tests/guix-register.sh: Add test for deduplication. * guix/nar.scm (finalize-store-file): Update comment above 'register-path' call.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-register.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/guix-register.sh b/tests/guix-register.sh
index 3f261d7bef..e99f5c6075 100644
--- a/tests/guix-register.sh
+++ b/tests/guix-register.sh
@@ -43,13 +43,28 @@ $new_file
0
EOF
-# Make sure it's valid, and delete it.
+# Register an idendical file, and make sure it gets deduplicated.
+new_file2="$new_file-duplicate"
+cat "$new_file" > "$new_file2"
+guix-register <<EOF
+$new_file2
+
+0
+EOF
+
+guile -c "
+ (exit (= (stat:ino (stat \"$new_file\"))
+ (stat:ino (stat \"$new_file2\"))))"
+
+# Make sure both are valid, and delete them.
guile -c "
(use-modules (guix store))
(define s (open-connection))
(exit (and (valid-path? s \"$new_file\")
+ (valid-path? s \"$new_file2\")
(null? (references s \"$new_file\"))
- (pair? (delete-paths s (list \"$new_file\")))))"
+ (null? (references s \"$new_file2\"))
+ (pair? (delete-paths s (list \"$new_file\" \"$new_file2\")))))"
#