summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-refs.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-53/+52
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* bin/refs: Add option to print revisionsDan Nicholson2023-02-071-1/+17
| | | | | | Allow printing the revision along with the ref. This is very convenient for looping over the refs in a shell as well as for quickly seeing which refs are pointed to the same commit.
* bin/refs: Sort listingDan Nicholson2023-02-071-6/+28
| | | | | The output is much more readable sorted. I can't think of any reason you'd want it unsorted (which is essentially dentry order).
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* bin/refs: Allow overwriting existing refDan Nicholson2019-06-121-3/+7
| | | | | | | | | | | | | | Currently if you want to update a non-alias ref, you need to first check if it exists and use either `ostree refs --create` or `ostree reset` as appropriate. That's unnecessarily complicated and is much less convenient than the old `write-refs` builtin that simply called `ostree_repo_set_ref_immediate()` without any checks. Add a `--force` option to be used with `--create` that does not raise an error when the destination ref already exists. Closes: #1870 Approved by: jlebon
* bin/refs: Disallow creating broken aliasesJonathan Lebon2018-10-311-0/+3
| | | | | | | | | | This is the alias version of #1749. I.e. we want to make sure that one can't even create an alias which would end up dangling. See also: https://pagure.io/releng/issue/7891 Closes: #1768 Approved by: sinnykumari
* src/ostree: Don't delete refs having aliasesSinny Kumari2018-10-111-2/+15
| | | | | | | | | | | | Deleting a ref with aliases makes them dangling. In such cases, display an error message to the user. Fixes #1597 Signed-off-by: Sinny Kumari <sinny@redhat.com> Closes: #1749 Approved by: cgwalters
* bin/refs: Clarify --create error messagebubblemelon2018-07-301-1/+1
| | | | | | | Fix ref create error when existing rev not specified. Closes: #1690 Approved by: jlebon
* Make P2P API public (no longer experimental)Matthew Leeds2018-06-041-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the API that allows P2P operations (e.g. pulling an ostree ref from a LAN or USB source) is hidden behind the configure flag --enable-experimental-api. This commit makes the API public and makes that flag essentially a no-op (leaving it in place in case we want to use it again in the future). The P2P API has been tested over the last several months and proven to work. This means that since we're no longer using the "experimental" feature flag, P2P builds of Flatpak will fail when using versions of OSTree from this commit onwards, until Flatpak is patched in the near future. If you want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree 2018.6, you'll have to patch Flatpak. However, since Flatpak won't yet have a hard dependency on OSTree 2018.6, it needs a new way to determine if the P2P API in OSTree is available, so this commit adds a "p2p" feature flag. This way the feature set is more semantically correct than if we had continued to use the "experimental" feature flag. In addition to making the P2P API public, this commit makes the P2P unit tests run by default, removes the f27-experimental CI instance that's no longer needed, changes a few man pages to reflect the changes, and updates the bash completion script to accept the new commands and options. Closes: #1596 Approved by: cgwalters
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* bin/refs: Disallow aliases to remote refsColin Walters2017-12-141-0/+2
| | | | | | | | | | It can't really work in general; the client and server would have to agree on the name of the remote. Closes: https://github.com/ostreedev/ostree/issues/1342 Closes: #1381 Approved by: jlebon
* ostree: provide command description in a better placeRuixin Bao2017-10-201-1/+1
| | | | | | | | | | | | | | | | | | | This is similar idea as https://github.com/projectatomic/rpm-ostree/pull/916/commits/5c0bf889155573feec108501ce849ac09a0c9567, The duplicated description is now removed, and the description of the command is now displayed beneath the Usage. For example: ostree cat -h will output the following: "Usage: ostree cat [OPTION?] COMMIT PATH... Concatenate contents of files" Closes: #1267 Approved by: cgwalters
* ostree: move flags into command struct, pass down through builtinsRuixin Bao2017-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | This is a similar approach as https://github.com/projectatomic/rpm-ostree/commit/12c34bb2491a07079c911ef26401fee939e5573c. One thing to note is when we parse the admin related functions, we still keep the old admin related flags, and added a new parameter to represent the command struct. This allows us to identify the caller of the function, making it easier for us to possibly deduplicate the subcommand handling in the future. A similar approach is done in rpm-ostree: https://github.com/projectatomic/rpm-ostree/commit/83aeb018c1012c7a43783c09b74ec71bc9c45826 This also makes it easier for us to change the prototype of the function. If we want to add something new in the future, we won't need to touch every prototype. Closes: #1267 Approved by: cgwalters
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* lib/repo-refs: Include remote refs when using collectionsMatthew Leeds2017-08-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | When working with collections it can be useful to see remote refs rather than just local and mirrored ones. This commit changes the "ostree refs -c" output to include remote refs, and includes remote refs with collection IDs in summary file generation as well. The former behavior is consistent with how "ostree refs" works, and the latter behavior is useful in facilitating P2P updates even when mirrors haven't been configured. To accomplish this, OstreeRepoListRefsExtFlags was extended with an EXCLUDE_REMOTES flag. This was done rather than an INCLUDE_REMOTES flag so that existing calls to ostree_repo_list_refs_ext continue to have the same behavior. This flag was added to ostree_repo_list_collection_refs (which is an experimental API break). Also, add unit tests for the "refs -c" and summary file behavior, and update relevant tests. Closes: #1069 Approved by: cgwalters
* ostree: Add naggy comments to help keep options in syncMatthew Barnes2017-08-151-0/+5
| | | | | | | | | | /* ATTENTION: * Please remember to update the bash-completion script (bash/ostree) and * man page (man/ostree-$COMMANDNAME.xml) when changing the option list. */ Closes: #1080 Approved by: cgwalters
* tree-wide: Use g_autoptr(Ostree*)Colin Walters2017-08-031-1/+1
| | | | | | | | | | | Part of cleaning up our usage of libglnx; we want to use what's in GLib where we can. Had to change a few .c files to `#include ostree.h` early on to pick up autoptrs for the core types. Closes: #1040 Approved by: jlebon
* lib/repo: Add API to create and list ref aliasesColin Walters2017-08-021-14/+46
| | | | | | | | | | | | | | | | | | | There are multiple use cases where we'd like to alias refs. First, having a "stable" alias which gets swapped across major versions: https://pagure.io/atomic-wg/issue/228 Another case is when a ref is obsoleted; <https://pagure.io/atomic-wg/issue/303> This second one could be done with endoflife rebase, but I think this case is better on the server side, as we might later change our minds and do actual releases there. I initially just added some test cases for symlinks in the `refs/heads` dir to ensure this actually works (and it did), but I think it's worth having APIs. Closes: #1033 Approved by: jlebon
* bin/refs: Fix error handling logicColin Walters2017-08-021-1/+2
| | | | | | | | | Spotted by Coverity. Coverity CID: 1452202 Closes: #1037 Approved by: jlebon
* refs: Add a --collections argument to the built-in refs commandPhilip Withnall2017-06-261-0/+97
| | | | | | | | | | | | | | Rather than change the output format used by the existing refs command to output collection IDs in addition to ref names, this functionality has been hidden behind an --collections argument. If it’s not specified `ostree refs` will output the same content as before for a given repository. If it is specified, the collection ID for each ref will be included in the output as (collection ID, ref name). Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #924 Approved by: cgwalters
* tree-wide: Switch to autoptr for GOptionContextColin Walters2016-12-081-3/+1
| | | | | | | | | | We were leaking in a few places that I noticed in an ASAN run. Also, this was one of the last non-autoptr cleanup sections we have in `out:` cleanup sections, making us a lot closer to a potential full-tree rewrite to `return FALSE`. Closes: #624 Approved by: jlebon
* refs: resolve conflict between local/remote reposYu Qi Zhang2016-06-231-2/+7
| | | | | | | | | | | | | | | | | | | Add the functionality to use the same name for refs in local and remote repos. This helps users keep track of local refs of remote origin, much like local and remote git branches. Previously, when a local ref is specified, resolve_refspec would fall back to searching through remote repos if the ref is not found locally. This function now takes an extra flag to specify whether it should search through remote repos. Additionally, ostree_repo_resove_rev_ext was added to call resolve_refspec with fallback_remote being false, so refs --create would no longer complain when trying to create a local ref of the same name as a remote one. Fix remote repo parsing not being handled correctly on refs --create. Closes: #363 Approved by: jlebon
* refs: allow overwrite of empty foldersYu Qi Zhang2016-06-211-1/+9
| | | | | | | | | | | | | | | | We noticed that once a ref folder is created, there is no existing command that can remove it. For example, once "foo/bar" is created, even if the user deletes foo or all the refs under foo, the folder will persist. Now when the user attempts to create a ref "foo" either through commit or refs --create, if a folder "foo" exists but is empty of refs, the folder is removed and the new ref "foo" is created. New unit tests in tests-ref.sh verify this functionality. Closes: #354 Approved by: cgwalters
* refs: add "ostree refs --create" and unit testsYu Qi Zhang2016-06-151-1/+45
| | | | | | | | | | | | | | | | | Added the ability to create a ref (much like a git tag) for an existing commit through "ostree refs EXISTING --create=NEWREF". Previously the only way to create a new ref was by creating a new commit, but refs --create allows multiple refs to point to the same commit. The command will fail if: - None/more than one existing ref is specified - The specified EXISTING tag does not exist, or was not specified - The specified NEWREF already exists, or is the name of a folder Add unit tests in tests-ref.sh to verify above functionality Closes: #340 Approved by: jlebon
* refs: Add argument --list to print the full ref nameGiuseppe Scrivano2016-03-021-6/+10
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* refs: allow to specify multiple refs as argsGiuseppe Scrivano2016-03-021-26/+44
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* Remove unnecessary #include "libgsystem.h"Matthew Barnes2015-05-061-1/+0
|
* Use g_autoptr(GHashTable) instead of gs_unref_hashtableMatthew Barnes2015-05-061-1/+1
|
* Use glnx_unref_object instead of gs_unref_objectMatthew Barnes2015-05-061-1/+1
| | | | | For non-GIO object types, at least until autocleanup support for GObject based types becomes more widespread.
* Use g_autofree instead of gs_freeMatthew Barnes2015-05-061-2/+2
|
* Require a PREFIX when deleting refsMatthew Barnes2015-01-061-1/+9
| | | | | | | Also fix the "ostree refs" help output to not give the impression that the --delete option takes its own PREFIX argument. https://bugzilla.gnome.org/show_bug.cgi?id=742454
* Refactor command-line parsingMatthew Barnes2014-11-241-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor command-line parsing to better utilize GOptionContext. This eliminates most of the manual parsing and global options are now shown in the help output. Here's a sample: $ ostree admin --help Usage: ostree admin [OPTION...] --print-current-dir|COMMAND Builtin "admin" Commands: cleanup config-diff deploy init-fs instutil os-init status switch undeploy upgrade Help Options: -h, --help Show help options Application Options: --sysroot=PATH Create a new OSTree sysroot at PATH -v, --verbose Print debug information during command processing --version Print version information and exit https://bugzilla.gnome.org/show_bug.cgi?id=740295
* repo: Don't require a txn for writingColin Walters2014-05-261-7/+9
| | | | | | | | | | | | | | The current "transaction" symlink was introduced to fix issues with interrupted pulls; normally we assume that if we have a metadata object, we also have all objects to which it refers. There used to be a "summary" which had all the available refs, but I deleted it because it wasn't really used, and was still racy despite the transaction bits. We still want the pull process to use the transaction link, so don't delete the APIs, just relax the restriction on object writing, and introduce a new ostree_repo_set_ref_immediate().
* Move ref writing to be transaction-basedJasper St. Pierre2013-09-061-3/+9
| | | | | | | | | | Rather than having separate write_ref calls, make clients start a transaction, add some refs, and then commit it. While this doesn't make it 100% atomic, it makes it easier for us to use an atomic model, and it means we don't do as much I/O updating the summary file and such. https://bugzilla.gnome.org/show_bug.cgi?id=707644
* main: Code cleanup by passing OstreeRepo * directly to builtinsColin Walters2013-08-251-6/+1
| | | | | | | | | | It turns out every builtin (with one special exception) that takes a repo argument did the same thing; let's just centralize it. The special exception was "ostree init --repo=foo" where foo is expected to *not* actually be a repo. In that case, simply skip the ostree_repo_check() invocation. https://bugzilla.gnome.org/show_bug.cgi?id=706762
* Install a shared libraryColin Walters2013-07-261-0/+1
| | | | | This required a fair bit of surgery because previously ostree.h included otutil.h, but that's supposed to be a private library.
* main: Move GCancellable to toplevelColin Walters2013-07-161-2/+1
| | | | | This is just cleaner, and makes the builtins slightly more of a library, which in turn makes it easier to turn them into real API.
* ostree: Some header file cleanupsColin Walters2013-07-091-1/+0
|
* Add support for deleting refsColin Walters2013-07-011-6/+21
| | | | | The internal API will be used by admin, and "ostree refs --delete" is handy for interactive management.
* Add "refs" builtinColin Walters2013-06-291-0/+75
This is just useful to look at before pruning, etc.