2013-08-14 15:05:09 +02:00
#!/bin/bash
#
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
#
2018-01-30 20:26:26 +01:00
# SPDX-License-Identifier: LGPL-2.0+
#
2013-08-14 15:05:09 +02:00
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
2021-12-06 20:20:55 -05:00
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
2013-08-14 15:05:09 +02:00
2016-01-27 11:44:10 -05:00
set -euo pipefail
2013-08-14 15:05:09 +02:00
2016-03-31 17:47:36 +01:00
. $( dirname $0 ) /libtest.sh
2013-08-14 20:46:46 +02:00
2017-03-24 10:35:59 -04:00
skip "We don't really have a use case for committing user. xattrs right now. See also https://github.com/ostreedev/ostree/issues/758"
# Dead code below
2016-03-31 17:47:36 +01:00
skip_without_user_xattrs
2013-08-14 15:05:09 +02:00
2016-03-31 17:47:36 +01:00
echo "1..2"
2013-08-14 15:05:09 +02:00
2017-09-01 16:15:33 -04:00
setup_test_repository "archive"
2013-08-14 15:05:09 +02:00
cd ${ test_tmpdir }
2015-11-09 13:03:35 +01:00
${ CMD_PREFIX } ostree --repo= repo checkout test2 test2-checkout1
2013-08-14 15:05:09 +02:00
setfattr -n user.ostree-test -v testvalue test2-checkout1/firstfile
setfattr -n user.test0 -v moo test2-checkout1/firstfile
2015-11-09 13:03:35 +01:00
${ CMD_PREFIX } ostree --repo= repo commit -b test2 -s xattrs --tree= dir = test2-checkout1
2013-08-14 15:05:09 +02:00
rm test2-checkout1 -rf
echo "ok commit with xattrs"
2015-11-09 13:03:35 +01:00
${ CMD_PREFIX } ostree --repo= repo checkout test2 test2-checkout2
2013-08-14 15:05:09 +02:00
getfattr -m . test2-checkout2/firstfile > attrs
2019-04-01 19:01:49 -07:00
assert_file_has_content attrs '^user\.ostree-test'
assert_file_has_content attrs '^user\.test0'
2013-08-14 15:05:09 +02:00
getfattr -n user.ostree-test --only-values test2-checkout2/firstfile > v0
assert_file_has_content v0 '^testvalue$'
getfattr -n user.test0 --only-values test2-checkout2/firstfile > v1
assert_file_has_content v1 '^moo$'
echo "ok checkout with xattrs"