Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of pinned packages #14

Merged
merged 34 commits into from
Mar 3, 2015

Conversation

doudou
Copy link
Member

@doudou doudou commented Dec 21, 2014

This set of commit improves the handling of detached HEAD, and simplifies the update logic in the git importer quite a lot in the process.

So far, the git importer would create a detached HEAD when pinned to a commit or tag. This is really really confusing for users, as using git on a detached HEAD is weird (and it is easy to "lose" data when using them).

Instead, after this pull request, the importer will NEVER create a detached HEAD. It will checkout the branch setup in the importer (i.e. the "local branch") and either reset it to the pinned commit if all other commits are present remotely, or generate an error.

Uncommitted changes are handled the way "git checkout" handles them. That is, they are applied on the new HEAD if possible, or the reset is aborted (with error) if they don't.

Sylvain Joyeux and others added 24 commits February 4, 2015 12:46
The current behaviour when commit: or tag: was given was to create
a detached HEAD, which is really really less than ideal.

Since we are going to use those a lot more, this commit tries to find
a better way. Namely, autobuild now resets the local branch to the
commit while trying to preserve uncommitted changes. It will do so
only if the branch contains only commits that are already on the remote
origin.
While most of the git CLI is fairly stable and backward compatible,
it happens that it breaks. For instance git update-index --cacheinfo
was given arguments delimited by spaces but is now (2.1.0) expecting
them with commas.
This fixes a failure in #commit_pinning, where update-ref gets called
with a tag instead of a commit by resolving the commit explicitely.
Moreover, it fixes the rescue clause to ensure that it does not
create a detached HEAD
the :at_least_version method had a sign error, and would return
the inverse of what would be expected.
This closes rock-core/autoproj#39 and is required for the
implementation of rock-core/autoproj#37.

It adds a reset option to #import which controls what to do if
the local working copy is not exactly the state specified by
the importer configuration. The only one which acts on it is
really the git importer, the other ones simply ignore it.

This modifies the importer API in a backward-compatible way, changing
the second argument from a boolean to an option hash, but allowing the
boolean to be still passed as-is

In addition, it implements a fast path in the git importer in case
the commit/tag is already available.
@doudou doudou force-pushed the improve_handling_of_detached_head branch from f2bac32 to e650309 Compare February 5, 2015 16:22
Somewhat, the updated test SVN root got lost
This went unnotticed as it passed the option object as-is to
Importer#import
doudou and others added 7 commits February 5, 2015 17:01
This is the first step towards removing all these horrible
globals ...
env_clear clears the inherited environment as well. We really only
want to delete the current value for the environment
env_set had a bug related to rock-core/autoproj#43. This adds
some tests for corner-cases and fixes that particular bug.
To check for the presence of a SHA, you have to explicitly
give the object type you're looking for (in this case, a commit)
…tely_error_message

git: improve error message when the local HEAD is not present in remote_...
doudou added a commit that referenced this pull request Mar 3, 2015
@doudou doudou merged commit fd9f84e into master Mar 3, 2015
@doudou doudou deleted the improve_handling_of_detached_head branch March 3, 2015 13:32
@doudou
Copy link
Member Author

doudou commented Mar 3, 2015

There are no outstanding bugs not tagged with post-versioning anymore, I'm merging it (as discussed last time).

2maz pushed a commit to 2maz/autobuild that referenced this pull request Apr 29, 2015
…ing_warning_to_current_os

osdep: warn about osdep overriding each other only for this specific OS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants