summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-diff.c
diff options
context:
space:
mode:
authorErik Larsson <erik@ortogonal.com>2017-02-08 21:59:38 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-03-21 13:38:04 +0000
commite665e5140838f5b44efefef0b5c4180e3bf3cfc1 (patch)
tree03bf8754fadc338b63ac19e847a82743cafb248c /src/ostree/ot-builtin-diff.c
parent5d413dff882efe1ee4faa6e4642d5b04598c01b8 (diff)
downloadostree-e665e5140838f5b44efefef0b5c4180e3bf3cfc1.tar.gz
diff: Add ostree_diff_dirs_with_options(), expose via cmdline
The first options are owner_uid/owner_gid, which makes it possible to use diff on local files where --owner-uid/gid have been passed to commit. Closes: #740 Approved by: cgwalters
Diffstat (limited to 'src/ostree/ot-builtin-diff.c')
-rw-r--r--src/ostree/ot-builtin-diff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ostree/ot-builtin-diff.c b/src/ostree/ot-builtin-diff.c
index 963a8b7c..a7e2aad2 100644
--- a/src/ostree/ot-builtin-diff.c
+++ b/src/ostree/ot-builtin-diff.c
@@ -30,11 +30,15 @@
static gboolean opt_stats;
static gboolean opt_fs_diff;
static gboolean opt_no_xattrs;
+static gint opt_owner_uid = -1;
+static gint opt_owner_gid = -1;
static GOptionEntry options[] = {
{ "stats", 0, 0, G_OPTION_ARG_NONE, &opt_stats, "Print various statistics", NULL },
{ "fs-diff", 0, 0, G_OPTION_ARG_NONE, &opt_fs_diff, "Print filesystem diff", NULL },
{ "no-xattrs", 0, 0, G_OPTION_ARG_NONE, &opt_no_xattrs, "Skip output of extended attributes", NULL },
+ { "owner-uid", 0, 0, G_OPTION_ARG_INT, &opt_owner_uid, "Use file ownership user id for local files", "UID" },
+ { "owner-gid", 0, 0, G_OPTION_ARG_INT, &opt_owner_gid, "Use file ownership group id for local files", "GID" },
{ NULL }
};
@@ -177,8 +181,10 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
modified = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_diff_item_unref);
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
added = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
-
- if (!ostree_diff_dirs (diff_flags, srcf, targetf, modified, removed, added, cancellable, error))
+
+ OstreeDiffDirsOptions diff_opts = { opt_owner_uid, opt_owner_gid };
+ if (!ostree_diff_dirs_with_options (diff_flags, srcf, targetf, modified, removed,
+ added, &diff_opts, cancellable, error))
goto out;
ostree_diff_print (srcf, targetf, modified, removed, added);